blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
be67a350b0c9593451c62109af1de0e934e797d9 | e9ad092dfc4efe87fe49e3d3083482311f765731 | /dans-wicket/src/main/java/nl/knaw/dans/common/wicket/behavior/IncludeJsOrCssBehavior.java | 3b49bf6c873766fb0bab81d47c308759bdd18d1c | [
"Apache-2.0"
] | permissive | DANS-KNAW/dccd-legacy-libs | e0f863cc5953dcceb9b91d4eb6ffdd0d37831bbb | 687d2e434359ad80af0b192748475ec4a76529c4 | refs/heads/master | 2021-01-01T19:35:17.114074 | 2019-09-03T13:58:30 | 2019-09-03T13:58:30 | 37,195,178 | 0 | 1 | Apache-2.0 | 2020-10-13T06:53:30 | 2015-06-10T12:15:06 | Java | UTF-8 | Java | false | false | 3,032 | java | /*******************************************************************************
* Copyright 2015 DANS - Data Archiving and Networked Services
*
* 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 nl.knaw.dans.common.wicket.behavior;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.behavior.AbstractBehavior;
import org.apache.wicket.markup.html.IHeaderResponse;
import org.apache.wicket.markup.html.resources.CompressedResourceReference;
/**
* <p>
* Behavior that adds an included css or JS resource to component (e.g., a page). The scope is a class in
* the same package as where the resource resides. Typically, the scope is the class object of a wicket
* page or panel and the resource is CSS- or JavaScript file that is included in the source code in the
* same package as the class. The HTML-template of the class can then refer to the resource without a
* prefixed path.
* </p>
* <p>
* Example:
*
* <pre>
* JAVA FILE:
*
* public class MyPage extends Page {
*
* public MyPage() {
* add(new IncludeResourceBehavior(MyPage.class, "myjavascript.js");
* // ... etc
*
* HTML-TEMPLATE MyPage.html:
*
* <html>
* <head>
* <script type="text/javascript" src="myjavascript.js">
*
* <-- etc -->
* </pre>
*/
public class IncludeJsOrCssBehavior extends AbstractBehavior
{
private static final long serialVersionUID = 5261628952131156563L;
private final Class<?> scope;
private final String resource;
public IncludeJsOrCssBehavior(Class<?> scope, String resource)
{
if (!resource.endsWith(".js") && !resource.endsWith(".css"))
{
throw new IllegalArgumentException("Only JavaScript or CSS resources can be rendered");
}
this.scope = scope;
this.resource = resource;
}
@Override
public void renderHead(IHeaderResponse response)
{
final ResourceReference ref = new CompressedResourceReference(scope, resource);
if (resource.endsWith(".js"))
{
response.renderJavascriptReference(ref);
}
else if (resource.endsWith(".css"))
{
response.renderCSSReference(ref);
}
else
{
throw new RuntimeException("Only know how to render JavaScript or CSS references");
}
}
}
| [
"[email protected]"
] | |
97356a5672719070a1413c561ab9137b82ae6175 | 804247bd22eb0424df9527dd24b3126efd58ffb3 | /src/main/java/module-info.java | ed8d2d7d8963c7e2d1e6d15403126f68e6a2b09b | [
"Apache-2.0"
] | permissive | stelesoft/FortiFY | 8596651b8b1b345c1d8a103c38b4f2e01a2c0bea | db9e7d88cf41f4fd277604589253b615239856d9 | refs/heads/master | 2023-01-03T11:52:56.221671 | 2020-10-18T23:20:19 | 2020-10-18T23:20:19 | 291,571,980 | 0 | 1 | Apache-2.0 | 2020-10-18T23:19:36 | 2020-08-30T23:49:34 | null | UTF-8 | Java | false | false | 895 | java | /*
* Copyright 2020 Stelesoft.com
*
* 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.
*/
/**
* Base module for the FortiFY library.
*/
module FortiFY
{
// Module dependencies
requires javafx.base;
requires javafx.controls;
requires javafx.graphics;
// Expose module contents to the outside world
exports com.stelesoft.fortify;
}
| [
"[email protected]"
] | |
f5cb0ae9c4826e14b534ce07713280e16ca34cba | ee0a1fc029ce62881f25a510e99e12be0d2600e0 | /app/src/main/java/com/cartoony/fragment/SettingFragment.java | c24fdab736c7e9723db332bf5489c491882e4e6b | [] | no_license | softinsolutions/AllInOneVideo_V1.9 | 975035b114a5fb9fda6698e096d3f3ca79171f48 | 33931c406213eeed9319946f56c369dcd3463104 | refs/heads/master | 2022-12-14T23:09:19.347861 | 2020-08-25T10:41:16 | 2020-08-25T10:41:16 | 289,996,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,562 | java | package com.cartoony.fragment;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.fragment.app.Fragment;
import androidx.appcompat.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import com.onesignal.OneSignal;
import com.cartoony.allinonevideo.ActivityAboutUs;
import com.cartoony.allinonevideo.ActivityPrivacy;
import com.cartoony.allinonevideo.MyApplication;
import com.cartoony.allinonevideo.R;
public class SettingFragment extends Fragment {
MyApplication MyApp;
SwitchCompat notificationSwitch,notificationSwitchMode;
LinearLayout lytAbout, lytPrivacy, lytMoreApp, layRateApp,layShareApp;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setHasOptionsMenu(true);
View rootView = inflater.inflate(R.layout.fragment_setting, container, false);
MyApp = MyApplication.getInstance();
notificationSwitch = rootView.findViewById(R.id.switch_notification);
lytAbout = rootView.findViewById(R.id.lytAbout);
lytPrivacy = rootView.findViewById(R.id.lytPrivacy);
lytMoreApp = rootView.findViewById(R.id.lytMoreApp);
layRateApp = rootView.findViewById(R.id.lytRateApp);
layShareApp=rootView.findViewById(R.id.lytShareApp);
notificationSwitch.setChecked(MyApp.getNotification());
notificationSwitchMode=rootView.findViewById(R.id.switch_notification_night);
if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES)
notificationSwitchMode.setChecked(true);
notificationSwitchMode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
MyApplication.getInstance().setIsNightModeEnabled(isChecked);
MyApplication.getInstance().onCreate();
Intent intent = requireActivity().getIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
requireActivity().finish();
startActivity(intent);
}
});
layRateApp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse("market://details?id=" + requireActivity().getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
// To count with Play market backstack, After pressing back button,
// to taken back to our application, we need to add following flags to intent.
goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
try {
startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id=" + requireActivity().getPackageName())));
}
}
});
notificationSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
MyApp.saveIsNotification(isChecked);
OneSignal.setSubscription(isChecked);
}
});
lytAbout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent_ab = new Intent(requireActivity(), ActivityAboutUs.class);
startActivity(intent_ab);
}
});
lytPrivacy.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent_pri = new Intent(requireActivity(), ActivityPrivacy.class);
startActivity(intent_pri);
}
});
lytMoreApp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.play_more_apps))));
}
});
layShareApp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_msg) + "\n" + "https://play.google.com/store/apps/details?id=" + getActivity().getPackageName());
sendIntent.setType("text/plain");
startActivity(sendIntent);
}
});
return rootView;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
// TODO Add your menu entries here
super.onCreateOptionsMenu(menu, inflater);
menu.clear();
}
}
| [
"[email protected]"
] | |
af017ae72eae805a7e9adaa6a5d53e834feee09c | 850b06f040ae8445d6f5d21e881ff43cd3f8788c | /src/main/java/ru/kolyasnikovkv/discussion1c/util/HttpUtil.java | b3cce931adac75c9bfcfe88573636782757955fe | [] | no_license | KolyasnikovKV/1CDiscussion | 675bde1aa070804825f104e1f8064297873d0fdb | a39b57114877a337883be63ea57a8a428171d152 | refs/heads/master | 2022-09-30T19:19:16.221953 | 2020-03-18T08:26:01 | 2020-03-18T08:26:01 | 248,157,272 | 0 | 0 | null | 2022-09-01T23:21:39 | 2020-03-18T06:40:02 | Java | UTF-8 | Java | false | false | 1,658 | java | package ru.kolyasnikovkv.discussion1c.util;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by tomoya.
* Copyright (c) 2018, All Rights Reserved.
* https://yiiu.co
*/
public class HttpUtil {
public static boolean isApiRequest(HttpServletRequest request) {
return request.getHeader("Accept") == null || !request.getHeader("Accept").contains("text/html");
}
// 根据请求接收的类型定义不同的响应方式
// 判断请求对象request里的header里accept字段接收类型
// 如果是 text/html 则响应一段js,这里要将response对象的响应内容类型也设置成 text/javascript
// 如果是 application/json 则响应一串json,response 对象的响应内容类型要设置成 application/json
// 因为响应内容描述是中文,所以都要带上 ;charset=utf-8 否则会有乱码
// 写注释真累费劲。。
public static void responseWrite(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!HttpUtil.isApiRequest(request)) {
response.setContentType("text/html;charset=utf-8");
response.getWriter().write("<script>alert('请先登录!');window.history.go(-1);</script>");
} else /*if (accept.contains("application/json"))*/ {
response.setContentType("application/json;charset=utf-8");
Result result = new Result();
result.setCode(201);
result.setDescription("请先登录");
response.getWriter().write(JsonUtil.objectToJson(result));
}
}
}
| [
"[email protected]"
] | |
04cb89a5f39c23c632edec64be3f015d9469934a | b73129ae663d18693c7a220ebb41a3f56b7c2c69 | /code/Ch10/Old/Image/Example2/Example2c.java | bf82a2489abf4ea5c4b6a13d01d9299230bbcfb5 | [] | no_license | cse2016hy/cse2016hy.github.io | eb5f2c09a08a696cf05a2c25e86952123bdbccce | 5617358a457be01dfa666cebea878255cbff3427 | refs/heads/master | 2022-11-29T12:59:43.869584 | 2022-11-28T02:08:38 | 2022-11-28T02:08:38 | 146,400,368 | 9 | 18 | null | null | null | null | UTF-8 | Java | false | false | 201 | java |
/** Example2c starts the application */
public class Example2c
{ public static void main(String[] args)
{ Counterl model = new Counterl(0);
Frame2c view = new Frame2c(model);
}
}
| [
"[email protected]"
] | |
12a157aaf647cdbceacee9ccbb0881eb72788f56 | f9aeff9ad09c6b8d5b94b3550659791e39d40080 | /Itsc1212/src/Post3.java | ca8deeeb7064d5a9c2183d36801e34de125b0df3 | [] | no_license | rameshkoirala210/Java | cdb32759ffdeb3b225f76f943e98ba77ddc45925 | ef3266baa72b4c9f3508dd5159ee05a9311050c9 | refs/heads/master | 2023-03-26T23:31:25.701140 | 2021-03-26T17:30:59 | 2021-03-26T17:30:59 | 254,694,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,461 | java | import java.util.*;
//By Ramesh Koirala
//Verson 1?
//Date: 2/18/2020
//
public class Post3 {
public static void main(String[] args) {
Scanner a = new Scanner(System.in);
System.out.println("ID001");
System.out.println("Would you like to pick a card? Y/N");//ask user quwstion
String card = a.next();//saving it as string
if (card.equals("Y")) {//if user input is Y
int faceValue = (int) ( Math.random() * 13 + 1);//getting random number
int suit = (int) ( Math.random() * 3);//random suit
System.out.print("you got a ");
if(faceValue == 1) {//another if statement
System.out.print("Ace ");
if(suit == 0) {//if statement to get suit
System.out.print("of Hearts");
}else if(suit == 1) {
System.out.print("of Dimonds");
}else if(suit == 2) {
System.out.print("of Clubs");
}else if(suit == 3) {
System.out.print("of Spades");
}
}else if(faceValue > 1 || faceValue < 11) {//if face value is greater then 1 and less then 11
System.out.print(faceValue );
if(suit == 0) {//if statement to get suit
System.out.print(" of Hearts ");
}else if(suit == 1) {
System.out.print(" of Dimonds ");
}else if(suit == 2) {
System.out.print(" of Clubs ");
}else if(suit == 3) {
System.out.print(" of Spades ");
}
}if(faceValue == 11) {//if its 11
System.out.print("Jack ");
if(suit == 0) {//if statement to get suit
System.out.print("of Hearts");
}else if(suit == 1) {
System.out.print("of Dimonds");
}else if(suit == 2) {
System.out.print("of Clubs");
}else if(suit == 3) {
System.out.print("of Spades");
}
}if(faceValue == 12) {//if its 12
System.out.print("Queen ");
if(suit == 0) {//if statement to get suit
System.out.print("of Hearts");
}else if(suit == 1) {
System.out.print("of Dimonds");
}else if(suit == 2) {
System.out.print("of Clubs");
}else if(suit == 3) {
System.out.print("of Spades");
}
}if(faceValue == 13) {//if its 13
System.out.print("King ");
if(suit == 0) {//if statement to get suit
System.out.print("of Hearts");
}else if(suit == 1) {
System.out.print("of Dimonds");
}else if(suit == 2) {
System.out.print("of Clubs");
}else if(suit == 3) {
System.out.print("of Spades");
}
}
}else{
System.out.print("Bye");
}
}
} | [
"[email protected]"
] | |
ccfc596936c432f6e32c7ef55e44ed902b9ed880 | fba8af31d5d36d8a6cf0c341faed98b6cd5ec0cb | /src/main/java/com/alipay/api/response/AlipayEcardEduCardGetResponse.java | d1ce77ac03b8fa5858523b550f4b0ad11a54b52e | [
"Apache-2.0"
] | permissive | planesweep/alipay-sdk-java-all | b60ea1437e3377582bd08c61f942018891ce7762 | 637edbcc5ed137c2b55064521f24b675c3080e37 | refs/heads/master | 2020-12-12T09:23:19.133661 | 2020-01-09T11:04:31 | 2020-01-09T11:04:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.EduOneCardDepositCardQueryResult;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.ecard.edu.card.get response.
*
* @author auto create
* @since 1.0, 2019-03-08 15:29:11
*/
public class AlipayEcardEduCardGetResponse extends AlipayResponse {
private static final long serialVersionUID = 3142436285679687952L;
/**
* 用户是否首次充值标记
*/
@ApiField("first_deposit_flag")
private Boolean firstDepositFlag;
/**
* 校园一卡通历史充值卡信息查询结果对象
*/
@ApiListField("onecard")
@ApiField("edu_one_card_deposit_card_query_result")
private List<EduOneCardDepositCardQueryResult> onecard;
public void setFirstDepositFlag(Boolean firstDepositFlag) {
this.firstDepositFlag = firstDepositFlag;
}
public Boolean getFirstDepositFlag( ) {
return this.firstDepositFlag;
}
public void setOnecard(List<EduOneCardDepositCardQueryResult> onecard) {
this.onecard = onecard;
}
public List<EduOneCardDepositCardQueryResult> getOnecard( ) {
return this.onecard;
}
}
| [
"[email protected]"
] | |
b74baf4098902fb5021fd9fe75494bc58567790b | e578f3bb4a5d8be100c8b6306f379c08a49df11f | /src/main/java/com/ml/gb/serialization/Toy.java | 051911ee2135d0225a75e0af645fc6b69e9ed0d9 | [] | no_license | flamearrow/yo-model | f178c851ac5904ac59f3fd6adc8ece43794fc816 | 5c8949faa97db4b7d96ccfce7e18a9dae432ccea | refs/heads/master | 2016-09-05T20:19:42.798944 | 2014-07-30T03:51:54 | 2014-07-30T03:51:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,401 | java | package com.ml.gb.serialization;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.DatumReader;
import org.apache.avro.io.DatumWriter;
import org.apache.avro.io.DecoderFactory;
import org.apache.avro.io.Encoder;
import org.apache.avro.io.EncoderFactory;
public class Toy {
public static void main(String[] args) throws IOException {
File schemaFile = new File("src/main/avro/user.avsc");
Schema schema = new Schema.Parser().parse(schemaFile);
GenericRecord user1 = new GenericData.Record(schema);
user1.put("name", "mlgb");
user1.put("id", 12345l);
GenericRecord user2 = new GenericData.Record(schema);
user2.put("name", "bglm");
user2.put("id", 54321l);
// Serialize into bytes[]
File dstFile = new File("src/main/avro/user.avro");
DatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<GenericRecord>(
schema);
OutputStream out = new ByteArrayOutputStream();
Encoder encoder = EncoderFactory.get().binaryEncoder(out, null);
datumWriter.write(user1, encoder);
datumWriter.write(user2, encoder);
encoder.flush();
out.close();
// DataFileWriter<GenericRecord> dataFileWriter = new
// DataFileWriter<GenericRecord>(
// datumWriter);
// dataFileWriter.create(schema, dstFile);
// dataFileWriter.append(user1);
// dataFileWriter.append(user2);
// dataFileWriter.close();
// Deserialize
DatumReader<GenericRecord> datumReader = new GenericDatumReader<GenericRecord>(
schema);
BinaryDecoder decoder = DecoderFactory.get().binaryDecoder(
((ByteArrayOutputStream) out).toByteArray(), null);
GenericRecord user = null;
while ((user = datumReader.read(null, decoder)) != null) {
System.out.println(user);
}
// DataFileReader<GenericRecord> dataFileReader = new
// DataFileReader<GenericRecord>(
// dstFile, datumReader);
// GenericRecord user = null;
// while (dataFileReader.hasNext()) {
// user = dataFileReader.next(user);
// System.out.println(user);
// System.out.println(user.get("name"));
// System.out.println(user.get("id"));
// }
}
}
| [
"[email protected]"
] | |
aa79f267578c2e397a84dfc1d1815e1ed7d660b9 | 31b9efd67000b884e0ca81937df7aa2961e5ff4f | /app/src/main/java/ru/kackbip/impactMapping/screens/goals/di/GoalsComponent.java | c4e226f855367733d81cea3a4b4f3652970d36df | [] | no_license | vladimirandroid/ImpactMapping | 6ce0a30b7e1f1d658495fcc17ebde447c6157642 | 0912821bcac716ad56a981bbf359f6508ef20377 | refs/heads/master | 2021-06-09T21:55:05.617414 | 2016-11-25T14:02:36 | 2016-11-25T14:02:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package ru.kackbip.impactMapping.screens.goals.di;
import javax.inject.Singleton;
import dagger.Subcomponent;
import ru.kackbip.impactMapping.application.di.BaseComponent;
import ru.kackbip.impactMapping.screens.goals.view.GoalsView;
/**
* Created by ryashentsev on 18.10.2016.
*/
@Singleton
@Subcomponent(modules = {GoalsModule.class})
public interface GoalsComponent extends BaseComponent<GoalsView>{
}
| [
"[email protected]"
] | |
c611fd898b7bb5b5100c2ea25afd66172c1b495c | c88dcfa9bfeb9dafb83a9c9cd37856fc2e71c6de | /Airplane.java | 7ffd4e7c2ebb9adb3b572b094029b51613c498c0 | [] | no_license | itsKen/BlueJ | a4ef366c9395955b976a8769d489d4f6f3a43a71 | c3aa21999dc73576fa3146ac24b5be546d553f8e | refs/heads/master | 2021-07-07T19:05:42.998030 | 2017-10-01T07:02:38 | 2017-10-01T07:02:38 | 105,425,195 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,193 | java | /**
* Write a description of class Airplane here.
*
** @author (your name)?
* @version (a version number or a date)
*/
import java.util.*;
public class Airplane
{
private final int ROW = 13; //ROW 1 - 12
private final int SECTION = 5; //SEAT A - D
private Seat[][] seats;
private int numberOfSeats = 48;
public Airplane()
{
seats = new Seat[SECTION][ROW];
initializeSeats();
}
/**
* Initializes the seats
*/
public void initializeSeats()
{
for (int j = 1; j < ROW; j++)
{
boolean firstClass = true;
if (j > 4)
firstClass = false;
for (int i = 1; i < SECTION; i++)
{
String section = "E";
boolean windowView = true;
if (i == 1)
section = "A";
else if (i == 2)
{
section = "B";
windowView =false;
}
else if (i == 3)
{
section = "C";
windowView = false;
}
else
section = "D";
Seat temp = new Seat(section,j);
temp.setWindowView(windowView);
//temp.setSeatSection(section);
temp.setSeatClass(firstClass);
seats[i][j] = temp;
}
}
}
/**
* Randomly assigns passengers
* @param p the passnger
*/
public void assignS(Passenger p){
Random a = new Random();
boolean Trust = true;
while(Trust == true){
int section = a.nextInt(SECTION - 1) +1;
int row = a.nextInt(ROW - 1) + 1;
if(seats[section][row].getVacancy() == true){
seats[section][row].setVacancy(false);
seats[section][row].assignPassenger(p);
}
}
}
/**
* checks if the section is a window section
* @param j the section
*/
public boolean windowChecker(String j)
{
if(j.equals("A")||j.equals("D"))
{
return true;
}
return false;
}
/**
* Converts all the sections to numbers
* @param j the sectioin
*/
public int converter(String j){
if(j.equals("A"))
{
return 1;
}
else if (j.equals("B"))
{
return 2;
}
else if(j.equals("C"))
{
return 3;
}
else if(j.equals("D"))
{
return 4;
}
else if(j.equals("E"))
{
return 5;
}
else if(j.equals("F"))
{
return 6;
}
else if(j.equals("G"))
{
return 7;
}
else
{
return 8;
}
}
/**
* Reserves a seat for the passenger
* @param section the section
* @param row the row
* @param bob The passenger
* (Precondition:row >= 0)
*/
public void Reserve(String section, int row, Passenger bob)
{
seats[converter(section)][row].setVacancy(false);
seats[converter(section)][row].setPassenger(bob);
if(section.equalsIgnoreCase("B") || section.equalsIgnoreCase("C"))
{
seats[converter(section)][row].setWindowView(false);
}
}
/**
* Asks the user thier preference of reservation
*/
public void Preference(){
Scanner input = new Scanner(System.in);
System.out.println("To Sit in First Class Press 1");
System.out.println("To Sit in a Window Seat Press 2");
System.out.println("To Sit in Both First Class and a Window Seat Press 3");
int p = input.nextInt();
if(p == 1){
P1();
}
else if(p == 2){
P2();
}
else if (p == 3){
P3();
}
}
/**
* Seats a passenger in the first 4 rows
*/
public void P1(){
Scanner input = new Scanner(System.in);
System.out.println("What row do you want to sit in?" );
int row = Integer.parseInt(input.nextLine());
System.out.println("What section do you want to sit in?");
String section = input.nextLine();
if(checkAvail(section, row) == true && row <= 4)
{
System.out.println("Enter first name: ");
String fName = input.nextLine();
System.out.println("Enter last name: ");
String lName = input.nextLine();
Passenger bob = new Passenger(fName, lName);
Reserve(section, row, bob);
printSeats();
}
else{
System.out.println("Sorry, Not Availible");
DisplayMenu();
}
DisplayMenu();
}
/**
* seats the passenger in a window seat
*/
public void P2(){
Scanner input = new Scanner(System.in);
System.out.println("What row do you want to sit in?" );
int row = Integer.parseInt(input.nextLine());
System.out.println("What section do you want to sit in?");
String section = input.nextLine();
if(checkAvail(section, row) == true && (section.equalsIgnoreCase("A") || section.equalsIgnoreCase("D")))
{
System.out.println("Enter first name: ");
String fName = input.nextLine();
System.out.println("Enter last name: ");
String lName = input.nextLine();
Passenger bob = new Passenger(fName, lName);
Reserve(section, row, bob);
printSeats();
}
else{
System.out.println("Sorry, Not Availible");
DisplayMenu();
}
DisplayMenu();
}
/**
* seats the passenger in a window and firstclass(the first 4 rows) seat
*/
public void P3(){
Scanner input = new Scanner(System.in);
System.out.println("What row do you want to sit in?" );
int row = Integer.parseInt(input.nextLine());
System.out.println("What section do you want to sit in?");
String section = input.nextLine();
if(checkAvail(section, row) == true && (section.equalsIgnoreCase("A") || section.equalsIgnoreCase("D")) && row <= 4)
{
System.out.println("Enter first name: ");
String fName = input.nextLine();
System.out.println("Enter last name: ");
String lName = input.nextLine();
Passenger bob = new Passenger(fName, lName);
Reserve(section, row, bob);
printSeats();
}
else{
System.out.println("Sorry, Not Availible");
DisplayMenu();
}
DisplayMenu();
}
/**
* seats the passenger in a nonpreferential seat
*/
public void NoPref(){
Scanner input = new Scanner(System.in);
System.out.println("What row do you want to sit in?" );
int row = Integer.parseInt(input.nextLine());
System.out.println("What section do you want to sit in?");
String section = input.nextLine();
if(checkAvail(section, row) == true)
{
System.out.println("Enter first name: ");
String fName = input.nextLine();
System.out.println("Enter last name: ");
String lName = input.nextLine();
Passenger bob = new Passenger(fName, lName);
Reserve(section, row, bob);
printSeats();
}
else{
System.out.println("Sorry, that seat is already taken. ");
DisplayMenu();
}
DisplayMenu();
}
/**
* randomly fills up the seats
* @param numberOfSeats the number of seats
* (Precondition: numberOfSeats <= 0)
*/
public void randomFill(int numberOfSeats)
{
Scanner input = new Scanner (System.in);
Random generator = new Random();
int counter = 0;
String first = "Unknown";
String last = "Assilant";
Passenger p = new Passenger(first,last);
while (counter < numberOfSeats)
{
int section = generator.nextInt(4) + 1;
int row = generator.nextInt(12) + 1;
if (seats[section][row].getVacancy() == true)
{
seats[section][row].setVacancy(false);
seats[section][row].assignPassenger(p);
counter++;
}
}
}
/**
* checks the vacacncy of the seats
* @param section the section
* @param row the row
* (Precondition: row <= 0)
*/
public boolean checkAvail(String section, int row)
{
return (seats[converter(section)][row].getVacancy());
}
/**
* Prints the seats
*/
public void printSeats()
{
for (int j = 1; j < SECTION; j++)
{
for (int i = 1; i < ROW; i++)
{
if (seats[j][i].getVacancy() == true)
System.out.print("[" + "] ");
else
System.out.print("[X" + "] ");
}
System.out.println();
}
}
/**
* Seats a group of passenger
*/
public void GroupSeat(){
Scanner input = new Scanner(System.in);
System.out.println("The Number of People in the Group: ");
int GroupSize = input.nextInt();
for (int j = 1; j < SECTION; j++)
{
for (int i = 1; i < ROW; i++)
{
if(GS1(i, j, GroupSize) == true){
GS2(j,i,GroupSize);
}
}
}
DisplayMenu();
}
/**
* checks if the group of seats is availible
* (Postcondition: GS1 == true)
* @param groupsize the group size
* @param row the row
* @param section the section
* (Precondition: groupsize >= 0, row >= 0)
*/
public boolean GS1(int groupsize, int row, int section){
int a = row;
int b = section;
while(groupsize >= 0){
if(seats[b][a].getVacancy() == false)
return false;
else{
b++;
groupsize--;
if(b == SECTION){
b = 1;
a++;
}
}
}
return true;
}
/**
* groups the passengers
* @param groupsize the group size
* @param row the row
* @param section the section
* (Precondition: groupsize >=0, row >= 0, section >= 0)
*/
public void GS2(int groupsize, int row, int section){
Scanner input = new Scanner(System.in);
int j = section;
int i = row;
System.out.println("Enter Passenger First Name");
String first = input.nextLine();
System.out.println("Enter Passenger Last Name");
String last = input.nextLine();
while(groupsize > 0){
if(seats[j][i].getVacancy() == true){
Passenger p = new Passenger(first, last);
seats[section][row].setVacancy(false);
seats[section][row].assignPassenger(p);
}
else{
j++;
groupsize--;
if(j == SECTION){
j = 1;
i++;
}
}
}
}
/**
* Prints the passenger names and they have window view, first class, economy class, or aisle
*/
public void PrintPassenger(){
for (int j = 1; j < SECTION; j++)
{
for (int i = 1; i < ROW; i++)
{
if (seats[j][i].getVacancy() == false){
if(seats[j][i].getWindowViewStatus() == true && seats[j][i].getRow() <= 4){
System.out.println("Passenger : "+seats[j][i].getPassenger().getFullName()+"");
System.out.println("Section : "+seats[j][i].getSeatSection()+"");
System.out.println("Row : "+seats[j][i].getRow()+"");
System.out.println("Has Window View and First Class");
System.out.println();
}
else if(seats[j][i].getWindowViewStatus() == false && seats[j][i].getRow() <= 4){
System.out.println("Passenger : "+seats[j][i].getPassenger().getFullName()+"");
System.out.println("Section : "+seats[j][i].getSeatSection()+"");
System.out.println("Row : "+seats[j][i].getRow()+"");
System.out.println("Has Aisle View and First Class");
System.out.println();
}
else if(seats[j][i].getWindowViewStatus() == true && seats[j][i].getRow() > 4){
System.out.println("Passenger : "+seats[j][i].getPassenger().getFullName()+"");
System.out.println("Section : "+seats[j][i].getSeatSection()+"");
System.out.println("Row : "+seats[j][i].getRow()+"");
System.out.println("Has Window View and Economy Class");
System.out.println();
}
else {
System.out.println("Passenger : "+seats[j][i].getPassenger().getFullName()+"");
System.out.println("Section : "+seats[j][i].getSeatSection()+"");
System.out.println("Row : "+seats[j][i].getRow()+"");
System.out.println("Has Aisle view and Economy Class");
System.out.println();
}
}
else{
}
}
}
DisplayMenu();
}
/**
* Asks the User the name of the passenger they will like to remove
*/
public void remove1(){
Scanner input = new Scanner(System.in);
System.out.println("Enter First Name");
String First = input.nextLine();
System.out.println("Enter Last Name");
String Last = input.nextLine();
Passenger a = new Passenger(First, Last);
remove2(a);
DisplayMenu();
}
/**
* Removes the passenger
* @param p the passenger
*/
public void remove2(Passenger p){
for (int j = 1; j < SECTION; j++)
{
for (int i = 1; i < ROW; i++)
{
if (seats[j][i].getVacancy() == false){
if(seats[j][i].getPassenger().getFullName().equalsIgnoreCase(p.getFullName())){
seats[j][i].clearSeat();
return;
}
}
}
}
}
/**
* Display Menu for the User to use
*/
public void DisplayMenu(){
Scanner input = new Scanner(System.in);
System.out.println("Welcome to the Airplane, what would you like to do?");
System.out.println("To Reserve a Seat with no preference, Press 1");
System.out.println("To Reserve a Seat with preference, Press 2");
System.out.println("To Reserve a Group, Press 3");
System.out.println("To Cancel a reservation, Press 4");
System.out.println("To Print the names of all the passengers, Press 5");
System.out.println("To Print out the Seats Press 6");
System.out.println("To Exit out of this Press any key");
int a = input.nextInt();
if(a == 1){
NoPref();
}
else if(a == 2){
Preference();
}
else if(a == 3){
GroupSeat();
}
else if(a == 4){
remove1();
}
else if(a == 5){
PrintPassenger();
}
else if(a == 6){
printSeats();
DisplayMenu();
}
}
/**
* Prints out the seats, display menu, and randomly fill
*/
public static void main(String[] args){
Airplane crash = new Airplane();
crash.randomFill(0);
crash.printSeats();
crash.DisplayMenu();
}
} | [
"[email protected]"
] | |
d476a20fa63d9d29b10a68d205f9ba7c1ff52476 | 824eaf14728fd97ec24b7afb8f4f7c036128a336 | /Dnevnik_back_end/src/main/java/com/iktpreobuka/elektronski_dnevnik_os/services/Razred_SkolskaGodinaDaoImp.java | 653afc8c22e2ebdcc9a46f4c858940d040094ea8 | [] | no_license | petarplecas/Elektronski-dnevnik-za-osnovnu-skolu | 79200e48430686d6b67483193bffc7d24d3852fa | 4e14386953443af72953880bb6eff2adf0088b74 | refs/heads/master | 2020-04-01T13:58:59.622079 | 2018-10-16T12:17:24 | 2018-10-16T12:17:24 | 153,275,348 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | package com.iktpreobuka.elektronski_dnevnik_os.services;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.stereotype.Service;
@Service
public class Razred_SkolskaGodinaDaoImp implements Razred_SkolskaGodinaDao {
@Override
public String toRomanNumerals(Integer Int) {
LinkedHashMap<String, Integer> roman_numerals = new LinkedHashMap<String, Integer>();
roman_numerals.put("V", 5);
roman_numerals.put("IV", 4);
roman_numerals.put("I", 1);
String res = "";
for(Map.Entry<String, Integer> entry : roman_numerals.entrySet()){
Integer matches = Int/entry.getValue();
res += repeat(entry.getKey(), matches);
Int = Int % entry.getValue();
}
return res;
}
public static String repeat(String s, int n) {
if(s == null) {
return null;
}
final StringBuilder sb = new StringBuilder();
for(int i = 0; i < n; i++) {
sb.append(s);
}
return sb.toString();
}
}
| [
"[email protected]"
] | |
f9e5296762a92461cb956368151c2a7a5e5a5d15 | b66c867004e73f79b08d90e0347dd2770cff6999 | /src/main/java/utils/MySqlConnection.java | aef91ae3fce6b68cc6f0ce0994b030ad223998e4 | [] | no_license | nhatanhmc/DemoThymeleaf | 3be102e3ea71b62fe8275ce6a1a9a88b75f29453 | e2ad927742f262ce903ce83c781c9083a81c5868 | refs/heads/master | 2020-06-04T21:34:23.676704 | 2019-07-01T18:40:37 | 2019-07-01T18:40:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,605 | java | /*
* 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 utils;
import org.apache.commons.dbcp2.BasicDataSource;
/**
*
* @author Admin
*/
public class MySqlConnection {
public static volatile BasicDataSource ds = null;
public MySqlConnection() {
try {
if (ds == null) {
ds = new BasicDataSource();
ds.setUrl("jdbc:mysql://" + EnvironmentVariable.getDBHost() + ":3306/" + EnvironmentVariable.getDBDatabase() + "?autoReconnect=true&useSSL=false&allowMultiQueries=true");
ds.setUsername(EnvironmentVariable.getDBUser());
ds.setPassword(EnvironmentVariable.getDBPass());
ds.setMaxTotal(150);
ds.setMinIdle(30);
ds.setMaxIdle(70);
ds.setMaxConnLifetimeMillis(3000);
ds.setDriverClassName("com.mysql.cj.jdbc.Driver");
ds.setInitialSize(50);
ds.setRemoveAbandonedOnBorrow(true);
ds.setAbandonedUsageTracking(false);
ds.setLogExpiredConnections(false);
ds.setLifo(false);
ds.addConnectionProperty("useUnicode", "true");
ds.addConnectionProperty("characterEncoding", "UTF-8");
ds.setRemoveAbandonedOnMaintenance(true);
}
} catch (Exception e) {
System.out.println("xxx");
}
}
}
| [
"[email protected]"
] | |
b93282d773b9bd0d361feb238b1f259d1922b248 | 729e0f85568b174a69a69b2238ff7cefaeb8d3e2 | /localprovider/src/main/java/com/sh3h/localprovider/greendaoEntity/Violation.java | af6e0c0c8b8b891738438bff03a2d105ee81b769 | [] | no_license | michael-dzm/IndemnityCenter | 6b3a4c473d5617fd9743ae7252e166d865725912 | 8c550dde654f3d9d7df382d08a2da17231e6eb8b | refs/heads/master | 2020-03-17T13:03:16.763672 | 2018-05-16T05:38:00 | 2018-05-16T05:38:00 | 133,614,945 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,226 | java | package com.sh3h.localprovider.greendaoEntity;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Generated;
/**
* 违规配置信息表
* Created by dengzhimin on 2017/3/28.
*/
@Entity(nameInDb = "BZ_VIOLATION")
public class Violation {
@Id(autoincrement = true)
@Property(nameInDb = "VIOLATION_ID")
private Long VIOLATION_ID;//违规ID
@Property(nameInDb = "VIOLATION_NUMBER")
private Long VIOLATION_NUMBER;//违规编号
@Property(nameInDb = "VIOLATION_TYPE")
private String VIOLATION_TYPE;//违规类型
@Property(nameInDb = "VIOLATION_CONTENT")
private String VIOLATION_CONTENT;//违规内容
private String REMARK;//备注
@Generated(hash = 1729234783)
public Violation(Long VIOLATION_ID, Long VIOLATION_NUMBER,
String VIOLATION_TYPE, String VIOLATION_CONTENT, String REMARK) {
this.VIOLATION_ID = VIOLATION_ID;
this.VIOLATION_NUMBER = VIOLATION_NUMBER;
this.VIOLATION_TYPE = VIOLATION_TYPE;
this.VIOLATION_CONTENT = VIOLATION_CONTENT;
this.REMARK = REMARK;
}
@Generated(hash = 1789693990)
public Violation() {
}
public Long getVIOLATION_ID() {
return this.VIOLATION_ID;
}
public void setVIOLATION_ID(Long VIOLATION_ID) {
this.VIOLATION_ID = VIOLATION_ID;
}
public Long getVIOLATION_NUMBER() {
return this.VIOLATION_NUMBER;
}
public void setVIOLATION_NUMBER(Long VIOLATION_NUMBER) {
this.VIOLATION_NUMBER = VIOLATION_NUMBER;
}
public String getVIOLATION_TYPE() {
return this.VIOLATION_TYPE;
}
public void setVIOLATION_TYPE(String VIOLATION_TYPE) {
this.VIOLATION_TYPE = VIOLATION_TYPE;
}
public String getVIOLATION_CONTENT() {
return this.VIOLATION_CONTENT;
}
public void setVIOLATION_CONTENT(String VIOLATION_CONTENT) {
this.VIOLATION_CONTENT = VIOLATION_CONTENT;
}
public String getREMARK() {
return this.REMARK;
}
public void setREMARK(String REMARK) {
this.REMARK = REMARK;
}
}
| [
"[email protected]"
] | |
4d5c276638063462e2abce0eb18ea6f3a91b7de1 | cb5310ae9cb5a81c191a3e2f358b94f463b2fa6b | /cocoatouch/src/main/java/org/robovm/apple/uikit/UISplitViewControllerDelegateAdapter.java | 1eac073bd790d09bacda8ac028b0e019ad83d801 | [
"Apache-2.0"
] | permissive | jiangwh/robovm | a3da6d97083eab70ddeb4942d5bafa82d231aec2 | a58b3a1928a60ea132b41cd0e51fae5550e224f5 | refs/heads/master | 2020-12-25T04:47:23.403516 | 2014-07-17T00:35:34 | 2014-07-17T00:35:34 | 21,945,788 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,428 | java | /*
* Copyright (C) 2014 Trillian Mobile AB
*
* 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 org.robovm.apple.uikit;
/*<imports>*/
import java.io.*;
import java.nio.*;
import java.util.*;
import org.robovm.objc.*;
import org.robovm.objc.annotation.*;
import org.robovm.objc.block.*;
import org.robovm.rt.*;
import org.robovm.rt.bro.*;
import org.robovm.rt.bro.annotation.*;
import org.robovm.rt.bro.ptr.*;
import org.robovm.apple.foundation.*;
import org.robovm.apple.coreanimation.*;
import org.robovm.apple.coregraphics.*;
import org.robovm.apple.coredata.*;
import org.robovm.apple.coreimage.*;
/*</imports>*/
/*<javadoc>*/
/*</javadoc>*/
/*<annotations>*//*</annotations>*/
/*<visibility>*/public/*</visibility>*/ class /*<name>*/UISplitViewControllerDelegateAdapter/*</name>*/
extends /*<extends>*/NSObject/*</extends>*/
/*<implements>*/implements UISplitViewControllerDelegate/*</implements>*/ {
/*<ptr>*/
/*</ptr>*/
/*<bind>*/
/*</bind>*/
/*<constants>*//*</constants>*/
/*<constructors>*//*</constructors>*/
/*<properties>*/
/*</properties>*/
/*<members>*//*</members>*/
/*<methods>*/
@NotImplemented("splitViewController:willHideViewController:withBarButtonItem:forPopoverController:")
public void willHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc) { throw new UnsupportedOperationException(); }
@NotImplemented("splitViewController:willShowViewController:invalidatingBarButtonItem:")
public void willShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem) { throw new UnsupportedOperationException(); }
@NotImplemented("splitViewController:popoverController:willPresentViewController:")
public void willPresentViewController(UISplitViewController svc, UIPopoverController pc, UIViewController aViewController) { throw new UnsupportedOperationException(); }
/**
* @since Available in iOS 5.0 and later.
*/
@NotImplemented("splitViewController:shouldHideViewController:inOrientation:")
public boolean shouldHideViewController(UISplitViewController svc, UIViewController vc, UIInterfaceOrientation orientation) { throw new UnsupportedOperationException(); }
/**
* @since Available in iOS 7.0 and later.
*/
@NotImplemented("splitViewControllerSupportedInterfaceOrientations:")
public @MachineSizedUInt long getSupportedInterfaceOrientations(UISplitViewController splitViewController) { throw new UnsupportedOperationException(); }
/**
* @since Available in iOS 7.0 and later.
*/
@NotImplemented("splitViewControllerPreferredInterfaceOrientationForPresentation:")
public UIInterfaceOrientation name(UISplitViewController splitViewController) { throw new UnsupportedOperationException(); }
/*</methods>*/
}
| [
"[email protected]"
] | |
68b7cdaa3275e67060905160e5e7427340a67ca0 | cc2f2b90d0fda949f5c80d15adb0db68e37f9ee3 | /src/punjabroadways/update_employee.java | 72e2d244c69a6ef2c49414a33b8461876b7f0a2b | [] | no_license | SachinMehta-PB/PunjabRoadwaysTicketBooking | 300818f8d9378a312c2694674e734cc10ca30732 | 23bd1c16e7ad13014be229bc43d78de22a7ce4de | refs/heads/main | 2023-06-27T08:03:45.677577 | 2021-07-30T16:56:24 | 2021-07-30T16:56:24 | 391,135,415 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,894 | java | /*
* 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 punjabroadways;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
/**
*
* @author Sachin Mehta
*/
public class update_employee extends javax.swing.JInternalFrame {
/**
* Creates new form update_employee
*/
String name1, fname1, age1, date1, address1, phone1, emailid1, education1, job1, aadhar1, govtid1, gender1;
public update_employee() {
initComponents();
jLabel4.setVisible(false);
jLabel5.setVisible(false);
jLabel6.setVisible(false);
jLabel7.setVisible(false);
jLabel8.setVisible(false);
jLabel9.setVisible(false);
jLabel10.setVisible(false);
jLabel11.setVisible(false);
jLabel12.setVisible(false);
jLabel13.setVisible(false);
jLabel14.setVisible(false);
jLabel15.setVisible(false);
jPanel3.setVisible(false);
jButton3.setVisible(false);
jRadioButton1.setVisible(false);
jRadioButton2.setVisible(false);
jComboBox1.setVisible(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jTextField88 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jTextField7 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
jTextField8 = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
jTextField9 = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
jTextField10 = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jLabel14 = new javax.swing.JLabel();
jTextField12 = new javax.swing.JTextField();
jLabel15 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jComboBox1 = new javax.swing.JComboBox<>();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
setClosable(true);
setIconifiable(true);
setTitle("Punjab Roadways Jalandhar - 2 Update Employees Details");
jPanel1.setBackground(new java.awt.Color(117, 0, 0));
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 0), 2));
jLabel1.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 65)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 0));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Update Employee Details");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 610, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(491, 491, 491))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
);
jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel2.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 36)); // NOI18N
jLabel2.setText("Govt. Id");
jTextField88.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jButton1.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 46)); // NOI18N
jButton1.setText("Search");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 46)); // NOI18N
jButton2.setText("Cancel");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jTextField88, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(33, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE)
.addComponent(jTextField88))
.addGap(96, 96, 96)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(52, Short.MAX_VALUE))
);
jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel4.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel4.setText("Name");
jTextField2.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel5.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel5.setText("Age");
jTextField3.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel6.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel6.setText("Address");
jTextField4.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel7.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel7.setText("Email ID");
jTextField5.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel8.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel8.setText("Designation");
jLabel9.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel9.setText("Govt. ID");
jTextField7.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel10.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel10.setText("Father's Name");
jTextField8.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel11.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel11.setText("Date of Birth");
jTextField9.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel12.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel12.setText("Phone");
jTextField10.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel13.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel13.setText("Education");
jTextField11.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel14.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel14.setText("Aadhar No.");
jTextField12.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jLabel15.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0, 30)); // NOI18N
jLabel15.setText("Gender");
jButton3.setFont(new java.awt.Font("Tw Cen MT Condensed", 1, 46)); // NOI18N
jButton3.setText("Update");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jComboBox1.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
buttonGroup1.add(jRadioButton1);
jRadioButton1.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jRadioButton1.setText("Male");
buttonGroup1.add(jRadioButton2);
jRadioButton2.setFont(new java.awt.Font("Tw Cen MT", 0, 21)); // NOI18N
jRadioButton2.setText("Female");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(37, 37, 37)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE)
.addComponent(jTextField3)
.addComponent(jTextField4)
.addComponent(jTextField5)
.addComponent(jTextField7)
.addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(54, 54, 54)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField9)
.addComponent(jTextField10)
.addComponent(jTextField11)
.addComponent(jTextField12)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jRadioButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jRadioButton2)
.addGap(11, 11, 11)))
.addGap(28, 28, 28))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 194, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(377, 377, 377))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(56, 56, 56)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
.addComponent(jRadioButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jRadioButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 55, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(37, 37, 37))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(57, 57, 57)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(25, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(161, 161, 161)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 51, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
try
{
Myconnection obj1 = new Myconnection();
String id1 = jTextField88.getText();
String str = "select * from employee where govtid = '"+id1+"'";
ResultSet rs = obj1.s.executeQuery(str);
int i=0;
while(rs.next())
{
name1 = rs.getString("name");
fname1 = rs.getString("fathername");
age1 = rs.getString("age");
date1 = rs.getString("date");
address1 = rs.getString("address");
phone1 = rs.getString("phone");
emailid1 = rs.getString("emailid");
education1 = rs.getString("education");
job1 = rs.getString("job");
aadhar1 = rs.getString("aadhar");
govtid1 = rs.getString("govtid");
gender1 = rs.getString("gender");
i=1;
jLabel4.setVisible(true);
jLabel5.setVisible(true);
jLabel6.setVisible(true);
jLabel7.setVisible(true);
jLabel8.setVisible(true);
jLabel9.setVisible(true);
jLabel10.setVisible(true);
jLabel11.setVisible(true);
jLabel12.setVisible(true);
jLabel13.setVisible(true);
jLabel14.setVisible(true);
jLabel15.setVisible(true);
jPanel3.setVisible(true);
jButton3.setVisible(true);
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jComboBox1.setVisible(true);
}
if(i==0)
{
JOptionPane.showMessageDialog(null, "Employee Not Available");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error Occurred in Query.");
//System.out.println("Error Occurred in Query due to : "+e);
}
jTextField2.setText(name1);
jTextField8.setText(fname1);
jTextField3.setText(age1);
jTextField9.setText(date1);
jTextField4.setText(address1);
jTextField10.setText(phone1);
jTextField5.setText(emailid1);
jTextField11.setText(education1);
jComboBox1.addItem(job1);
if(job1.equals("General Manager"))
{
jComboBox1.addItem("Traffic Manager");
jComboBox1.addItem("Inspector");
jComboBox1.addItem("Sub-Inspector");
jComboBox1.addItem("Clerks");
jComboBox1.addItem("Conductor");
jComboBox1.addItem("Mechanic");
}
else if(job1.equals("Traffic Manager"))
{
jComboBox1.addItem("General Manager");
jComboBox1.addItem("Inspector");
jComboBox1.addItem("Sub-Inspector");
jComboBox1.addItem("Clerks");
jComboBox1.addItem("Conductor");
jComboBox1.addItem("Mechanic");
}
else if(job1.equals("Inspector"))
{
jComboBox1.addItem("General Manager");
jComboBox1.addItem("Traffic Manager");
jComboBox1.addItem("Sub-Inspector");
jComboBox1.addItem("Clerks");
jComboBox1.addItem("Conductor");
jComboBox1.addItem("Mechanic");
}
else if(job1.equals("Sub-Inspector"))
{
jComboBox1.addItem("General Manager");
jComboBox1.addItem("Traffic Manager");
jComboBox1.addItem("Inspector");
jComboBox1.addItem("Clerks");
jComboBox1.addItem("Conductor");
jComboBox1.addItem("Mechanic");
}
else if(job1.equals("Clerks"))
{
jComboBox1.addItem("General Manager");
jComboBox1.addItem("Traffic Manager");
jComboBox1.addItem("Inspector");
jComboBox1.addItem("Sub-Inspector");
jComboBox1.addItem("Conductor");
jComboBox1.addItem("Mechanic");
}
else if(job1.equals("Conductor"))
{
jComboBox1.addItem("General Manager");
jComboBox1.addItem("Traffic Manager");
jComboBox1.addItem("Inspector");
jComboBox1.addItem("Sub-Inspector");
jComboBox1.addItem("Clerks");
jComboBox1.addItem("Mechanic");
}
else if(job1.equals("Mechanic"))
{
jComboBox1.addItem("General Manager");
jComboBox1.addItem("Traffic Manager");
jComboBox1.addItem("Inspector");
jComboBox1.addItem("Sub-Inspector");
jComboBox1.addItem("Clerks");
jComboBox1.addItem("Conductor");
}
jTextField12.setText(aadhar1);
jTextField7.setText(govtid1);
if(gender1.equals("Male"))
{
jRadioButton1.setSelected(true);
jRadioButton2.setSelected(false);
}
else
{
jRadioButton1.setSelected(false);
jRadioButton2.setSelected(true);
}
// jLabel9.setText(name1);
// jLabel21.setText(fname1);
// jLabel10.setText(age1);
// jLabel22.setText(date1);
// jLabel11.setText(address1);
// jLabel23.setText(phone1);
// jLabel12.setText(emailid1);
// jLabel24.setText(education1);
// jLabel13.setText(job1);
// jLabel25.setText(aadhar1);
// jLabel14.setText(govtid1);
// jLabel26.setText(gender1);
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
String jj = jTextField88.getText();
String i1=(String) jComboBox1.getSelectedItem();
String l1;
if(jRadioButton1.isSelected())
{
l1 = "Male";
}
else
{
l1= "Female";
}
try
{
Myconnection obj = new Myconnection();
String query = "update employee set name='"+jTextField2.getText()+"', fathername='"+jTextField8.getText()+"', age='"+jTextField3.getText()+"', date='"+jTextField9.getText()+"', address='"+jTextField4.getText()+"', phone='"+jTextField10.getText()+"', emailid='"+jTextField5.getText()+"', education='"+jTextField11.getText()+"', job='"+i1+"', aadhar='"+jTextField12.getText()+"', gender='"+l1+"' where govtid='"+jj+"'";
obj.s.executeUpdate(query);
JOptionPane.showMessageDialog(null, "Details Updated Successfully");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Error Occurred in Query.");
//System.out.println("Error Occurred in Query due to : "+e);
}
jComboBox1.removeAllItems();
jLabel4.setVisible(false);
jLabel5.setVisible(false);
jLabel6.setVisible(false);
jLabel7.setVisible(false);
jLabel8.setVisible(false);
jLabel9.setVisible(false);
jLabel10.setVisible(false);
jLabel11.setVisible(false);
jLabel12.setVisible(false);
jLabel13.setVisible(false);
jLabel14.setVisible(false);
jLabel15.setVisible(false);
jPanel3.setVisible(false);
jButton3.setVisible(false);
jRadioButton1.setVisible(false);
jRadioButton2.setVisible(false);
jComboBox1.setVisible(false);
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
jComboBox1.removeAllItems();
jTextField88.setText("");
jLabel4.setVisible(false);
jLabel5.setVisible(false);
jLabel6.setVisible(false);
jLabel7.setVisible(false);
jLabel8.setVisible(false);
jLabel9.setVisible(false);
jLabel10.setVisible(false);
jLabel11.setVisible(false);
jLabel12.setVisible(false);
jLabel13.setVisible(false);
jLabel14.setVisible(false);
jLabel15.setVisible(false);
jPanel3.setVisible(false);
jButton3.setVisible(false);
jRadioButton1.setVisible(false);
jRadioButton2.setVisible(false);
jComboBox1.setVisible(false);
}//GEN-LAST:event_jButton2ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JTextField jTextField10;
private javax.swing.JTextField jTextField11;
private javax.swing.JTextField jTextField12;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField7;
private javax.swing.JTextField jTextField8;
private javax.swing.JTextField jTextField88;
private javax.swing.JTextField jTextField9;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
ff31a0f2e577b937d0fd1601c9bbbefdbeff8b3d | afc8faa3409f4cf3c470db167f3f180f2279249f | /src/main/java/com/finastra/cpq/finastraCPQ/deserializedjsonresponseobjects/commondeserializedobjects/SFObjectResponseAttributes.java | c56543da1c2184b8a33efe1f49e99703828377d2 | [] | no_license | mssachin/fincpq | db4036df95c058780890a34212660516977d9c21 | 5580cdb8a307c770d1f04592b43ee620aae7a9c1 | refs/heads/master | 2020-04-12T10:30:59.692648 | 2018-12-19T12:07:56 | 2018-12-19T12:07:56 | 162,431,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package com.finastra.cpq.finastraCPQ.deserializedjsonresponseobjects.commondeserializedobjects;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
public class SFObjectResponseAttributes {
@Getter(AccessLevel.PUBLIC)
@Setter(AccessLevel.PUBLIC)
String type;
@Getter(AccessLevel.PUBLIC)
@Setter(AccessLevel.PUBLIC)
String url;
}
| [
"[email protected]"
] | |
8eeb1ebad6e6f9649a00a4fc7f0e286d0d2ba853 | 29c749118a2bf2925451c72f1750ff1f2e245301 | /test/GameTest.java | 3620e2229a3e325f9a81440ef09f4fa421b77a06 | [] | no_license | fletterman/practica | 22db32867e6eeec4137854a6cb47e13b074d8e9d | 96b6e75287c4e0577e764fb3ea7d803ae3fd0d65 | refs/heads/main | 2023-03-31T23:36:46.601465 | 2021-04-07T21:50:23 | 2021-04-07T21:50:23 | 334,987,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,593 | java | import practicum_6A.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.time.LocalDate;
import static org.junit.jupiter.api.Assertions.*;
class GameTest {
private Game game1JrOud;
private int ditJaar;
@BeforeEach
public void init(){
ditJaar = LocalDate.now().getYear();
game1JrOud = new Game("Mario Kart", ditJaar-1, 50.0);
}
//region Tests met huidigeWaarde()
@Test
public void testHuidigeWaardeNwPrijsNa0Jr(){
Game game0JrOud = new Game("Mario Kart", ditJaar, 50.0);
assertEquals(50.0, Math.round(game0JrOud.huidigeWaarde() * 100)/100d, "Huidige waarde na 0 jr niet correct.");
}
@Test
public void testHuidigeWaardeNwPrijsNa1Jr(){
assertEquals(35.0, Math.round(game1JrOud.huidigeWaarde() * 100)/100d, "Huidige waarde na 1 jr niet correct.");
}
@Test
public void testHuidigeWaardeNwPrijsNa5Jr(){
Game game5JrOud = new Game("Mario Kart", ditJaar-5, 50.0);
assertEquals(8.4, Math.round(game5JrOud.huidigeWaarde() * 100)/100d, "Huidige waarde na 5 jr niet correct.");
}
@Test
public void testHuidigeWaardeGratisGameNa0Jr(){
Game gratisGame0JrOud = new Game("Mario Kart Free", ditJaar, 0.0);
assertEquals(0.0, Math.round(gratisGame0JrOud.huidigeWaarde() * 100)/100d, "Huidige waarde gratis game na 0 jr niet correct.");
}
@Test
public void testHuidigeWaardeGratisGameNa5Jr(){
Game gratisGame5JrOud = new Game("Mario Kart Free", ditJaar-5, 0.0);
assertEquals(0.0, Math.round(gratisGame5JrOud.huidigeWaarde() * 100)/100d, "Huidige waarde gratis game na 5 jr niet correct.");
}
//endregion
//region Tests met equals()
@Test
public void testGameEqualsZelfdeGame() {
Game zelfdeGame1JrOud = new Game("Mario Kart", ditJaar-1, 50.0);
assertTrue(game1JrOud.equals(zelfdeGame1JrOud), "equals() geeft false bij vgl. met zelfde game");
}
@Test
public void testGameEqualsSelf() {
assertTrue(game1JrOud.equals(game1JrOud), "equals() geeft false bij vgl. met zichzelf");
}
@Test
public void testGameNotEqualsString() {
assertFalse(game1JrOud.equals("testString"), "equals() geeft true bij vgl. tussen game en String");
}
@Test
public void testGameNotEqualsGameAndereNaam() {
Game otherGame1JrOud = new Game("Zelda", ditJaar-1, 35.0);
assertFalse(game1JrOud.equals(otherGame1JrOud), "equals() geeft true bij vgl. met game met andere naam");
}
@Test
public void testGameNotEqualsGameAnderJaar() {
Game game5JrOud = new Game("Mario Kart", ditJaar-5, 50.0);
assertFalse(game1JrOud.equals(game5JrOud), "equals() geeft true bij vgl. met game met ander releaseJaar");
}
@Test
public void testGameEqualsGameAndereNwPrijs() {
Game duurdereGame1JrOud = new Game("Mario Kart", ditJaar-1, 59.95);
assertTrue(game1JrOud.equals(duurdereGame1JrOud), "equals() geeft false bij vgl. met zelfde game met andere nieuwprijs");
}
@Test
public void testGameNotEqualsGameHeelAndereGame() {
Game heelAndereGame = new Game("Zelda", ditJaar-2, 41.95);
assertFalse(game1JrOud.equals(heelAndereGame), "equals() geeft true bij vgl. met heel andere game");
}
//endregion
@Test
public void testToString(){
assertEquals("Mario Kart, uitgegeven in " + (ditJaar-1) + "; nieuwprijs: €50,00 nu voor: €35,00",
game1JrOud.toString(), "toString() geeft niet de juiste tekst terug.");
}
} | [
"[email protected]"
] | |
ed8c204d7265134e0abebcefc6b7f530c79e78dd | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/23/23_1c40b22f43dc7557f032d24e21f2b5b496d197cb/Processor/23_1c40b22f43dc7557f032d24e21f2b5b496d197cb_Processor_t.java | 1887847b67ddbabe85a45a675c6082f3155476c0 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 263,362 | java | /*
Processor.java
Michael Black, 6/10
Simulates the x86 processor
*/
package simulator;
import java.util.ArrayList;
import java.util.Scanner;
public class Processor
{
public ProcessorGUICode processorGUICode;
private int instructionCount=0;
private Computer computer;
//registers
public Register eax, ebx, edx, ecx, esi, edi, esp, ebp, eip;
public Register cr0, cr2, cr3, cr4;
public Segment cs, ds, ss, es, fs, gs;
public Segment idtr, gdtr, ldtr, tss;
//flags
public Flag carry, parity, auxiliaryCarry, zero, sign, trap, interruptEnable, direction, overflow, interruptEnableSoon, ioPrivilegeLevel1, ioPrivilegeLevel0, nestedTask, alignmentCheck, idFlag;
//protection level
public int current_privilege_level;
public int interruptFlags;
//devices
public IOPorts ioports;
public InterruptController interruptController;
private boolean addressDecoded=false;
private boolean haltMode=false;
public int lastInterrupt=-1;
public LinearMemory linearMemory;
public Processor(Computer computer)
{
this.computer=computer;
this.ioports=computer.ioports;
interruptController=null;
processorGUICode=null;
linearMemory=new LinearMemory(computer);
cs=new Segment(Segment.CS,computer.physicalMemory);
ds=new Segment(Segment.DS,computer.physicalMemory);
ss=new Segment(Segment.SS,computer.physicalMemory);
es=new Segment(Segment.ES,computer.physicalMemory);
fs=new Segment(Segment.FS,computer.physicalMemory);
gs=new Segment(Segment.GS,computer.physicalMemory);
idtr=new Segment(Segment.IDTR,computer.physicalMemory);
// idtr=new Segment(Segment.IDTR,linearMemory);
idtr.setDescriptorValue(0);
gdtr=new Segment(Segment.GDTR,computer.physicalMemory);
// gdtr=new Segment(Segment.GDTR,linearMemory);
gdtr.setDescriptorValue(0);
ldtr=new Segment(Segment.LDTR,linearMemory);
ldtr.setDescriptorValue(0);
tss=new Segment(Segment.TSS,linearMemory);
tss.setDescriptorValue(0);
eax=new Register(Register.EAX,0);
ebx=new Register(Register.EBX,0);
ecx=new Register(Register.ECX,0);
edx=new Register(Register.EDX,0);
esp=new Register(Register.ESP,0);
ebp=new Register(Register.EBP,0);
esi=new Register(Register.ESI,0);
edi=new Register(Register.EDI,0);
eip=new Register(Register.EIP,0x0000fff0);
cr0=new Register(Register.CR0,0);
cr2=new Register(Register.CR2,0);
cr3=new Register(Register.CR3,0);
cr4=new Register(Register.CR4,0);
carry=new Flag(Flag.CARRY);
parity=new Flag(Flag.PARITY);
auxiliaryCarry=new Flag(Flag.AUXILIARYCARRY);
zero=new Flag(Flag.ZERO);
sign=new Flag(Flag.SIGN);
trap=new Flag(Flag.OTHER);
interruptEnable=new Flag(Flag.OTHER);
direction=new Flag(Flag.OTHER);
overflow=new Flag(Flag.OVERFLOW);
interruptEnableSoon=new Flag(Flag.OTHER);
ioPrivilegeLevel1=new Flag(Flag.OTHER);
ioPrivilegeLevel0=new Flag(Flag.OTHER);
nestedTask=new Flag(Flag.OTHER);
alignmentCheck=new Flag(Flag.OTHER);
idFlag=new Flag(Flag.OTHER);
setCPL(0);
// current_privilege_level=0;
fetchQueue=new FetchQueue();
initializeDecoder();
reset();
}
public String saveState()
{
String state="";
state+=cs.saveState()+":";
state+=ss.saveState()+":";
state+=ds.saveState()+":";
state+=es.saveState()+":";
state+=fs.saveState()+":";
state+=gs.saveState()+":";
state+=idtr.saveState()+":";
state+=gdtr.saveState()+":";
state+=ldtr.saveState()+":";
state+=tss.saveState()+":";
state+=eax.saveState()+":";
state+=ebx.saveState()+":";
state+=ecx.saveState()+":";
state+=edx.saveState()+":";
state+=esp.saveState()+":";
state+=ebp.saveState()+":";
state+=esi.saveState()+":";
state+=edi.saveState()+":";
state+=eip.saveState()+":";
state+=cr0.saveState()+":";
state+=cr2.saveState()+":";
state+=cr3.saveState()+":";
state+=cr4.saveState()+":";
state+=carry.saveState()+":";
state+=parity.saveState()+":";
state+=auxiliaryCarry.saveState()+":";
state+=zero.saveState()+":";
state+=sign.saveState()+":";
state+=trap.saveState()+":";
state+=interruptEnable.saveState()+":";
state+=direction.saveState()+":";
state+=overflow.saveState()+":";
state+=interruptEnableSoon.saveState()+":";
state+=ioPrivilegeLevel1.saveState()+":";
state+=ioPrivilegeLevel0.saveState()+":";
state+=nestedTask.saveState()+":";
state+=alignmentCheck.saveState()+":";
state+=idFlag.saveState()+":";
state+=interruptFlags;
return state;
}
public void loadState(String state)
{
String[] states=state.split(":");
cs.loadState(states[0]); ss.loadState(states[1]); ds.loadState(states[2]); es.loadState(states[3]); fs.loadState(states[4]); gs.loadState(states[5]); idtr.loadState(states[6]); gdtr.loadState(states[7]); ldtr.loadState(states[8]); tss.loadState(states[9]);
eax.loadState(states[10]); ebx.loadState(states[11]); ecx.loadState(states[12]); edx.loadState(states[13]); esp.loadState(states[14]); ebp.loadState(states[15]); esi.loadState(states[16]); edi.loadState(states[17]); eip.loadState(states[18]); cr0.loadState(states[19]); cr2.loadState(states[20]); cr3.loadState(states[21]); cr4.loadState(states[22]);
carry.loadState(states[23]); parity.loadState(states[24]); auxiliaryCarry.loadState(states[25]); zero.loadState(states[26]); sign.loadState(states[27]); trap.loadState(states[28]); interruptEnable.loadState(states[29]); direction.loadState(states[30]); overflow.loadState(states[31]); interruptEnableSoon.loadState(states[32]); ioPrivilegeLevel1.loadState(states[33]); ioPrivilegeLevel0.loadState(states[34]); nestedTask.loadState(states[35]); alignmentCheck.loadState(states[36]); idFlag.loadState(states[37]);
interruptFlags=new Scanner(states[38]).nextInt();
}
public void reset()
{
linearMemory=new LinearMemory(computer);
eax.setValue(0);
ebx.setValue(0);
ecx.setValue(0);
edx.setValue(0);
esp.setValue(0);
ebp.setValue(0);
esi.setValue(0);
edi.setValue(0);
eip.setValue(0x0000fff0);
carry.clear();
parity.clear();
auxiliaryCarry.clear();
zero.clear();
sign.clear();
trap.clear();
interruptEnable.clear();
direction.clear();
overflow.clear();
interruptEnableSoon.clear();
ioPrivilegeLevel1.clear();
ioPrivilegeLevel0.clear();
nestedTask.clear();
interruptFlags=0;
cs.setValue(0xf000);
ds.setValue(0);
ss.setValue(0);
es.setValue(0);
fs.setValue(0);
gs.setValue(0);
parity.set();
zero.set();
setCR0(0x60000010);
setCR2(0);
setCR3(0);
setCR4(0);
/* cr0.setValue(0x60000010);
cr2.setValue(0);
cr3.setValue(0);
cr4.setValue(0);*/
haltMode=false;
}
public void setInterruptController(InterruptController interruptController)
{
this.interruptController=interruptController;
}
//executes a single instruction
public void executeAnInstruction()
{
processorGUICode=null;
// if (computer.processorGUI!=null || computer.memoryGUI!=null || computer.registerGUI!=null)
// {
if (computer.debugMode || computer.updateGUIOnPlay || computer.trace!=null)
processorGUICode=new ProcessorGUICode();
// }
if (haltMode)
{
if (processorGUICode!=null) processorGUICode.push(GUICODE.EXECUTE_HALT);
try{Thread.sleep(10);}catch(InterruptedException e){}
return;
}
if(processorGUICode!=null) processorGUICode.pushFetch(eip.getValue());
fetchQueue.fetch();
decodeInstruction(cs.getDefaultSize());
executeInstruction();
if(processorGUICode!=null)
{
if (computer.trace!=null) computer.trace.addProcessorCode(processorGUICode);
processorGUICode.updateMemoryGUI();
processorGUICode.updateGUI();
}
}
public void printRegisters()
{
// System.out.printf("IP: %x, AX: %x, BX: %x, CX: %x, DX: %x, SI: %x, DI: %x, SP: %x, BP: %x, CS: %x, CSbase: %x, SS: %x, DS: %x, ES: %x, FLAGS: %x\n",eip.getValue(),eax.getValue(),ebx.getValue(),ecx.getValue(),edx.getValue(),esi.getValue(),edi.getValue(),esp.getValue(),ebp.getValue(),cs.getValue(),cs.getBase(),ss.getValue(),ds.getValue(),es.getValue(),getFlags());
System.out.printf("IP: %x\n",eip.getValue());
System.out.printf("@ AX: %x, BX: %x, CX: %x, DX: %x, SI: %x, DI: %x, SP: %x, BP: %x, CS: %x, SS: %x, DS: %x, ES: %x\n",eax.getValue(),ebx.getValue(),ecx.getValue(),edx.getValue(),esi.getValue(),edi.getValue(),esp.getValue(),ebp.getValue(),cs.getValue(),ss.getValue(),ds.getValue(),es.getValue());
}
public void printMicrocode(int[] code)
{
System.out.print("Microcode: ");
for(int i=0; i<code.length; i++)
System.out.printf("%x ",code[i]);
System.out.println();
}
public void setCR0(int value)
{
value|=0x10;
if (value==cr0.getValue()) return;
int changedBits=cr0.getValue()^value;
cr0.setValue(value);
if (isModeReal())
{
setCPL(0);
cs.memory=computer.physicalMemory;
ss.memory=computer.physicalMemory;
ds.memory=computer.physicalMemory;
es.memory=computer.physicalMemory;
fs.memory=computer.physicalMemory;
gs.memory=computer.physicalMemory;
// current_privilege_level=0;
if(processorGUICode!=null) processorGUICode.push(GUICODE.MODE_REAL);
// System.out.println("Switching to Real Mode");
// System.out.printf("New segment bases: CS: %x, SS: %x, DS: %x, ES: %x, FS: %x, GS: %x\n",cs.getBase(),ss.getBase(),ds.getBase(),es.getBase(),fs.getBase(),gs.getBase());
}
else
{
cs.memory=linearMemory;
ss.memory=linearMemory;
ds.memory=linearMemory;
es.memory=linearMemory;
fs.memory=linearMemory;
gs.memory=linearMemory;
if(processorGUICode!=null) processorGUICode.push(GUICODE.MODE_PROTECTED);
// System.out.println("Switching to Protected Mode");
// System.out.printf("New segment bases: CS: %x, SS: %x, DS: %x, ES: %x, FS: %x, GS: %x\n",cs.getBase(),ss.getBase(),ds.getBase(),es.getBase(),fs.getBase(),gs.getBase());
}
if ((value&0x2)!=0)
panic("implement CR0 monitor coprocessor");
if ((value&0x4)!=0)
panic("implement CR0 fpu emulation");
if ((value&0x8)!=0)
panic("implement CR0 task switched");
if ((value&0x20)!=0)
panic("implement CR0 numeric error");
if ((value&0x40000)!=0)
panic("implement CR0 alignment mask");
if ((value&0x20000000)==0)
panic("implement CR0 writethrough");
if ((changedBits&0x10000)!=0)
{
panic("implement CR0 write protect");
linearMemory.setWriteProtectUserPages((value&0x10000)!=0);
}
if ((changedBits&0x40000000)!=0)
{
//page caching
linearMemory.setPagingEnabled((value&0x80000000)!=0);
linearMemory.setPageCacheEnabled((value&0x40000000)==0);
}
if ((changedBits&0x80000000)!=0)
{
//paging
linearMemory.setPagingEnabled((value&0x80000000)!=0);
linearMemory.setPageCacheEnabled((value&0x40000000)==0);
}
}
public void setCR2(int value)
{
cr2.setValue(value);
if (value!=0)
panic("setting CR2 to "+value);
}
public void setCR3(int value)
{
cr3.setValue(value);
linearMemory.setPageDirectoryBaseAddress(value);
linearMemory.setPageCacheEnabled((value&0x10)==0);
// if ((value&0x8)==0)
// panic("implement CR3 writes transparent");
}
public void setCR4(int value)
{
cr4.setValue((cr4.getValue()&~0x5f)|(value&0x5f));
linearMemory.setGlobalPagesEnabled((value&0x80)!=0);
linearMemory.setPageSizeExtensionsEnabled((value&0x10)!=0);
}
public boolean isModeReal()
{
if((cr0.getValue()&1)==0) return true;
return false;
}
private void setCPL(int cpl)
{
current_privilege_level=cpl;
linearMemory.setSupervisor(cpl==0);
}
//models a register
//public class Register extends MonitoredRegister
public class Register
{
static final int EAX=100, EBX=101, ECX=102, EDX=103, ESI=104, EDI=105, ESP=106, EBP=107, CR0=108, CR2=109, CR3=110, CR4=111, EIP=112;
int id;
int value;
public String saveState()
{
String state="";
state+=id+" "+value;
return state;
}
public void loadState(String state)
{
Scanner loader=new Scanner(state);
id=loader.nextInt(); value=loader.nextInt();
}
public Register(int id)
{
this.id=id;
this.value=0;
// super(0);
}
public Register(int id, int value)
{
this.id=id;
this.value=value;
// super(value);
}
public int getValue()
{
// super.updateGUI();
if(processorGUICode!=null) processorGUICode.pushRegister(id,0,value);
return value;
}
public void setValue(int value)
{
// super.updateGUI();
if(processorGUICode!=null) processorGUICode.pushRegister(id,1,value);
this.value=value;
}
public short getLower16Value()
{
return (short)(getValue()&0xffff);
}
public byte getLower8Value()
{
return (byte)(getValue()&0xff);
}
public byte getUpper8Value()
{
return (byte)((getValue()>>8)&0xff);
}
public void setLower16Value(int v)
{
setValue((getValue()&0xffff0000)|(0x0000ffff&v));
}
public void setLower8Value(int v)
{
setValue((getValue()&0xffffff00)|(0x000000ff&v));
}
public void setUpper8Value(int v)
{
setValue((getValue()&0xffff00ff)|(0x0000ff00&(v<<8)));
}
}
//public class Flag extends MonitoredFlag
public class Flag
{
int type;
public static final int AUXILIARYCARRY=100, CARRY=101, ZERO=102, SIGN=103, PARITY=104, OVERFLOW=105, OTHER=106;
public static final int AC_XOR = 1;
public static final int AC_BIT4_NEQ = 2;
public static final int AC_LNIBBLE_MAX = 3;
public static final int AC_LNIBBLE_ZERO = 4;
public static final int AC_LNIBBLE_NZERO = 5;
public static final int OF_NZ = 1;
public static final int OF_NOT_BYTE = 2;
public static final int OF_NOT_SHORT = 3;
public static final int OF_NOT_INT = 3;
public static final int OF_LOW_WORD_NZ = 5;
public static final int OF_HIGH_BYTE_NZ = 6;
public static final int OF_BIT6_XOR_CARRY = 7;
public static final int OF_BIT7_XOR_CARRY = 8;
public static final int OF_BIT14_XOR_CARRY = 9;
public static final int OF_BIT15_XOR_CARRY = 10;
public static final int OF_BIT30_XOR_CARRY = 11;
public static final int OF_BIT31_XOR_CARRY = 12;
public static final int OF_BIT7_DIFFERENT = 13;
public static final int OF_BIT15_DIFFERENT = 14;
public static final int OF_BIT31_DIFFERENT = 15;
public static final int OF_MAX_BYTE = 16;
public static final int OF_MAX_SHORT = 17;
public static final int OF_MAX_INT = 18;
public static final int OF_MIN_BYTE = 19;
public static final int OF_MIN_SHORT = 20;
public static final int OF_MIN_INT = 21;
public static final int OF_ADD_BYTE = 22;
public static final int OF_ADD_SHORT = 23;
public static final int OF_ADD_INT = 24;
public static final int OF_SUB_BYTE = 25;
public static final int OF_SUB_SHORT = 26;
public static final int OF_SUB_INT = 27;
public static final int CY_NZ = 1;
public static final int CY_NOT_BYTE = 2;
public static final int CY_NOT_SHORT = 3;
public static final int CY_NOT_INT = 4;
public static final int CY_LOW_WORD_NZ = 5;
public static final int CY_HIGH_BYTE_NZ = 6;
public static final int CY_NTH_BIT_SET = 7;
public static final int CY_GREATER_FF = 8;
public static final int CY_TWIDDLE_FF = 9;
public static final int CY_TWIDDLE_FFFF = 10;
public static final int CY_TWIDDLE_FFFFFFFF = 11;
public static final int CY_SHL_OUTBIT_BYTE = 12;
public static final int CY_SHL_OUTBIT_SHORT = 13;
public static final int CY_SHL_OUTBIT_INT = 14;
public static final int CY_SHR_OUTBIT = 15;
public static final int CY_LOWBIT = 16;
public static final int CY_HIGHBIT_BYTE = 17;
public static final int CY_HIGHBIT_SHORT = 18;
public static final int CY_HIGHBIT_INT = 19;
public static final int CY_OFFENDBIT_BYTE = 20;
public static final int CY_OFFENDBIT_SHORT = 21;
public static final int CY_OFFENDBIT_INT = 22;
private boolean value;
private int v1, v2, v3, method;
private long v1long;
public String saveState()
{
String state="";
state+=type+" "+(value?1:0)+" "+v1+" "+v2+" "+v3+" "+method+" "+v1long;
return state;
}
public void loadState(String state)
{
Scanner loader=new Scanner(state);
type=loader.nextInt(); value=loader.nextInt()==1; v1=loader.nextInt(); v2=loader.nextInt(); v3=loader.nextInt(); method=loader.nextInt(); v1long=loader.nextLong();
}
public Flag(int type)
{
// super(false);
this.type=type;
}
public void clear()
{
if(processorGUICode!=null) processorGUICode.pushFlag(type,0);
value=false;
// super.updateGUI();
}
public void set()
{
if(processorGUICode!=null) processorGUICode.pushFlag(type,1);
value=true;
// super.updateGUI();
}
public boolean read()
{
// super.updateGUI();
if(processorGUICode!=null) processorGUICode.pushFlag(type,2);
return value;
}
public void toggle()
{
if (value)
clear();
else
set();
}
public void set(boolean value)
{
if (value)
set();
else
clear();
}
private void calculate()
{
switch(type)
{
case AUXILIARYCARRY: calculateAuxiliaryCarry(); break;
case ZERO: calculateZero(); break;
case OVERFLOW: calculateOverflow(); break;
case PARITY: calculateParity(); break;
case SIGN: calculateSign(); break;
case CARRY: calculateCarry(); break;
}
}
private void calculateAuxiliaryCarry()
{
if (method==AC_XOR)
set((((v1^v2)^v3)&0x10)!=0);
else if (method==AC_LNIBBLE_MAX)
set((v1&0xf)==0xf);
else if (method==AC_LNIBBLE_ZERO)
set((v1&0xf)==0x0);
else if (method==AC_BIT4_NEQ)
set((v1&0x8)!=(v2&0x8));
else if (method==AC_LNIBBLE_NZERO)
set((v1&0xf)!=0);
}
private void calculateParity()
{
set((Integer.bitCount(v1&0xff)&0x1)==0);
}
private void calculateOverflow()
{
if (method==OF_ADD_BYTE)
set(((v2&0x80)==(v3&0x80))&&((v2&0x80)!=(v1&0x80)));
else if (method==OF_ADD_SHORT)
set(((v2&0x8000)==(v3&0x8000))&&((v2&0x8000)!=(v1&0x8000)));
else if (method==OF_ADD_INT)
set(((v2&0x80000000)==(v3&0x80000000))&&((v2&0x80000000)!=(v1&0x80000000)));
else if (method==OF_SUB_BYTE)
set(((v2&0x80)!=(v3&0x80))&&((v2&0x80)!=(v1&0x80)));
else if (method==OF_SUB_SHORT)
set(((v2&0x8000)!=(v3&0x8000))&&((v2&0x8000)!=(v1&0x8000)));
else if (method==OF_SUB_INT)
set(((v2&0x80000000)!=(v3&0x80000000))&&((v2&0x80000000)!=(v1&0x80000000)));
else if (method==OF_MAX_BYTE)
set(v1==0x7f);
else if (method==OF_MIN_BYTE)
set(v1==(byte)0x80);
else if (method==OF_MAX_SHORT)
set(v1==0x7fff);
else if (method==OF_MIN_SHORT)
set(v1==(short)0x8000);
else if (method==OF_MAX_INT)
set(v1==0x7fffffff);
else if (method==OF_MIN_INT)
set(v1==0x80000000);
else if (method==OF_BIT6_XOR_CARRY)
set(((v1&0x40)!=0)^carry.read());
else if (method==OF_BIT7_XOR_CARRY)
set(((v1&0x80)!=0)^carry.read());
else if (method==OF_BIT14_XOR_CARRY)
set(((v1&0x4000)!=0)^carry.read());
else if (method==OF_BIT15_XOR_CARRY)
set(((v1&0x8000)!=0)^carry.read());
else if (method==OF_BIT30_XOR_CARRY)
set(((v1&0x40000000)!=0)^carry.read());
else if (method==OF_BIT31_XOR_CARRY)
set(((v1&0x80000000)!=0)^carry.read());
else if (method==OF_BIT7_DIFFERENT)
set((v1&0x80)!=(v2&0x80));
else if (method==OF_BIT15_DIFFERENT)
set((v1&0x8000)!=(v2&0x8000));
else if (method==OF_BIT31_DIFFERENT)
set((v1&0x80000000)!=(v2&0x80000000));
else if (method==OF_NZ)
set(v1!=0);
else if (method==OF_NOT_BYTE)
set(v1!=(byte)v1);
else if (method==OF_NOT_SHORT)
set(v1!=(short)v1);
else if (method==OF_NOT_INT)
set(v1long!=(int)v1long);
else if (method==OF_LOW_WORD_NZ)
set((v1&0xffff)!=0);
else if (method==OF_HIGH_BYTE_NZ)
set((v1&0xff00)!=0);
}
private void calculateCarry()
{
if (method==CY_TWIDDLE_FF)
set((v1&(~0xff))!=0);
else if (method==CY_TWIDDLE_FFFF)
set((v1&(~0xffff))!=0);
else if (method==CY_TWIDDLE_FFFFFFFF)
set((v1long&(~0xffffffffl))!=0);
else if (method==CY_SHR_OUTBIT)
set(((v1>>>(v2-1))&0x1)!=0);
else if (method==CY_SHL_OUTBIT_BYTE)
set(((v1<<(v2-1))&0x80)!=0);
else if (method==CY_SHL_OUTBIT_SHORT)
set(((v1<<(v2-1))&0x8000)!=0);
else if (method==CY_SHL_OUTBIT_INT)
set(((v1<<(v2-1))&0x80000000)!=0);
else if (method==CY_NZ)
set(v1!=0);
else if (method==CY_NOT_BYTE)
set(v1!=(byte)v1);
else if (method==CY_NOT_SHORT)
set(v1!=(short)v1);
else if (method==CY_NOT_INT)
set(v1long!=(int)v1long);
else if (method==CY_LOW_WORD_NZ)
set((v1&0xffff)!=0);
else if (method==CY_HIGH_BYTE_NZ)
set((v1&0xff00)!=0);
else if (method==CY_NTH_BIT_SET)
set((v1&(1<<v2))!=0);
else if (method==CY_GREATER_FF)
set(v1>0xff);
else if (method==CY_LOWBIT)
set((v1&0x1)!=0);
else if (method==CY_HIGHBIT_BYTE)
set((v1&0x80)!=0);
else if (method==CY_HIGHBIT_SHORT)
set((v1&0x8000)!=0);
else if (method==CY_HIGHBIT_INT)
set((v1&0x80000000)!=0);
else if (method==CY_OFFENDBIT_BYTE)
set((v1&0x100)!=0);
else if (method==CY_OFFENDBIT_SHORT)
set((v1&0x10000)!=0);
else if (method==CY_OFFENDBIT_INT)
set((v1long&0x100000000l)!=0);
}
private void calculateZero()
{
set(v1==0);
}
private void calculateSign()
{
set(v1<0);
}
public void set(int d1, int d2, int d3, int m)
{
v1=d1;
v2=d2;
v3=d3;
method=m;
calculate();
}
public void set(int d1, int d2, int m)
{
v1=d1;
v2=d2;
method=m;
calculate();
}
public void set(int d1, int m)
{
v1=d1;
method=m;
calculate();
}
public void set(long d1, int m)
{
v1long=d1;
method=m;
calculate();
}
public void set(int d1)
{
v1=d1;
calculate();
}
}
//models a segment register
//public class Segment extends MonitoredRegister
public class Segment
{
public static final int CS=100,SS=101,DS=102,ES=103,FS=104,GS=105,IDTR=106,GDTR=107,LDTR=108,TSS=109;
private int value;
private int id;
private int base;
private long limit;
private MemoryDevice memory;
long descriptor;
boolean granularity,defaultSize,present,system;
int rpl,dpl;
public String saveState()
{
String state="";
state+=value+" "+id+" "+base+" "+limit+" "+descriptor+" "+(granularity?1:0)+" "+(defaultSize?1:0)+" "+(present?1:0)+" "+(system?1:0)+" "+rpl+" "+dpl;
return state;
}
public void loadState(String state)
{
Scanner loader=new Scanner(state);
value=loader.nextInt(); id=loader.nextInt(); base=loader.nextInt(); limit=loader.nextLong();
descriptor=loader.nextLong(); granularity=loader.nextInt()==1; defaultSize=loader.nextInt()==1; present=loader.nextInt()==1; system=loader.nextInt()==1;
rpl=loader.nextInt(); dpl=loader.nextInt();
}
public Segment(int id, MemoryDevice memory)
{
// super(0);
this.id=id;
this.memory=memory;
limit=0xffff;
}
public void setDescriptorValue(int value)
{
if(processorGUICode!=null) processorGUICode.pushSegment(id,1,value);
this.value=value;
this.base=value;
this.limit=0xffff;
// super.updateGUI();
}
public void setDescriptorValue(int value, int limit)
{
if(processorGUICode!=null) processorGUICode.pushSegment(id,1,value);
this.value=value;
this.base=value;
this.limit=limit;
// super.updateGUI();
}
public void setValue(int value)
{
if(processorGUICode!=null) processorGUICode.pushSegment(id,1,value);
if(isModeReal())
setRealValue(value);
else
setProtectedValue(value);
// super.updateGUI();
}
public int getValue()
{
if(processorGUICode!=null) processorGUICode.pushSegment(id,0,value);
// super.updateGUI();
return value;
}
public void setRealValue(int value)
{
this.value=value;
this.base=(0xffff0 & (value<<4));
defaultSize=false;
}
public void setProtectedValue(int value)
{
//first get the descriptor
boolean sup=linearMemory.isSupervisor;
linearMemory.setSupervisor(true);
if ((value&4)==0)
{
descriptor=gdtr.loadQuadWord(value&0xfff8);
}
else
{
if (ldtr==null)
{
System.out.println("LDTR is null");
throw GENERAL_PROTECTION;
}
descriptor=ldtr.loadQuadWord(value&0xfff8);
}
setProtectedValue(value,descriptor);
linearMemory.setSupervisor(sup);
}
public void setProtectedValue(int value, long descriptor)
{
this.value=value;
this.descriptor=descriptor;
granularity=(descriptor&0x80000000000000l)!=0;
if(granularity)
limit=((descriptor<<12)&0xffff000l)|((descriptor>>>20)&0xf0000000l)|0xffl;
else
limit=(descriptor&0xffffl)|((descriptor>>>32)&0xf0000l);
base=(int)((0xffffffl & (descriptor>>16))|((descriptor>>32)&0xffffffffff000000l));
rpl=value&0x3;
dpl=(int)((descriptor>>45)&0x3);
defaultSize=(descriptor&(1l<<54))!=0;
present=(descriptor&(1l<<47))!=0;
system=(descriptor&(1l<<44))!=0;
if (id==CS && !defaultSize)
System.out.println("operating in 16 bit protected mode "+descriptor+" "+value);
else if (id==CS)
System.out.println("operating in 32 bit protected mode "+descriptor+" "+value);
}
public int getBase()
{
return base;
}
public int getLimit()
{
return (int)limit;
}
//16 or 32?
public boolean getDefaultSize()
{
return defaultSize;
}
public int address(int offset)
{
// return (0xffff0&base)+(0xffff&offset);
return base+offset;
}
public int physicalAddress(int offset)
{
if(memory==computer.physicalMemory)
return base+offset;
return linearMemory.virtualAddressLookup(base+offset);
}
public byte loadByte(int offset)
{
byte memvalue=memory.getByte(address(offset));
if(processorGUICode!=null) processorGUICode.pushMemory(id,value,0,address(offset),memvalue);
return memvalue;
}
public short loadWord(int offset)
{
short memvalue=memory.getWord(address(offset));
if(processorGUICode!=null) processorGUICode.pushMemory(id,value,0,address(offset),memvalue);
return memvalue;
}
public int loadDoubleWord(int offset)
{
int memvalue=memory.getDoubleWord(address(offset));
if(processorGUICode!=null) processorGUICode.pushMemory(id,value,0,address(offset),memvalue);
return memvalue;
}
public long loadQuadWord(int offset)
{
long memvalue=memory.getQuadWord(address(offset));
if(processorGUICode!=null) processorGUICode.pushMemory(id,value,0,address(offset),memvalue);
return memvalue;
}
public void storeByte(int offset, byte value)
{
if(processorGUICode!=null) processorGUICode.pushMemory(id,this.value,1,address(offset),value);
memory.setByte(address(offset),value);
fetchQueue.flush();
}
public void storeWord(int offset, short value)
{
if(processorGUICode!=null) processorGUICode.pushMemory(id,this.value,1,address(offset),value);
memory.setWord(address(offset),value);
fetchQueue.flush();
}
public void storeDoubleWord(int offset, int value)
{
if(processorGUICode!=null) processorGUICode.pushMemory(id,this.value,1,address(offset),value);
memory.setDoubleWord(address(offset),value);
fetchQueue.flush();
}
public void storeQuadWord(int offset, long value)
{
if(processorGUICode!=null) processorGUICode.pushMemory(id,this.value,1,address(offset),value);
memory.setQuadWord(address(offset),value);
fetchQueue.flush();
}
}
public int getFlags()
{
int result=0x2;
if(carry.read()) result|=0x1;
if(parity.read()) result|=0x4;
if(auxiliaryCarry.read()) result|=0x10;
if(zero.read()) result|=0x40;
if(sign.read()) result|=0x80;
if(trap.read()) result|=0x100;
if(interruptEnable.read()) result|=0x200;
if(direction.read()) result|=0x400;
if(overflow.read()) result|=0x800;
if(ioPrivilegeLevel0.read()) result|=0x1000;
if(ioPrivilegeLevel1.read()) result|=0x2000;
if(nestedTask.read()) result|=0x4000;
if(alignmentCheck.read()) result|=0x40000;
if(idFlag.read()) result|=0x200000;
return result;
}
public void setFlags(int code)
{
carry.set((code&1)!=0);
parity.set((code&(1<<2))!=0);
auxiliaryCarry.set((code&(1<<4))!=0);
zero.set((code&(1<<6))!=0);
sign.set((code&(1<<7))!=0);
trap.set((code&(1<<8))!=0);
interruptEnable.set((code&(1<<9))!=0);
interruptEnableSoon.set((code&(1<<9))!=0);
direction.set((code&(1<<10))!=0);
overflow.set((code&(1<<11))!=0);
ioPrivilegeLevel0.set((code&(1<<12))!=0);
ioPrivilegeLevel1.set((code&(1<<13))!=0);
nestedTask.set((code&(1<<14))!=0);
alignmentCheck.set((code&(1<<18))!=0);
idFlag.set((code&(1<<21))!=0);
}
public void handleProcessorException(Processor_Exception e)
{
if (e.vector==PAGE_FAULT.vector)
{
setCR2(linearMemory.lastPageFaultAddress);
System.out.println("A page fault exception just happened: "+e.vector);
}
//REMOVE THIS LINE WHEN I'M CONFIDENT THAT EXCEPTIONS WORK
panic("A processor exception happened "+e.vector);
System.out.println("A Processor Exception just happened: "+e.vector);
if(processorGUICode!=null) processorGUICode.push(GUICODE.EXCEPTION,e.vector);
handleInterrupt(e.vector);
}
public void waitForInterrupt()
{
System.out.println("Halting machine (probably a PANIC happened)");
haltMode=true;
}
//call this periodically to accept incoming interrupts
public void processInterrupts()
{
//if disable interrupt mode, just ignore
if(!interruptEnable.read())
{
interruptEnable.set(interruptEnableSoon.read());
return;
}
//is there a hardware interrupt outstanding?
if((interruptFlags & 0x1) == 0)
return;
//turn off the flag
interruptFlags &= ~0x1;
//get the interrupt
haltMode=false;
lastInterrupt=interruptController.cpuGetInterrupt();
handleInterrupt(lastInterrupt);
}
//tell the cpu that there is a hardware interrupt ready
public void raiseInterrupt()
{
// System.out.println("raiseInterrupt called");
interruptFlags |= 0x1;
}
//tell the cpu that there is no longer a hardware interrupt ready
public void clearInterrupt()
{
interruptFlags &= ~ 0x1;
}
//deal with a real mode interrupt
public void handleInterrupt(int vector)
{
int newIP=0, newSegment=0;
long descriptor=0;
if (isModeReal())
{
//get the new CS:IP from the IVT
vector=vector*4;
newIP = 0xffff & idtr.loadWord(vector);
newSegment = 0xffff & idtr.loadWord(vector+2);
//save the flags on the stack
short sesp = (short) esp.getValue();
sesp-=2;
int eflags = getFlags() & 0xffff;
ss.storeWord(sesp & 0xffff, (short)eflags);
//disable interrupts
interruptEnable.clear();
interruptEnableSoon.clear();
//save CS:IP on the stack
sesp-=2;
ss.storeWord(sesp&0xffff, (short)cs.getValue());
sesp-=2;
ss.storeWord(sesp&0xffff, (short)eip.getValue());
esp.setValue((0xffff0000 & esp.getValue()) | (sesp & 0xffff));
//change CS and IP to the ISR's values
cs.setValue(newSegment);
eip.setValue(newIP);
}
else
{
//get the new CS:EIP from the IDT
boolean sup=linearMemory.isSupervisor;
linearMemory.setSupervisor(true);
vector=vector*8;
descriptor=idtr.loadQuadWord(vector);
int segIndex=(int)((descriptor>>16)&0xffff);
if ((segIndex&4)!=0)
descriptor=ldtr.loadQuadWord(segIndex&0xfff8);
else
descriptor=gdtr.loadQuadWord(segIndex&0xfff8);
linearMemory.setSupervisor(sup);
int dpl=(int)((descriptor>>45)&0x3);
newIP = (int)(((descriptor>>32)&0xffff0000)|(descriptor&0x0000ffff));
newSegment = (int)((descriptor>>16)&0xffff);
if (dpl<current_privilege_level)
{
int stackAddress=dpl*8+4;
int newSS=0xffff&(tss.loadWord(stackAddress+4));
int newSP=tss.loadDoubleWord(stackAddress);
int oldSS=ss.getValue();
int oldSP=esp.getValue();
ss.setValue(newSS);
esp.setValue(newSP);
//save SS:ESP on the stack
int sesp1 = esp.getValue();
sesp1-=4;
ss.storeDoubleWord(sesp1, oldSS);
sesp1-=4;
ss.storeDoubleWord(sesp1, oldSP);
esp.setValue(sesp1);
}
//save the flags on the stack
int sesp=esp.getValue();
int eflags = getFlags();
ss.storeDoubleWord(sesp, eflags);
//disable interrupts
interruptEnable.clear();
interruptEnableSoon.clear();
//save CS:IP on the stack
sesp-=4;
ss.storeDoubleWord(sesp, cs.getValue());
sesp-=4;
ss.storeDoubleWord(sesp, eip.getValue());
esp.setValue(sesp);
//change CS and IP to the ISR's values
cs.setProtectedValue(newSegment,descriptor);
eip.setValue(newIP);
setCPL(dpl);
// current_privilege_level=dpl;
}
if(processorGUICode!=null) processorGUICode.push(GUICODE.HARDWARE_INTERRUPT,vector);
//System.out.printf("Hardware interrupt happened %x\n",vector);
}
public FetchQueue fetchQueue;
public class FetchQueue
{
private static final int PREFETCH_QUANTITY=40;
private static final int MAX_INST_LENGTH=16;
private byte[] bytearray;
private int[] iparray;
private boolean dofetch;
int counter;
int ilength;
public void fetch()
{
ilength=0;
if (!dofetch)
{
if (iparray[counter]!=eip.getValue())
dofetch=true;
if (counter>PREFETCH_QUANTITY-MAX_INST_LENGTH)
dofetch=true;
}
if (dofetch)
{
counter=0;
int pc=eip.getValue();
for (int i=0; i<PREFETCH_QUANTITY; i++)
{
bytearray[i]=cs.loadByte(pc+i);
iparray[i]=pc+i;
}
dofetch=false;
}
}
public void flush()
{
dofetch=true;
}
public FetchQueue()
{
bytearray=new byte[PREFETCH_QUANTITY];
iparray=new int[PREFETCH_QUANTITY];
counter=0;
ilength=0;
dofetch=true;
}
public byte readByte()
{
return bytearray[counter];
}
public byte readByte(int i)
{
return bytearray[counter+i];
}
public int instructionLength()
{
return ilength;
}
public void advance(int i)
{
if (computer.trace!=null)
{
for (int j=0; j<i; j++)
computer.trace.postInstructionByte(bytearray[counter+j]);
}
counter+=i;
ilength+=i;
if (counter>bytearray.length)
panic("Reached end of fetch queue");
}
}
private MICROCODE[] code = new MICROCODE[100];
private int[] icode = new int[100];
private int icodeLength=0;
private int icodesHandled=0;
public int codeLength=0;
public int codesHandled=0;
public static int[][][] operandTable;
public void executeInstruction()
{
//move IP to the next instruction
int pc = eip.getValue();
pc=pc+getInstructionLength();
eip.setValue(pc);
/* //check whether we're out of range
if ((pc & 0xffff0000) != 0)
{
eip.setValue(eip.getValue() - getInstructionLength());
throw GENERAL_PROTECTION;
}
*/
executeMicroInstructions();
}
public void executeMicroInstructions()
{
//internal registers
int reg0=0, reg1=0, reg2=0, addr=0;
long reg0l=0;
Segment seg=null;
boolean condition=false;
int displacement=0;
codesHandled=0;
icodesHandled=0;
MICROCODE microcode;
boolean op32,addr32;
try
{
while (codesHandled < codeLength)
{
microcode=getCode();
op32=isCode(MICROCODE.PREFIX_OPCODE_32BIT);
addr32=isCode(MICROCODE.PREFIX_ADDRESS_32BIT);
if(computer.debugMode)
{
System.out.println(code[codesHandled]);
System.out.printf("reg0=%x, reg1=%x, addr=%x ",reg0,reg1,addr);
System.out.println(microcode+" op32="+" addr32="+addr32);
}
switch (microcode)
{
//reads and writes
case LOAD0_AX: reg0 = eax.getValue() & 0xffff; break;
case LOAD0_BX: reg0 = ebx.getValue() & 0xffff; break;
case LOAD0_CX: reg0 = ecx.getValue() & 0xffff; break;
case LOAD0_DX: reg0 = edx.getValue() & 0xffff; break;
case LOAD0_SP: reg0 = esp.getValue() & 0xffff; break;
case LOAD0_BP: reg0 = ebp.getValue() & 0xffff; break;
case LOAD0_SI: reg0 = esi.getValue() & 0xffff; break;
case LOAD0_DI: reg0 = edi.getValue() & 0xffff; break;
case LOAD0_EAX: reg0 = eax.getValue(); break;
case LOAD0_EBX: reg0 = ebx.getValue(); break;
case LOAD0_ECX: reg0 = ecx.getValue(); break;
case LOAD0_EDX: reg0 = edx.getValue(); break;
case LOAD0_ESP: reg0 = esp.getValue(); break;
case LOAD0_EBP: reg0 = ebp.getValue(); break;
case LOAD0_ESI: reg0 = esi.getValue(); break;
case LOAD0_EDI: reg0 = edi.getValue(); break;
case LOAD0_AL: reg0 = eax.getValue() & 0xff; break;
case LOAD0_AH: reg0 = (eax.getValue()>>8) & 0xff; break;
case LOAD0_BL: reg0 = ebx.getValue() & 0xff; break;
case LOAD0_BH: reg0 = (ebx.getValue()>>8) & 0xff; break;
case LOAD0_CL: reg0 = ecx.getValue() & 0xff; break;
case LOAD0_CH: reg0 = (ecx.getValue()>>8) & 0xff; break;
case LOAD0_DL: reg0 = edx.getValue() & 0xff; break;
case LOAD0_DH: reg0 = (edx.getValue()>>8) & 0xff; break;
case LOAD0_CS: reg0 = cs.getValue() & 0xffff; break;
case LOAD0_SS: reg0 = ss.getValue() & 0xffff; break;
case LOAD0_DS: reg0 = ds.getValue() & 0xffff; break;
case LOAD0_ES: reg0 = es.getValue() & 0xffff; break;
case LOAD0_FS: reg0 = fs.getValue() & 0xffff; break;
case LOAD0_GS: reg0 = gs.getValue() & 0xffff; break;
case LOAD0_FLAGS: reg0 = getFlags() & 0xffff; break;
case LOAD0_EFLAGS: reg0 = getFlags(); break;
case LOAD0_IB: reg0 = getiCode() & 0xff; break;
case LOAD0_IW: reg0 = getiCode() & 0xffff; break;
case LOAD0_ID: reg0 = getiCode(); break;
case LOAD0_ADDR: reg0=addr; break;
case LOAD0_CR0: reg0 = cr0.getValue(); break;
case LOAD0_CR2: reg0 = cr2.getValue(); break;
case LOAD0_CR3: reg0 = cr3.getValue(); break;
case LOAD0_CR4: reg0 = cr4.getValue(); break;
case LOAD1_AX: reg1 = eax.getValue() & 0xffff; break;
case LOAD1_BX: reg1 = ebx.getValue() & 0xffff; break;
case LOAD1_CX: reg1 = ecx.getValue() & 0xffff; break;
case LOAD1_DX: reg1 = edx.getValue() & 0xffff; break;
case LOAD1_SP: reg1 = esp.getValue() & 0xffff; break;
case LOAD1_BP: reg1 = ebp.getValue() & 0xffff; break;
case LOAD1_SI: reg1 = esi.getValue() & 0xffff; break;
case LOAD1_DI: reg1 = edi.getValue() & 0xffff; break;
case LOAD1_EAX: reg1 = eax.getValue(); break;
case LOAD1_EBX: reg1 = ebx.getValue(); break;
case LOAD1_ECX: reg1 = ecx.getValue(); break;
case LOAD1_EDX: reg1 = edx.getValue(); break;
case LOAD1_ESP: reg1 = esp.getValue(); break;
case LOAD1_EBP: reg1 = ebp.getValue(); break;
case LOAD1_ESI: reg1 = esi.getValue(); break;
case LOAD1_EDI: reg1 = edi.getValue(); break;
case LOAD1_AL: reg1 = eax.getValue() & 0xff; break;
case LOAD1_AH: reg1 = (eax.getValue()>>8) & 0xff; break;
case LOAD1_BL: reg1 = ebx.getValue() & 0xff; break;
case LOAD1_BH: reg1 = (ebx.getValue()>>8) & 0xff; break;
case LOAD1_CL: reg1 = ecx.getValue() & 0xff; break;
case LOAD1_CH: reg1 = (ecx.getValue()>>8) & 0xff; break;
case LOAD1_DL: reg1 = edx.getValue() & 0xff; break;
case LOAD1_DH: reg1 = (edx.getValue()>>8) & 0xff; break;
case LOAD1_CS: reg1 = cs.getValue() & 0xffff; break;
case LOAD1_SS: reg1 = ss.getValue() & 0xffff; break;
case LOAD1_DS: reg1 = ds.getValue() & 0xffff; break;
case LOAD1_ES: reg1 = es.getValue() & 0xffff; break;
case LOAD1_FS: reg1 = fs.getValue() & 0xffff; break;
case LOAD1_GS: reg1 = gs.getValue() & 0xffff; break;
case LOAD1_FLAGS: reg1 = getFlags() & 0xffff; break;
case LOAD1_EFLAGS: reg1 = getFlags(); break;
case LOAD1_IB: reg1 = getiCode() & 0xff; break;
case LOAD1_IW: reg1 = getiCode() & 0xffff; break;
case LOAD1_ID: reg1 = getiCode(); break;
case LOAD2_IB: reg2 = getiCode() & 0xff; break;
case LOAD2_AL: reg2 = eax.getValue() & 0xff; break;
case LOAD2_AX: reg2 = eax.getValue() & 0xffff; break;
case LOAD2_EAX: reg2 = eax.getValue(); break;
case LOAD2_CL: reg2 = ecx.getValue() & 0xff; break;
case STORE0_AX: eax.setLower16Value(0xffff & reg0); break;
case STORE0_BX: ebx.setLower16Value(0xffff & reg0); break;
case STORE0_CX: ecx.setLower16Value(0xffff & reg0); break;
case STORE0_DX: edx.setLower16Value(0xffff & reg0); break;
case STORE0_SP: esp.setLower16Value(0xffff & reg0); break;
case STORE0_BP: ebp.setLower16Value(0xffff & reg0); break;
case STORE0_SI: esi.setLower16Value(0xffff & reg0); break;
case STORE0_DI: edi.setLower16Value(0xffff & reg0); break;
case STORE0_EAX: eax.setValue(reg0); break;
case STORE0_EBX: ebx.setValue(reg0); break;
case STORE0_ECX: ecx.setValue(reg0); break;
case STORE0_EDX: edx.setValue(reg0); break;
case STORE0_ESP: esp.setValue(reg0); break;
case STORE0_EBP: ebp.setValue(reg0); break;
case STORE0_ESI: esi.setValue(reg0); break;
case STORE0_EDI: edi.setValue(reg0); break;
case STORE0_AL: eax.setLower8Value(0xff & reg0); break;
case STORE0_AH: eax.setUpper8Value(0xff & reg0); break;
case STORE0_BL: ebx.setLower8Value(0xff & reg0); break;
case STORE0_BH: ebx.setUpper8Value(0xff & reg0); break;
case STORE0_CL: ecx.setLower8Value(0xff & reg0); break;
case STORE0_CH: ecx.setUpper8Value(0xff & reg0); break;
case STORE0_DL: edx.setLower8Value(0xff & reg0); break;
case STORE0_DH: edx.setUpper8Value(0xff & reg0); break;
case STORE0_CS: cs.setValue(0xffff & reg0); break;
case STORE0_SS: ss.setValue(0xffff & reg0); break;
case STORE0_DS: ds.setValue(0xffff & reg0); break;
case STORE0_ES: es.setValue(0xffff & reg0); break;
case STORE0_FS: fs.setValue(0xffff & reg0); break;
case STORE0_GS: gs.setValue(0xffff & reg0); break;
case STORE0_FLAGS: setFlags(0xffff & reg0); break;
case STORE0_EFLAGS: setFlags(reg0); break;
case STORE0_CR0: setCR0(reg0); break;
case STORE0_CR2: setCR2(reg0); break;
case STORE0_CR3: setCR3(reg0); break;
case STORE0_CR4: setCR4(reg0); break;
case STORE1_AX: eax.setLower16Value(0xffff & reg1); break;
case STORE1_BX: ebx.setLower16Value(0xffff & reg1); break;
case STORE1_CX: ecx.setLower16Value(0xffff & reg1); break;
case STORE1_DX: edx.setLower16Value(0xffff & reg1); break;
case STORE1_SP: esp.setLower16Value(0xffff & reg1); break;
case STORE1_BP: ebp.setLower16Value(0xffff & reg1); break;
case STORE1_SI: esi.setLower16Value(0xffff & reg1); break;
case STORE1_DI: edi.setLower16Value(0xffff & reg1); break;
case STORE1_EAX: eax.setValue(reg1); break;
case STORE1_EBX: ebx.setValue(reg1); break;
case STORE1_ECX: ecx.setValue(reg1); break;
case STORE1_EDX: edx.setValue(reg1); break;
case STORE1_ESP: esp.setValue(reg1); break;
case STORE1_EBP: ebp.setValue(reg1); break;
case STORE1_ESI: esi.setValue(reg1); break;
case STORE1_EDI: edi.setValue(reg1); break;
case STORE1_AL: eax.setLower8Value(0xff & reg1); break;
case STORE1_AH: eax.setUpper8Value(0xff & reg1); break;
case STORE1_BL: ebx.setLower8Value(0xff & reg1); break;
case STORE1_BH: ebx.setUpper8Value(0xff & reg1); break;
case STORE1_CL: ecx.setLower8Value(0xff & reg1); break;
case STORE1_CH: ecx.setUpper8Value(0xff & reg1); break;
case STORE1_DL: edx.setLower8Value(0xff & reg1); break;
case STORE1_DH: edx.setUpper8Value(0xff & reg1); break;
case STORE1_CS: cs.setValue(0xffff & reg1); break;
case STORE1_SS: ss.setValue(0xffff & reg1); break;
case STORE1_DS: ds.setValue(0xffff & reg1); break;
case STORE1_ES: es.setValue(0xffff & reg1); break;
case STORE1_FS: fs.setValue(0xffff & reg1); break;
case STORE1_GS: gs.setValue(0xffff & reg1); break;
case STORE1_FLAGS: setFlags(0xffff & reg1); break;
case STORE1_EFLAGS: setFlags(reg1); break;
case LOAD0_MEM_BYTE: reg0 = 0xff & seg.loadByte(addr); break;
case LOAD1_MEM_BYTE: reg1 = 0xff & seg.loadByte(addr); break;
case STORE0_MEM_BYTE: seg.storeByte(addr,(byte)reg0); break;
case STORE1_MEM_BYTE: seg.storeByte(addr,(byte)reg1); break;
case LOAD0_MEM_WORD: reg0 = 0xffff & seg.loadWord(addr); break;
case LOAD1_MEM_WORD: reg1 = 0xffff & seg.loadWord(addr); break;
case STORE0_MEM_WORD: seg.storeWord(addr,(short)reg0); break;
case STORE1_MEM_WORD: seg.storeWord(addr,(short)reg1); break;
case LOAD0_MEM_DOUBLE: reg0 = seg.loadDoubleWord(addr); break;
case LOAD1_MEM_DOUBLE: reg1 = seg.loadDoubleWord(addr); break;
case STORE0_MEM_DOUBLE: seg.storeDoubleWord(addr,reg0); break;
case STORE1_MEM_DOUBLE: seg.storeDoubleWord(addr,reg1); break;
//addressing
case ADDR_AX: addr += (short)eax.getValue(); break;
case ADDR_AL: addr += ((0xff)&eax.getValue()); break;
case ADDR_BX: addr += (short)ebx.getValue(); break;
case ADDR_CX: addr += (short)ecx.getValue(); break;
case ADDR_DX: addr += (short)edx.getValue(); break;
case ADDR_SP: addr += (short)esp.getValue(); break;
case ADDR_BP: addr += (short)ebp.getValue(); break;
case ADDR_SI: addr += (short)esi.getValue(); break;
case ADDR_DI: addr += (short)edi.getValue(); break;
case ADDR_EAX: addr += eax.getValue(); break;
case ADDR_EBX: addr += ebx.getValue(); break;
case ADDR_ECX: addr += ecx.getValue(); break;
case ADDR_EDX: addr += edx.getValue(); break;
case ADDR_ESP: addr += esp.getValue(); break;
case ADDR_EBP: addr += ebp.getValue(); break;
case ADDR_ESI: addr += esi.getValue(); break;
case ADDR_EDI: addr += edi.getValue(); break;
case ADDR_2EAX: addr += (eax.getValue()<<1); break;
case ADDR_2EBX: addr += (ebx.getValue()<<1); break;
case ADDR_2ECX: addr += (ecx.getValue()<<1); break;
case ADDR_2EDX: addr += (edx.getValue()<<1); break;
case ADDR_2EBP: addr += (ebp.getValue()<<1); break;
case ADDR_2ESI: addr += (esi.getValue()<<1); break;
case ADDR_2EDI: addr += (edi.getValue()<<1); break;
case ADDR_4EAX: addr += (eax.getValue()<<2); break;
case ADDR_4EBX: addr += (ebx.getValue()<<2); break;
case ADDR_4ECX: addr += (ecx.getValue()<<2); break;
case ADDR_4EDX: addr += (edx.getValue()<<2); break;
case ADDR_4EBP: addr += (ebp.getValue()<<2); break;
case ADDR_4ESI: addr += (esi.getValue()<<2); break;
case ADDR_4EDI: addr += (edi.getValue()<<2); break;
case ADDR_8EAX: addr += (eax.getValue()<<3); break;
case ADDR_8EBX: addr += (ebx.getValue()<<3); break;
case ADDR_8ECX: addr += (ecx.getValue()<<3); break;
case ADDR_8EDX: addr += (edx.getValue()<<3); break;
case ADDR_8EBP: addr += (ebp.getValue()<<3); break;
case ADDR_8ESI: addr += (esi.getValue()<<3); break;
case ADDR_8EDI: addr += (edi.getValue()<<3); break;
case ADDR_IB: displacement=((byte)getiCode()); addr += displacement; break;
case ADDR_IW: displacement= (short)getiCode(); addr += displacement; break;
case ADDR_ID: displacement= getiCode(); addr += displacement; break;
case ADDR_MASK_16: addr=addr&0xffff; break;
case LOAD_SEG_CS: seg = cs; addr=0; break;
case LOAD_SEG_SS: seg = ss; addr=0; break;
case LOAD_SEG_DS: seg = ds; addr=0; break;
case LOAD_SEG_ES: seg = es; addr=0; break;
case LOAD_SEG_FS: seg = fs; addr=0; break;
case LOAD_SEG_GS: seg = gs; addr=0; break;
//operations
//control
case OP_JMP_FAR: jump_far(reg0, reg1); break;
case OP_JMP_ABS: eip.setValue(reg0); break;
case OP_CALL: call(reg0, op32, addr32); break;
case OP_CALL_FAR: call_far(reg0, reg1, op32, addr32); break;
case OP_CALL_ABS: call_abs(reg0, op32, addr32); break;
case OP_RET: ret(op32, addr32); break;
case OP_RET_IW: ret_iw((short)reg0,op32,addr32); break;
case OP_RET_FAR: ret_far(op32,addr32); break;
case OP_RET_FAR_IW: ret_far_iw((short)reg0,op32,addr32); break;
case OP_ENTER: enter(reg0, reg1,op32,addr32); break;
case OP_LEAVE: leave(op32,addr32); break;
case OP_JMP_08: jump_08((byte) reg0); break;
case OP_JMP_16_32: if (!op32) { jump_16((short) reg0); } else { jump_32(reg0); } break;
case OP_JO: if (overflow.read()) { condition=true; jump_08((byte) reg0); } break;
case OP_JO_16_32: if (!op32) { if (overflow.read()) { condition=true; jump_16((short) reg0);} } else { if (overflow.read()) { condition=true; jump_32(reg0);} } break;
case OP_JNO: if (!overflow.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JNO_16_32: if (!op32) { if (!overflow.read()) { condition=true; jump_16((short) reg0);} } else { if (!overflow.read()) { condition=true; jump_32(reg0);} } break;
case OP_JC: if (carry.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JC_16_32: if (!op32) { if (carry.read()) { condition=true; jump_16((short) reg0);} } else { if (carry.read()) { condition=true; jump_32(reg0);} } break;
case OP_JNC: if (!carry.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JNC_16_32: if (!op32) { if (!carry.read()) { condition=true; jump_16((short) reg0);} } else { if (!carry.read()) { condition=true; jump_32(reg0);} } break;
case OP_JZ: if (zero.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JZ_16_32: if (!op32) { if (zero.read()) { condition=true; jump_16((short) reg0);} } else { if (zero.read()) { condition=true; jump_32(reg0);} } break;
case OP_JNZ: if (!zero.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JNZ_16_32: if (!op32) { if (!zero.read()) { condition=true; jump_16((short) reg0);} } else { if (!zero.read()) { condition=true; jump_32(reg0);} } break;
case OP_JS: if (sign.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JS_16_32: if (!op32) { if (sign.read()) { condition=true; jump_16((short) reg0);} } else { if (sign.read()) { condition=true; jump_32(reg0);} } break;
case OP_JNS: if (!sign.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JNS_16_32: if (!op32) { if (!sign.read()) { condition=true; jump_16((short) reg0);} } else { if (!sign.read()) { condition=true; jump_32(reg0);} } break;
case OP_JP: if (parity.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JP_16_32: if (!op32) { if (parity.read()) { condition=true; jump_16((short) reg0);} } else { if (parity.read()) { condition=true; jump_32(reg0);} } break;
case OP_JNP: if (!parity.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JNP_16_32: if (!op32) { if (!parity.read()) { condition=true; jump_16((short) reg0);} } else { if (!parity.read()) { condition=true; jump_32(reg0);} } break;
case OP_JA: if ((!carry.read()) && (!zero.read())) { condition=true; jump_08((byte) reg0);} break;
case OP_JA_16_32: if (!op32) { if ((!carry.read()) && (!zero.read())) { condition=true; jump_16((short) reg0);} } else { if ((!carry.read()) && (!zero.read())) { condition=true; jump_32(reg0);} } break;
case OP_JNA: if (carry.read() || zero.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JNA_16_32: if (!op32) { if (carry.read() || zero.read()) { condition=true; jump_16((short) reg0);} } else { if (carry.read() || zero.read()) { condition=true; jump_32(reg0);} } break;
case OP_JL: if (sign.read()!=overflow.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JL_16_32: if (!op32) { if (sign.read()!=overflow.read()) { condition=true; jump_16((short) reg0);} } else { if (sign.read()!=overflow.read()) { condition=true; jump_32(reg0);} } break;
case OP_JNL: if (sign.read()==overflow.read()) { condition=true; jump_08((byte) reg0);} break;
case OP_JNL_16_32: if (!op32) { if (sign.read()==overflow.read()) { condition=true; jump_16((short) reg0);} } else { if (sign.read()==overflow.read()) { condition=true; jump_32(reg0);} } break;
case OP_JG: if ((!zero.read()) && (sign.read()==overflow.read())) { condition=true; jump_08((byte) reg0);} break;
case OP_JG_16_32: if (!op32) { if ((!zero.read()) && (sign.read()==overflow.read())) { condition=true; jump_16((short) reg0);} } else { if ((!zero.read()) && (sign.read()==overflow.read())) { condition=true; jump_32(reg0);} } break;
case OP_JNG: if (zero.read() || (sign.read()!=overflow.read())) { condition=true; jump_08((byte) reg0);} break;
case OP_JNG_16_32: if (!op32) { if (zero.read() || (sign.read()!=overflow.read())) { condition=true; jump_16((short) reg0);} } else { if (zero.read() || (sign.read()!=overflow.read())) { condition=true; jump_32(reg0);} } break;
case OP_INT: intr(reg0,op32,addr32); break;
case OP_INT3: intr(reg0,op32,addr32); break;
case OP_IRET: reg0 = iret(op32,addr32); break;
//input/output
case OP_IN_08: reg0 = 0xff & ioports.ioPortReadByte(reg0); break;
case OP_IN_16_32: if (!op32) reg0 = 0xffff & ioports.ioPortReadWord(reg0);
else reg0 = ioports.ioPortReadLong(reg0);
break;
case OP_OUT_08: ioports.ioPortWriteByte(reg0, reg1); break;
case OP_OUT_16_32: if (!op32) ioports.ioPortWriteWord(reg0, reg1);
else ioports.ioPortWriteLong(reg0, reg1);
break;
//arithmetic
case OP_INC: reg0=reg0+1; break;
case OP_DEC: reg0=reg0-1; break;
case OP_ADD: reg2=reg0; reg0=reg2+reg1; break;
case OP_ADC: reg2=reg0; reg0=reg2+reg1+(carry.read()? 1:0); break;
case OP_SUB: reg2=reg0; reg0=reg2-reg1; break;
case OP_CMP: reg2=reg0; reg0=reg2-reg1; break;
case OP_SBB: reg2=reg0; reg0=reg2-reg1-(carry.read()? 1:0); break;
case OP_AND: reg0=reg0®1; break;
case OP_TEST: reg0=reg0®1; break;
case OP_OR: reg0=reg0|reg1; break;
case OP_XOR: reg0=reg0^reg1; break;
case OP_ROL_08: reg2=reg1&0x7; reg0=(reg0<<reg2)|(reg0>>>(8-reg2)); break;
case OP_ROL_16_32: if(!op32) {reg2=reg1&0xf; reg0=(reg0<<reg2)|(reg0>>>(16-reg2)); }
else {reg1=reg1&0x1f; reg0=(reg0<<reg1)|(reg0>>>(32-reg1)); }
break;
case OP_ROR_08: reg1=reg1&0x7; reg0=(reg0>>>reg1)|(reg0<<(8-reg1)); break;
case OP_ROR_16_32: if (!op32) {reg1=reg1&0xf; reg0=(reg0>>>reg1)|(reg0<<(16-reg1)); }
else {reg1=reg1&0x1f; reg0=(reg0>>>reg1)|(reg0<<(32-reg1));}
break;
case OP_RCL_08: reg1=reg1&0x1f; reg1=reg1%9; reg0=reg0|(carry.read()? 0x100:0); reg0=(reg0<<reg1)|(reg0>>>(9-reg1)); break;
case OP_RCL_16_32: if(!op32){reg1=reg1&0x1f; reg1=reg1%17; reg0=reg0|(carry.read()? 0x10000:0); reg0=(reg0<<reg1)|(reg0>>>(17-reg1)); }
else {reg1=reg1&0x1f; reg0l=(0xffffffffl®0)|(carry.read()? 0x100000000l:0); reg0=(int)(reg0l=(reg0l<<reg1)|(reg0l>>>(33-reg1))); }
break;
case OP_RCR_08: reg1=reg1&0x1f; reg1=reg1%9; reg0=reg0|(carry.read()? 0x100:0); reg2=(carry.read()^((reg0&0x80)!=0)? 1:0); reg0=(reg0>>>reg1)|(reg0<<(9-reg1)); break;
case OP_RCR_16_32:
if(!op32) { reg1=reg1&0x1f; reg1=reg1%17; reg2=(carry.read()^((reg0&0x8000)!=0)? 1:0); reg0=reg0|(carry.read()? 0x10000:0); reg0=(reg0>>>reg1)|(reg0<<(17-reg1)); }
else {reg1=reg1&0x1f; reg0l=(0xffffffffl®0)|(carry.read()? 0x100000000l:0); reg2=(carry.read()^((reg0&0x80000000)!=0)? 1:0); reg0=(int)(reg0l=(reg0l>>>reg1)|(reg0l<<(33-reg1))); }
break;
case OP_SHL: reg1 &= 0x1f; reg2 = reg0; reg0 <<= reg1; break;
case OP_SHR: reg1=reg1&0x1f; reg2=reg0; reg0=reg0>>>reg1; break;
case OP_SAR_08: reg1=reg1&0x1f; reg2=reg0; reg0=((byte)reg0)>>reg1; break;
case OP_SAR_16_32: if (!op32) {reg1=reg1&0x1f; reg2=reg0; reg0=((short)reg0)>>reg1; }
else { reg1=reg1&0x1f; reg2=reg0; reg0=reg0>>reg1; }
break;
case OP_NOT: reg0=~reg0; break;
case OP_NEG: reg0=-reg0; break;
case OP_MUL_08: mul_08(reg0); break;
case OP_MUL_16_32: if(!op32) mul_16(reg0); else mul_32(reg0); break;
case OP_IMULA_08: imula_08((byte)reg0); break;
case OP_IMULA_16_32: if(!op32) imula_16((short)reg0); else imula_32(reg0); break;
case OP_IMUL_16_32: if(!op32) reg0=imul_16((short)reg0, (short)reg1); else reg0=imul_32(reg0,reg1); break;
case OP_DIV_08: div_08(reg0); break;
case OP_DIV_16_32: if (!op32) div_16(reg0); else div_32(reg0); break;
case OP_IDIV_08: idiv_08((byte)reg0); break;
case OP_IDIV_16_32: if (!op32) idiv_16((short)reg0); else idiv_32(reg0); break;
case OP_SCASB:
case OP_SCASW:
{
int a;
if (!addr32)
a=edi.getValue()&0xffff;
else
a=edi.getValue();
int i,n;
if (microcode==MICROCODE.OP_SCASB)
{
i=0xff&es.loadByte(a);
n=1;
}
else if (!op32)
{
i=0xffff&es.loadWord(a);
n=2;
}
else
{
i=es.loadDoubleWord(a);
n=4;
}
if(direction.read())
a-=n;
else
a+=n;
if (!addr32)
edi.setValue((edi.getValue()&~0xffff)|(a&0xffff));
else
edi.setValue(a);
reg2=reg0;
if (microcode==MICROCODE.OP_SCASW && op32)
reg0=(int)((0xffffffffl®0)-(0xffffffffl&i));
else
reg0=reg0-i;
reg1=i;
}
break;
case OP_REPNE_SCASB:
case OP_REPE_SCASB:
case OP_REPNE_SCASW:
case OP_REPE_SCASW:
{
int count,a;
if(!op32)
count=ecx.getValue()&0xffff;
else
count=ecx.getValue();
if (!addr32)
a=edi.getValue()&0xffff;
else
a=edi.getValue();
boolean used=count!=0;
int input=0;
while(count!=0)
{
if (microcode==MICROCODE.OP_REPNE_SCASB || microcode==MICROCODE.OP_REPE_SCASB)
{
input=0xff&es.loadByte(a);
count--;
if(direction.read())
a-=1;
else
a+=1;
}
else if (!op32)
{
input=0xffff&es.loadWord(a);
count--;
if(direction.read())
a-=2;
else
a+=2;
}
else
{
input=es.loadDoubleWord(a);
count--;
if(direction.read())
a-=4;
else
a+=4;
}
if (microcode==MICROCODE.OP_REPNE_SCASB || microcode==MICROCODE.OP_REPNE_SCASW)
{
if(reg0==input) break;
}
else
{
if(reg0!=input) break;
}
}
if (!op32)
ecx.setValue((ecx.getValue()&~0xffff)|(count&0xffff));
else
ecx.setValue(count);
if (!addr32)
edi.setValue((edi.getValue()&~0xffff)|(a&0xffff));
else
edi.setValue(a);
reg2=reg0;
reg1=input;
reg0=used? 1:0;
}
break;
case OP_CMPSB:
case OP_CMPSW:
{
int addrOne,addrTwo;
if (!addr32)
{
addrOne=esi.getValue()&0xffff;
addrTwo=edi.getValue()&0xffff;
}
else
{
addrOne=esi.getValue();
addrTwo=edi.getValue();
}
int dataOne;
int dataTwo;
int n;
if (microcode==MICROCODE.OP_CMPSB)
{
dataOne=0xff&seg.loadByte(addrOne);
dataTwo=0xff&es.loadByte(addrTwo);
n=1;
}
else if (!op32)
{
dataOne=0xffff&seg.loadWord(addrOne);
dataTwo=0xffff&es.loadWord(addrTwo);
n=2;
}
else
{
dataOne=seg.loadDoubleWord(addrOne);
dataTwo=es.loadDoubleWord(addrTwo);
n=4;
}
if(direction.read())
{
addrOne-=n;
addrTwo-=n;
}
else
{
addrOne+=n;
addrTwo+=n;
}
if(!addr32)
{
esi.setValue((esi.getValue()&~0xffff)|(addrOne&0xffff));
edi.setValue((edi.getValue()&~0xffff)|(addrTwo&0xffff));
}
else
{
esi.setValue(addrOne);
edi.setValue(addrTwo);
}
reg2=dataOne;
reg1=dataTwo;
if(microcode==MICROCODE.OP_CMPSW && op32)
reg0=(int)((0xffffffffl&dataOne)-(0xffffffffl&dataTwo));
else
reg0=dataOne-dataTwo;
}
break;
case OP_REPNE_CMPSB:
case OP_REPE_CMPSB:
case OP_REPNE_CMPSW:
case OP_REPE_CMPSW:
{
int count,addrOne,addrTwo;
if(!op32)
count=ecx.getValue()&0xffff;
else
count=ecx.getValue();
if(!addr32)
{
addrOne=esi.getValue()&0xffff;
addrTwo=edi.getValue()&0xffff;
}
else
{
addrOne=esi.getValue();
addrTwo=edi.getValue();
}
boolean used=count!=0;
int dataOne=0;
int dataTwo=0;
while(count!=0)
{
if(microcode==MICROCODE.OP_REPE_CMPSB || microcode==MICROCODE.OP_REPNE_CMPSB)
{
dataOne=0xff&seg.loadByte(addrOne);
dataTwo=0xff&es.loadByte(addrTwo);
count--;
if(direction.read())
{
addrOne-=1;
addrTwo-=1;
}
else
{
addrOne+=1;
addrTwo+=1;
}
}
else if(!op32)
{
dataOne=0xffff&seg.loadWord(addrOne);
dataTwo=0xffff&es.loadWord(addrTwo);
count--;
if(direction.read())
{
addrOne-=2;
addrTwo-=2;
}
else
{
addrOne+=2;
addrTwo+=2;
}
}
else
{
dataOne=seg.loadDoubleWord(addrOne);
dataTwo=es.loadDoubleWord(addrTwo);
count--;
if(direction.read())
{
addrOne-=4;
addrTwo-=4;
}
else
{
addrOne+=4;
addrTwo+=4;
}
}
if (microcode==MICROCODE.OP_REPE_CMPSB || microcode==MICROCODE.OP_REPE_CMPSW)
{
if(dataOne!=dataTwo) break;
}
else
{
if(dataOne==dataTwo) break;
}
}
if(!op32)
ecx.setValue((ecx.getValue()&~0xffff)|(count&0xffff));
else
ecx.setValue(count);
if(!addr32)
{
esi.setValue((esi.getValue()&~0xffff)|(addrOne&0xffff));
edi.setValue((edi.getValue()&~0xffff)|(addrTwo&0xffff));
}
else
{
esi.setValue(addrOne);
edi.setValue(addrTwo);
}
reg0=used? 1:0;
reg1=dataTwo;
reg2=dataOne;
}
break;
case OP_BSF: reg0 = bsf(reg1, reg0); break;
case OP_BSR: reg0 = bsr(reg1, reg0); break;
case OP_BT_MEM: bt_mem(reg1, seg, addr); break;
case OP_BTS_MEM: bts_mem(reg1, seg, addr); break;
case OP_BTR_MEM: btr_mem(reg1, seg, addr); break;
case OP_BTC_MEM: btc_mem(reg1, seg, addr); break;
case OP_BT_16_32: if (!op32) {reg1 &= 0xf;} else {reg1&=0x1f;} carry.set(reg0, reg1, Flag.CY_NTH_BIT_SET); break;
case OP_BTS_16_32: if (!op32) {reg1 &= 0xf;} else {reg1&=0x1f;} carry.set(reg0, reg1, Flag.CY_NTH_BIT_SET); reg0 |= (1 << reg1); break;
case OP_BTR_16_32: if (!op32) {reg1 &= 0xf;} else {reg1&=0x1f;} carry.set(reg0, reg1, Flag.CY_NTH_BIT_SET); reg0 &= ~(1 << reg1); break;
case OP_BTC_16_32: if (!op32) {reg1 &= 0xf;} else {reg1&=0x1f;} carry.set(reg0, reg1, Flag.CY_NTH_BIT_SET); reg0 ^= (1 << reg1); break;
case OP_SHLD_16_32:
if (!op32)
{
int i = reg0;
reg2 &= 0x1f;
if (reg2 < 16)
{
reg0 = (reg0 << reg2) | (reg1 >>> (16 - reg2));
reg1 = reg2;
reg2 = i;
}
else
{
i = (reg1 & 0xFFFF) | (reg0 << 16);
reg0 = (reg1 << (reg2 - 16)) | ((reg0 & 0xFFFF) >>> (32 - reg2));
reg1 = reg2 - 15;
reg2 = i >> 1;
}
}
else
{
int i = reg0;
reg2 &= 0x1f;
if (reg2!=0)
reg0=(reg0<<reg2)|(reg1>>>(32-reg2));
reg1=reg2;
reg2=i;
} break;
case OP_SHRD_16_32:
if (!op32)
{
int i = reg0;
reg2 &= 0x1f;
if (reg2 < 16)
{
reg0 = (reg0 >>> reg2) | (reg1 << (16 - reg2));
reg1 = reg2;
reg2 = i;
}
else
{
i = (reg0 & 0xFFFF) | (reg1 << 16);
reg0 = (reg1 >>> (reg2 - 16)) | (reg0 << (32 - reg2));
reg1 = reg2;
reg2 = i;
}
}
else
{
int i = reg0;
reg2 &= 0x1f;
if(reg2 != 0)
reg0=(reg0>>>reg2)|(reg1<<(32-reg2));
reg1=reg2;
reg2=i;
} break;
case OP_CWD: if(!op32) { if ((eax.getValue() & 0x8000) == 0) edx.setValue(edx.getValue() & 0xffff0000); else edx.setValue(edx.getValue() | 0x0000ffff); }
else { if ((eax.getValue() & 0x80000000) == 0) edx.setValue(0); else edx.setValue(-1); }
break;
case OP_AAA: aaa(); break;
case OP_AAD: aad(reg0); break;
case OP_AAM: reg0 = aam(reg0); break;
case OP_AAS: aas(); break;
case OP_DAA: daa(); break;
case OP_DAS: das(); break;
case OP_BOUND:
{
if(!op32)
{
short lower = (short)reg0;
short upper = (short)(reg0 >> 16);
short index = (short)reg1;
if ((index < lower) || (index > (upper + 2)))
throw BOUND_RANGE;
}
} break;
//flag instructions
case OP_CLC: carry.clear(); break;
case OP_STC: carry.set(); break;
case OP_CLI: interruptEnable.clear(); interruptEnableSoon.clear(); break;
case OP_STI: interruptEnableSoon.set(); break;
case OP_CLD: direction.clear(); break;
case OP_STD: direction.set(); break;
case OP_CMC: carry.toggle(); break;
case OP_SETO: reg0 = overflow.read() ? 1 : 0; break;
case OP_SETNO: reg0 = overflow.read() ? 0 : 1; break;
case OP_SETC: reg0 = carry.read() ? 1 : 0; break;
case OP_SETNC: reg0 = carry.read() ? 0 : 1; break;
case OP_SETZ: reg0 = zero.read() ? 1 : 0; break;
case OP_SETNZ: reg0 = zero.read() ? 0 : 1; break;
case OP_SETNA: reg0 = carry.read() || zero.read() ? 1 : 0; break;
case OP_SETA: reg0 = carry.read() || zero.read() ? 0 : 1; break;
case OP_SETS: reg0 = sign.read() ? 1 : 0; break;
case OP_SETNS: reg0 = sign.read() ? 0 : 1; break;
case OP_SETP: reg0 = parity.read() ? 1 : 0; break;
case OP_SETNP: reg0 = parity.read() ? 0 : 1; break;
case OP_SETL: reg0 = sign.read() != overflow.read() ? 1 : 0; break;
case OP_SETNL: reg0 = sign.read() != overflow.read() ? 0 : 1; break;
case OP_SETNG: reg0 = zero.read() || (sign.read() != overflow.read()) ? 1 : 0; break;
case OP_SETG: reg0 = zero.read() || (sign.read() != overflow.read()) ? 0 : 1; break;
case OP_SALC: reg0 = carry.read() ? -1 : 0; break;
case OP_CMOVO: if(overflow.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVNO: if(!overflow.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVC: if(carry.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVNC: if(!carry.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVZ: if(zero.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVNZ: if(!zero.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVNA: if((carry.read()||(zero.read()))) { condition=true; reg0=reg1; } break;
case OP_CMOVA: if(!(carry.read()||(zero.read()))) { condition=true; reg0=reg1; } break;
case OP_CMOVS: if(sign.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVNS: if(!sign.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVP: if(parity.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVNP: if(!parity.read()) { condition=true; reg0=reg1; } break;
case OP_CMOVL: if((sign.read() != overflow.read())) { condition=true; reg0=reg1; } break;
case OP_CMOVNL: if(!(sign.read() != overflow.read())) { condition=true; reg0=reg1; } break;
case OP_CMOVNG: if((zero.read() || (sign.read() != overflow.read()))) { condition=true; reg0=reg1; } break;
case OP_CMOVG: if(!(zero.read() || (sign.read() != overflow.read()))) { condition=true; reg0=reg1; } break;
case OP_LAHF: lahf(); break;
case OP_SAHF: sahf(); break;
//stack instructions
case OP_POP:
if(!op32 && !addr32)
{
reg0 = ss.loadWord(esp.getValue()&0xffff);
esp.setValue((esp.getValue()&~0xffff) | ((esp.getValue()+2)&0xffff));
}
else if (!op32 && addr32)
{
reg0 = ss.loadWord(esp.getValue());
esp.setValue((esp.getValue()+2));
}
else if (op32 && !addr32)
{
reg0 = ss.loadDoubleWord(esp.getValue()&0xffff);
esp.setValue((esp.getValue()&~0xffff) | ((esp.getValue()+4)&0xffff));
}
else
{
reg0 = ss.loadDoubleWord(esp.getValue()&0xffffffff);
esp.setValue((esp.getValue()&~0xffff) | ((esp.getValue()+4)&0xffff));
}
if (code[codesHandled]==MICROCODE.STORE0_SS)
interruptEnable.clear();
break;
case OP_POPF:
if (isModeReal())
{
if (!op32 && !addr32)
{
reg0 = ss.loadWord(esp.getValue()&0xffff);
esp.setValue((esp.getValue()&~0xffff)|((esp.getValue()+2)&0xffff));
}
else if (op32 && !addr32)
{
reg0 = (getFlags()&0x20000)|(ss.loadDoubleWord(esp.getValue()&0xffff)&~0x1a0000);
esp.setValue((esp.getValue()&~0xffff)|((esp.getValue()+4)&0xffff));
}
else if (!op32 && addr32)
{
reg0 = ss.loadWord(esp.getValue());
esp.setValue(esp.getValue()+2);
}
else if (op32 && addr32)
{
reg0 = (getFlags()&0x20000)|(ss.loadDoubleWord(esp.getValue())&~0x1a0000);
esp.setValue(esp.getValue()+4);
}
}
else
{
int flagPrivilegeLevel=(ioPrivilegeLevel1.value?2:0)+(ioPrivilegeLevel0.value?1:0);
if (!op32 && !addr32)
{
reg0 = ss.loadWord(esp.getValue()&0xffff);
esp.setValue((esp.getValue()&~0xffff)|((esp.getValue()+2)&0xffff));
if (current_privilege_level>0)
{
if (current_privilege_level>flagPrivilegeLevel)
reg0=(getFlags()&0x3200)|(reg0&~0x3200);
else
reg0=(getFlags()&0x3000)|(reg0&~0x3000);
}
}
else if (!op32 && addr32)
{
reg0 = ss.loadWord(esp.getValue());
esp.setValue(esp.getValue()+2);
if (current_privilege_level>0)
{
if (current_privilege_level>flagPrivilegeLevel)
reg0=(getFlags()&0x3200)|(reg0&~0x3200);
else
reg0=(getFlags()&0x3000)|(reg0&~0x3000);
}
}
else if (op32 && !addr32)
{
reg0 = ss.loadDoubleWord(esp.getValue()&0xffff);
esp.setValue((esp.getValue()&~0xffff)|((esp.getValue()+4)&0xffff));
if (current_privilege_level>0)
{
if (current_privilege_level>flagPrivilegeLevel)
reg0=(getFlags()&0x23200)|(reg0&~(0x23200|0x180000));
else
reg0=(getFlags()&0x23000)|(reg0&~(0x23000|0x180000));
}
else
reg0=(getFlags()&0x20000)|(reg0&~(0x20000|0x180000));
}
else if (op32 && addr32)
{
reg0 = ss.loadDoubleWord(esp.getValue());
esp.setValue(esp.getValue()+4);
if (current_privilege_level>0)
{
if (current_privilege_level>flagPrivilegeLevel)
reg0=(getFlags()&0x23200)|(reg0&~(0x23200|0x180000));
else
reg0=(getFlags()&0x23000)|(reg0&~(0x23000|0x180000));
}
else
reg0=(getFlags()&0x20000)|(reg0&~(0x20000|0x180000));
}
}
break;
case OP_PUSH: if(!op32) push_16((short)reg0,addr32); else push_32(reg0,addr32); break;
case OP_PUSHF: if(!op32) push_16((short)reg0,addr32); else push_32(~0x30000®0,addr32); break;
case OP_PUSHA: if(!op32) pusha(); else pushad(); break;
case OP_POPA: if(!op32) popa(); else popad(); break;
case OP_SIGN_EXTEND: if(!op32) reg0 = 0xffff & ((byte)reg0); else reg0 = ((short)reg0); break;
case OP_SIGN_EXTEND_8_16: reg0 = 0xffff & ((byte)reg0); break;
case OP_SIGN_EXTEND_8_32: if(op32) reg0 = ((byte)reg0); break;
case OP_SIGN_EXTEND_16_32: if(op32) reg0 = ((short)reg0); break;
case OP_INSB: ins(reg0,1,addr32); break;
case OP_INSW: ins(reg0,op32?4:2,addr32); break;
case OP_REP_INSB: rep_ins(reg0,1,addr32); break;
case OP_REP_INSW: rep_ins(reg0,op32?4:2,addr32); break;
case OP_LODSB: lods(seg,1,addr32); break;
case OP_LODSW: lods(seg,op32?4:2,addr32); break;
case OP_REP_LODSB: rep_lods(seg,1,addr32); break;
case OP_REP_LODSW: rep_lods(seg,op32?4:2,addr32); break;
case OP_MOVSB: movs(seg,1,addr32); break;
case OP_MOVSW: movs(seg,op32?4:2,addr32); break;
case OP_REP_MOVSB: rep_movs(seg,1,addr32); break;
case OP_REP_MOVSW: rep_movs(seg,op32?4:2,addr32); break;
case OP_OUTSB: outs(reg0, seg, 1,addr32); break;
case OP_OUTSW: outs(reg0, seg, op32?4:2,addr32); break;
case OP_REP_OUTSB: rep_outs(reg0, seg, 1,addr32); break;
case OP_REP_OUTSW: rep_outs(reg0, seg, op32?4:2,addr32); break;
case OP_STOSB: stos(reg0,1,addr32); break;
case OP_STOSW: stos(reg0,op32?4:2,addr32); break;
case OP_REP_STOSB: rep_stos(reg0,1,addr32); break;
case OP_REP_STOSW: rep_stos(reg0,op32?4:2,addr32); break;
case OP_LOOP_CX:
if (!op32) { ecx.setValue((ecx.getValue() & ~0xffff) | ((ecx.getValue() - 1) & 0xffff)); if ((0xffff & ecx.getValue()) != 0) jump_08((byte)reg0); }
else {ecx.setValue(ecx.getValue()-1); if (ecx.getValue() != 0) jump_08((byte)reg0); }break;
case OP_LOOPZ_CX: if(!op32){ecx.setValue((ecx.getValue() & ~0xffff) | ((ecx.getValue() - 1) & 0xffff)); if (((0xffff & ecx.getValue()) != 0) && zero.read()) jump_08((byte)reg0); }
else { ecx.setValue(ecx.getValue()-1); if ((ecx.getValue() != 0) && zero.read()) jump_08((byte)reg0); } break;
case OP_LOOPNZ_CX: if(!op32){ecx.setValue((ecx.getValue() & ~0xffff) | ((ecx.getValue() - 1) & 0xffff)); if (((0xffff & ecx.getValue()) != 0) && !zero.read()) jump_08((byte)reg0);}
else{ecx.setValue(ecx.getValue()-1); if ((ecx.getValue() != 0) && !zero.read()) jump_08((byte)reg0);} break;
case OP_JCXZ: if(!op32) jcxz((byte)reg0); else jecxz((byte)reg0); break;
case OP_HALT: waitForInterrupt(); break;
case OP_CPUID: cpuid(); break;
case OP_LGDT:
gdtr.memory=linearMemory;
gdtr.setDescriptorValue(op32? reg1:(reg1&0x00ffffff),reg0);
System.out.printf("New GDT starts at %x\n", gdtr.getBase());
break;
case OP_LIDT:
idtr.memory=linearMemory;
idtr.setDescriptorValue(op32? reg1:(reg1&0x00ffffff),reg0);
break;
case OP_SGDT: if (op32) reg1=gdtr.getBase(); else reg1=gdtr.getBase()&0x00ffffff; reg0=gdtr.getLimit(); break;
case OP_SIDT: if (op32) reg1=idtr.getBase(); else reg1=idtr.getBase()&0x00ffffff; reg0=gdtr.getLimit(); break;
case OP_SMSW: reg0 = cr0.getValue() & 0xffff; break;
case OP_LMSW: setCR0((cr0.getValue()&~0xf)|(reg0&0xf)); break;
case OP_SLDT: reg0=0xffff&ldtr.getBase(); break;
case OP_STR: reg0=0xffff&tss.getBase(); break;
case OP_LLDT: ldtr.setProtectedValue(reg0&~0x4); System.out.printf("New LDT starts at %x\n",ldtr.getBase()); break;
case OP_LTR: tss.setProtectedValue(reg0); System.out.printf("New TSS starts at %x\n",tss.getBase()); break;
case OP_CLTS: setCR3(cr3.getValue()&~0x4); break;
case OP_RDTSC: long tsc = rdtsc(); reg0=(int)tsc; reg1=(int)(tsc>>>32); break;
case OP_NOP: break;
case OP_MOV: break;
case OP_FLOAT_NOP: break;
//prefices
case PREFIX_LOCK: case PREFIX_REPNE: case PREFIX_REPE: case PREFIX_CS: case PREFIX_SS: case PREFIX_DS: case PREFIX_ES: case PREFIX_FS: case PREFIX_GS: case PREFIX_OPCODE_32BIT: case PREFIX_ADDRESS_32BIT: break;
//flag setting commands
case FLAG_BITWISE_08: bitwise_flags((byte)reg0); break;
case FLAG_BITWISE_16: bitwise_flags((short)reg0); break;
case FLAG_BITWISE_32: bitwise_flags(reg0); break;
case FLAG_SUB_08: sub_flags_08(reg0, reg2, reg1); break;
case FLAG_SUB_16: sub_flags_16(reg0, reg2, reg1); break;
case FLAG_SUB_32: sub_flags_32(reg0l, reg2, reg1); break;
case FLAG_REP_SUB_08: rep_sub_flags_08(reg0, reg2, reg1); break;
case FLAG_REP_SUB_16: rep_sub_flags_16(reg0, reg2, reg1); break;
case FLAG_REP_SUB_32: rep_sub_flags_32(reg0, reg2, reg1); break;
case FLAG_ADD_08: add_flags_08(reg0, reg2, reg1); break;
case FLAG_ADD_16: add_flags_16(reg0, reg2, reg1); break;
case FLAG_ADD_32: add_flags_32(reg0l, reg2, reg1); break;
case FLAG_ADC_08: adc_flags_08(reg0, reg2, reg1); break;
case FLAG_ADC_16: adc_flags_16(reg0, reg2, reg1); break;
case FLAG_ADC_32: adc_flags_32(reg0l, reg2, reg1); break;
case FLAG_SBB_08: sbb_flags_08(reg0, reg2, reg1); break;
case FLAG_SBB_16: sbb_flags_16(reg0, reg2, reg1); break;
case FLAG_SBB_32: sbb_flags_32(reg0l, reg2, reg1); break;
case FLAG_DEC_08: dec_flags_08((byte)reg0); break;
case FLAG_DEC_16: dec_flags_16((short)reg0); break;
case FLAG_DEC_32: dec_flags_32(reg0); break;
case FLAG_INC_08: inc_flags_08((byte)reg0); break;
case FLAG_INC_16: inc_flags_16((short)reg0); break;
case FLAG_INC_32: inc_flags_32(reg0); break;
case FLAG_SHL_08: shl_flags_08((byte)reg0, (byte)reg2, reg1); break;
case FLAG_SHL_16: shl_flags_16((short)reg0, (short)reg2, reg1); break;
case FLAG_SHL_32: shl_flags_32(reg0, reg2, reg1); break;
case FLAG_SHR_08: shr_flags_08((byte)reg0, reg2, reg1); break;
case FLAG_SHR_16: shr_flags_16((short)reg0, reg2, reg1); break;
case FLAG_SHR_32: shr_flags_32(reg0, reg2, reg1); break;
case FLAG_SAR_08: sar_flags((byte)reg0, (byte)reg2, reg1); break;
case FLAG_SAR_16: sar_flags((short)reg0, (short)reg2, reg1); break;
case FLAG_SAR_32: sar_flags(reg0, reg2, reg1); break;
case FLAG_RCL_08: rcl_flags_08(reg0, reg1); break;
case FLAG_RCL_16: rcl_flags_16(reg0, reg1); break;
case FLAG_RCL_32: rcl_flags_32(reg0l, reg1); break;
case FLAG_RCR_08: rcr_flags_08(reg0, reg1, reg2); break;
case FLAG_RCR_16: rcr_flags_16(reg0, reg1, reg2); break;
case FLAG_RCR_32: rcr_flags_32(reg0l, reg1, reg2); break;
case FLAG_ROL_08: rol_flags_08((byte)reg0, reg1); break;
case FLAG_ROL_16: rol_flags_16((short)reg0, reg1); break;
case FLAG_ROL_32: rol_flags_32(reg0, reg1); break;
case FLAG_ROR_08: ror_flags_08((byte)reg0, reg1); break;
case FLAG_ROR_16: ror_flags_16((short)reg0, reg1); break;
case FLAG_ROR_32: ror_flags_32(reg0, reg1); break;
case FLAG_NEG_08: neg_flags_08((byte)reg0); break;
case FLAG_NEG_16: neg_flags_16((short)reg0); break;
case FLAG_NEG_32: neg_flags_32(reg0); break;
case FLAG_NONE: break;
case FLAG_FLOAT_NOP: break;
//errors
case OP_BAD: panic("Bad microcode");
case OP_UNIMPLEMENTED: panic("Unimplemented microcode");
default: System.out.println(microcode); panic("Unhandled microcode");
}
if(processorGUICode!=null) processorGUICode.pushMicrocode(microcode,reg0,reg1,reg2,addr,displacement,condition);
}
}
catch (Processor_Exception e)
{
handleProcessorException(e);
}
}
private void jump_08(byte offset)
{
int pc = eip.getValue();
pc=pc+offset;
eip.setValue(pc);
//check whether we're out of range
/* if ((pc & 0xffff0000) != 0)
{
eip.setValue(eip.getValue() - offset);
throw GENERAL_PROTECTION;
}
*/
}
private void jump_16(short offset)
{
eip.setValue((eip.getValue()+offset)&0xffff);
}
private void jump_32(int offset)
{
int pc = eip.getValue();
pc=pc+offset;
eip.setValue(pc);
/* //check whether we're out of range
if ((pc & 0xffff0000) != 0)
{
eip.setValue(eip.getValue() - offset);
throw GENERAL_PROTECTION;
}
*/
}
private void call(int target, boolean op32, boolean addr32)
{
int sp=esp.getValue();
int pc=eip.getValue();
// if (((sp&0xffff)<2)&&((sp&0xffff)>0))
// throw STACK_SEGMENT;
if (!op32 && !addr32)
{
int offset = (sp-2)&0xffff;
ss.storeWord(offset, (short)pc);
esp.setValue((sp & 0xffff0000) | offset);
eip.setValue((pc+target)&0xffff);
}
else if (op32 && !addr32)
{
int offset = (sp-4)&0xffff;
ss.storeDoubleWord(offset, pc);
esp.setValue((sp & 0xffff0000) | offset);
eip.setValue(pc+target);
}
else if (!op32 && addr32)
{
int offset = (sp-2);
ss.storeWord(offset, (short)pc);
esp.setValue(offset);
eip.setValue((pc+target)&0xffff);
}
else
{
int offset = (sp-4);
ss.storeDoubleWord(offset, pc);
esp.setValue(offset);
eip.setValue(pc+target);
}
}
private void ret(boolean op32, boolean addr32)
{
int sp=esp.getValue();
if(!op32 && !addr32)
{
eip.setValue(ss.loadWord(sp&0xffff)&0xffff);
esp.setValue((sp&~0xffff)|((sp+2)&0xffff));
}
else if (op32 && !addr32)
{
eip.setValue(ss.loadDoubleWord(sp&0xffff));
esp.setValue((sp&~0xffff)|((sp+4)&0xffff));
}
else if (!op32 && addr32)
{
eip.setValue(ss.loadWord(sp)&0xffff);
esp.setValue(sp+2);
}
else
{
eip.setValue(ss.loadDoubleWord(sp));
esp.setValue(sp+4);
}
}
private void ret_iw(short data, boolean op32, boolean addr32)
{
ret(op32,addr32);
int sp=esp.getValue();
if (!addr32)
esp.setValue((sp&~0xffff)|((sp+data)&0xffff));
else
esp.setValue(sp+data);
}
private void ret_far(boolean op32, boolean addr32)
{
int sp=esp.getValue();
if (!op32 && !addr32)
{
eip.setValue(ss.loadWord(sp&0xffff)&0xffff);
cs.setValue(ss.loadWord((sp+2)&0xffff)&0xffff);
esp.setValue((sp&~0xffff)|((sp+4)&0xffff));
}
else if (!op32 && addr32)
{
eip.setValue(ss.loadWord(sp)&0xffff);
cs.setValue(ss.loadWord((sp+2))&0xffff);
esp.setValue(sp+4);
}
else if (op32 && !addr32)
{
eip.setValue(ss.loadWord(sp&0xffff));
cs.setValue(ss.loadWord((sp+4)&0xffff));
esp.setValue((sp&~0xffff)|((sp+8)&0xffff));
}
else
{
eip.setValue(ss.loadWord(sp));
cs.setValue(ss.loadWord((sp+4)));
esp.setValue(sp+8);
}
if (!isModeReal())
{
if (cs.rpl<current_privilege_level)
throw GENERAL_PROTECTION;
// current_privilege_level=cs.rpl;
setCPL(cs.rpl);
}
}
private void ret_far_iw(short data, boolean op32, boolean addr32)
{
ret_far(op32,addr32);
int sp=esp.getValue();
if (!addr32)
esp.setValue((sp&~0xffff)|((sp+data)&0xffff));
else
esp.setValue(sp+data);
}
private void push_16(short data, boolean addr32)
{
int sp=esp.getValue();
if (((sp&0xffff)<2)&&((sp&0xffff)>0))
throw STACK_SEGMENT;
if (!addr32)
{
int offset=(sp-2)&0xffff;
ss.storeWord(offset,data);
esp.setValue((sp&~0xffff)|offset);
}
else
{
int offset=(sp-2);
ss.storeWord(offset,data);
esp.setValue(offset);
}
}
private void push_32(int data, boolean addr32)
{
int sp=esp.getValue();
if (((sp&0xffff)<4)&&((sp&0xffff)>0))
throw STACK_SEGMENT;
if (!addr32)
{
int offset=(sp-4)&0xffff;
ss.storeDoubleWord(offset,data);
esp.setValue((sp&~0xffff)|offset);
}
else
{
int offset=(sp-4);
ss.storeDoubleWord(offset,data);
esp.setValue(offset);
}
}
private void jump_far(int ip, int segment)
{
eip.setValue(ip);
cs.setValue(segment);
if (!isModeReal())
{
if (cs.dpl<current_privilege_level)
throw GENERAL_PROTECTION;
cs.rpl=current_privilege_level;
}
}
private void call_far(int ip, int segment, boolean op32, boolean addr32)
{
int sp=esp.getValue();
if (!op32 && !addr32)
if (((sp&0xffff)<4)&&((sp&0xffff)>0))
throw STACK_SEGMENT;
else if (!op32 && addr32)
if (sp<4 && sp>0)
throw STACK_SEGMENT;
else if (op32 && !addr32)
if (((sp&0xffff)<8)&&((sp&0xffff)>0))
throw STACK_SEGMENT;
else
if (sp<8 && sp>0)
throw STACK_SEGMENT;
if (!op32 && !addr32)
{
ss.storeWord((sp-2)&0xffff, (short)cs.getValue());
ss.storeWord((sp-4)&0xffff, (short)eip.getValue());
esp.setValue((sp&~0xffff)|((sp-4)&0xffff));
}
else if (!op32 && addr32)
{
ss.storeWord((sp-2), (short)cs.getValue());
ss.storeWord((sp-4), (short)eip.getValue());
esp.setValue(sp-4);
}
else if (op32 && !addr32)
{
ss.storeDoubleWord((sp-4)&0xffff, 0xffff&cs.getValue());
ss.storeDoubleWord((sp-8)&0xffff, eip.getValue());
esp.setValue((sp&~0xffff)|((sp-8)&0xffff));
}
else
{
ss.storeDoubleWord((sp-4), 0xffff&cs.getValue());
ss.storeDoubleWord((sp-8), eip.getValue());
esp.setValue(sp-8);
}
eip.setValue(ip);
cs.setValue(segment);
if (!isModeReal())
{
if (cs.dpl<current_privilege_level)
throw GENERAL_PROTECTION;
cs.rpl=current_privilege_level;
}
}
private void jcxz(byte offset)
{
if ((ecx.getValue() & 0xffff) == 0) jump_08(offset);
}
private void jecxz(byte offset)
{
if (ecx.getValue() == 0) jump_08(offset);
}
private void enter(int frameSize, int nestingLevel, boolean op32, boolean addr32)
{
if (op32||addr32) { panic("Implement enter 32"); }
nestingLevel %= 32;
int tempESP = esp.getValue();
int tempEBP = ebp.getValue();
tempESP = (tempESP & ~0xffff) | ((tempESP - 2) & 0xffff);
ss.storeWord(tempESP & 0xffff, (short)tempEBP);
int frameTemp = tempESP & 0xffff;
if (nestingLevel != 0)
{
while (--nestingLevel != 0)
{
tempEBP = (tempEBP & ~0xffff) | ((tempEBP - 2) & 0xffff);
tempESP = (tempESP & ~0xffff) | ((tempESP - 2) & 0xffff);
ss.storeWord(tempESP & 0xffff, ss.loadWord(tempEBP & 0xffff));
}
tempESP = (tempESP & ~0xffff) | ((tempESP - 2) & 0xffff);
ss.storeWord(tempESP & 0xffff, (short)frameTemp);
}
ebp.setValue((tempEBP & ~0xffff) | (frameTemp & 0xffff));
esp.setValue((tempESP & ~0xffff) | ((tempESP - frameSize -2*nestingLevel) & 0xffff));
}
private void leave(boolean op32, boolean addr32)
{
if (!op32 && !addr32)
{
int tempESP = (esp.getValue() & ~0xffff) | (ebp.getValue() & 0xffff);
int tempEBP = (ebp.getValue() & ~0xffff) | (ss.loadWord(tempESP & 0xffff) & 0xffff);
// if (((tempESP & 0xffff) > 0xffff) || ((tempESP & 0xffff) < 0)) {
// throw GENERAL_PROTECTION;
// }
esp.setValue((tempESP & ~0xffff) | ((tempESP + 2) & 0xffff));
ebp.setValue(tempEBP);
}
else if (op32 && !addr32)
{
int tempESP = (ebp.getValue() & 0xffff);
int tempEBP = ss.loadDoubleWord(tempESP);
esp.setValue((tempESP & ~0xffff) | ((tempESP+4) & 0xffff));
ebp.setValue(tempEBP);
}
else if (!op32 && addr32)
{
int tempESP=ebp.getValue()&0xffff;
int tempEBP=ss.loadWord(tempESP)&0xffff;
esp.setValue((esp.getValue()&~0xffff)|(tempESP+2));
ebp.setValue((ebp.getValue()&~0xffff)|(tempEBP));
}
else if (op32 && addr32)
{
int tempESP=ebp.getValue();
int tempEBP=ss.loadDoubleWord(tempESP);
esp.setValue(tempESP+4);
ebp.setValue(tempEBP);
}
}
private void pusha()
{
int offset = esp.getValue()&0xffff;
// if ((offset<16)&&((offset&1)==1)&&(offset<6))
// throw GENERAL_PROTECTION;
int temp = esp.getValue();
offset -= 2;
ss.storeWord(offset & 0xffff, (short) eax.getValue());
offset -= 2;
ss.storeWord(offset & 0xffff, (short) ecx.getValue());
offset -= 2;
ss.storeWord(offset & 0xffff, (short) edx.getValue());
offset -= 2;
ss.storeWord(offset & 0xffff, (short) ebx.getValue());
offset -= 2;
ss.storeWord(offset & 0xffff, (short) temp);
offset -= 2;
ss.storeWord(offset & 0xffff, (short) ebp.getValue());
offset -= 2;
ss.storeWord(offset & 0xffff, (short) esi.getValue());
offset -= 2;
ss.storeWord(offset & 0xffff, (short) edi.getValue());
esp.setValue((temp & ~0xffff) | (offset & 0xffff));
}
public void pushad()
{
int offset = esp.getValue()&0xffff;
// if ((offset<32)&&(offset>0))
// throw GENERAL_PROTECTION;
int temp = esp.getValue();
offset -= 4;
ss.storeDoubleWord(offset, eax.getValue());
offset -= 4;
ss.storeDoubleWord(offset, ecx.getValue());
offset -= 4;
ss.storeDoubleWord(offset, edx.getValue());
offset -= 4;
ss.storeDoubleWord(offset, ebx.getValue());
offset -= 4;
ss.storeDoubleWord(offset, temp);
offset -= 4;
ss.storeDoubleWord(offset, ebp.getValue());
offset -= 4;
ss.storeDoubleWord(offset, esi.getValue());
offset -= 4;
ss.storeDoubleWord(offset, edi.getValue());
esp.setValue((temp & ~0xffff) | (offset));
}
private void popa()
{
int offset = 0xffff & esp.getValue();
edi.setValue((edi.getValue() & ~0xffff) | (0xffff & ss.loadWord(0xffff & offset)));
offset += 2;
esi.setValue((esi.getValue() & ~0xffff) | (0xffff & ss.loadWord(0xffff & offset)));
offset += 2;
ebp.setValue((ebp.getValue() & ~0xffff) | (0xffff & ss.loadWord(0xffff & offset)));
offset += 4; //skip SP
ebx.setValue((ebx.getValue() & ~0xffff) | (0xffff & ss.loadWord(0xffff & offset)));
offset += 2;
edx.setValue((edx.getValue() & ~0xffff) | (0xffff & ss.loadWord(0xffff & offset)));
offset += 2;
ecx.setValue((ecx.getValue() & ~0xffff) | (0xffff & ss.loadWord(0xffff & offset)));
offset += 2;
eax.setValue((eax.getValue() & ~0xffff) | (0xffff & ss.loadWord(0xffff & offset)));
offset += 2;
esp.setValue((esp.getValue() & ~0xffff) | (offset & 0xffff));
}
public void popad()
{
int offset = 0xffff & esp.getValue();
edi.setValue(ss.loadDoubleWord(0xffff & offset));
offset += 4;
esi.setValue(ss.loadDoubleWord(0xffff & offset));
offset += 4;
ebp.setValue(ss.loadDoubleWord(0xffff & offset));
offset += 8; //skip SP
ebx.setValue(ss.loadDoubleWord(0xffff & offset));
offset += 4;
edx.setValue(ss.loadDoubleWord(0xffff & offset));
offset += 4;
ecx.setValue(ss.loadDoubleWord(0xffff & offset));
offset += 4;
eax.setValue(ss.loadDoubleWord(0xffff & offset));
offset += 4;
esp.setValue((esp.getValue() & ~0xffff) | (offset & 0xffff));
}
private final void call_abs(int target, boolean op32, boolean addr32)
{
int sp=esp.getValue();
if (!op32 && !addr32)
{
if (((sp & 0xffff) < 2) && ((sp & 0xffff) > 0))
throw STACK_SEGMENT;
ss.storeWord((sp - 2) & 0xffff, (short)eip.getValue());
esp.setValue(sp-2);
}
else if (!op32 && addr32)
{
if (sp< 2 && sp > 0)
throw STACK_SEGMENT;
ss.storeWord((sp - 2), (short)eip.getValue());
esp.setValue((sp&0xffff0000)|((sp-2)&0xffff));
}
else if (op32 && !addr32)
{
if (((sp & 0xffff) < 4) && ((sp & 0xffff) > 0))
throw STACK_SEGMENT;
ss.storeDoubleWord((sp - 4) & 0xffff, eip.getValue());
esp.setValue((sp&0xffff0000)|((sp-4)&0xffff));
}
else
{
if (sp < 4 && sp > 0)
throw STACK_SEGMENT;
ss.storeDoubleWord((sp - 4), eip.getValue());
esp.setValue(sp-4);
}
eip.setValue(target);
}
private void intr(int vector, boolean op32, boolean addr32)
{
if (vector == 0)
panic("INT 0 called");
if (((esp.getValue()&0xffff)<6)&&((esp.getValue()&0xffff)>0))
panic("No room on stack for interrupt");
if (!isModeReal())
{
intr_protected(vector,op32,addr32);
return;
}
if (!op32 && !addr32)
{
esp.setValue((esp.getValue() & 0xffff0000) | (0xffff & (esp.getValue() - 2)));
int flags = getFlags() & 0xffff;
ss.storeWord(esp.getValue() & 0xffff, (short)flags);
interruptEnable.clear();
interruptEnableSoon.clear();
trap.clear();
esp.setValue((esp.getValue()&0xffff0000)|(0xffff&(esp.getValue()-2)));
ss.storeWord(esp.getValue()&0xffff,(short)cs.getValue());
esp.setValue((esp.getValue()&0xffff0000)|(0xffff&(esp.getValue()-2)));
ss.storeWord(esp.getValue()&0xffff,(short)eip.getValue());
eip.setValue(0xffff & idtr.loadWord(4*vector));
cs.setValue(0xffff & idtr.loadWord(4*vector+2));
}
else if (op32 && !addr32)
{
esp.setValue((esp.getValue() & 0xffff0000) | (0xffff & (esp.getValue() - 4)));
int flags = getFlags();
ss.storeDoubleWord(esp.getValue() & 0xffff, flags);
interruptEnable.clear();
interruptEnableSoon.clear();
trap.clear();
esp.setValue((esp.getValue()&0xffff0000)|(0xffff&(esp.getValue()-4)));
ss.storeDoubleWord(esp.getValue()&0xffff,cs.getValue());
esp.setValue((esp.getValue()&0xffff0000)|(0xffff&(esp.getValue()-4)));
ss.storeDoubleWord(esp.getValue()&0xffff,eip.getValue());
eip.setValue(idtr.loadDoubleWord(8*vector));
cs.setValue(0xffff & idtr.loadDoubleWord(8*vector+4));
}
else if (!op32 && addr32)
{
esp.setValue(esp.getValue()-2);
int flags = getFlags() & 0xffff;
ss.storeWord(esp.getValue(), (short)flags);
interruptEnable.clear();
interruptEnableSoon.clear();
trap.clear();
esp.setValue(esp.getValue()-2);
ss.storeWord(esp.getValue(),(short)cs.getValue());
esp.setValue(esp.getValue()-2);
ss.storeWord(esp.getValue(),(short)eip.getValue());
eip.setValue(0xffff & idtr.loadWord(4*vector));
cs.setValue(0xffff & idtr.loadWord(4*vector+2));
}
else if (op32 && addr32)
{
esp.setValue(esp.getValue()-4);
int flags = getFlags();
ss.storeDoubleWord(esp.getValue(), flags);
interruptEnable.clear();
interruptEnableSoon.clear();
trap.clear();
esp.setValue(esp.getValue()-4);
ss.storeDoubleWord(esp.getValue(),cs.getValue());
esp.setValue(esp.getValue()-4);
ss.storeDoubleWord(esp.getValue(),eip.getValue());
eip.setValue(idtr.loadDoubleWord(8*vector));
cs.setValue(0xffff & idtr.loadDoubleWord(8*vector+4));
}
// System.out.printf("Software Interrupt %x\n",vector);
if(processorGUICode!=null) processorGUICode.push(GUICODE.SOFTWARE_INTERRUPT,vector);
}
private void intr_protected(int vector,boolean op32, boolean addr32)
{
int newIP=0, newCS=0;
int dpl;
long descriptor=0;
if (!op32 || !addr32)
panic("Only handling 32 bit mode protected interrupts");
//get the new CS:EIP from the IDT
boolean sup=linearMemory.isSupervisor;
linearMemory.setSupervisor(true);
vector=vector*8;
descriptor=idtr.loadQuadWord(vector);
int segIndex=(int)((descriptor>>16)&0xffff);
long newSegmentDescriptor=0;
if ((segIndex&4)!=0)
newSegmentDescriptor=ldtr.loadQuadWord(segIndex&0xfff8);
else
newSegmentDescriptor=gdtr.loadQuadWord(segIndex&0xfff8);
linearMemory.setSupervisor(sup);
dpl=(int)((newSegmentDescriptor>>45)&0x3);
newIP = (int)(((descriptor>>32)&0xffff0000)|(descriptor&0x0000ffff));
newCS = (int)((descriptor>>16)&0xffff);
int sesp = esp.getValue();
if (dpl<current_privilege_level)
{
//calculate new stack segment
int stackAddress=dpl*8+4;
int newSS=0xffff&(tss.loadWord(stackAddress+4));
int newSP=tss.loadDoubleWord(stackAddress);
int oldSS=ss.getValue();
int oldSP=esp.getValue();
ss.setValue(newSS);
esp.setValue(newSP);
//save SS:ESP on the stack
sesp=newSP;
sesp-=4;
ss.storeDoubleWord(sesp, oldSS);
sesp-=4;
ss.storeDoubleWord(sesp, oldSP);
}
//save the flags on the stack
sesp-=4;
int flags = getFlags();
ss.storeDoubleWord(esp.getValue(), flags);
//disable interrupts
interruptEnable.clear();
interruptEnableSoon.clear();
//save CS:IP on the stack
sesp-=4;
ss.storeDoubleWord(sesp, cs.getValue());
sesp-=4;
ss.storeDoubleWord(sesp, eip.getValue());
esp.setValue(sesp);
//change CS and IP to the ISR's values
cs.setProtectedValue(newCS,descriptor);
eip.setValue(newIP);
setCPL(dpl);
// current_privilege_level=dpl;
}
public int iret(boolean op32, boolean addr32)
{
if (!isModeReal())
{
return iret_protected(op32,addr32);
}
int flags=0;
if (!op32 && !addr32)
{
eip.setValue(ss.loadWord(esp.getValue()&0xffff)&0xffff);
esp.setValue((esp.getValue()&0xffff0000)|((esp.getValue()+2)&0xffff));
cs.setValue(ss.loadWord(esp.getValue()&0xffff)&0xffff);
esp.setValue((esp.getValue()&0xffff0000)|((esp.getValue()+2)&0xffff));
flags=(ss.loadWord(esp.getValue()&0xffff)&0xffff);
esp.setValue((esp.getValue()&0xffff0000)|((esp.getValue()+2)&0xffff));
}
else if (op32 && !addr32)
{
eip.setValue(ss.loadDoubleWord(esp.getValue()&0xffff));
esp.setValue((esp.getValue()&0xffff0000)|((esp.getValue()+4)&0xffff));
cs.setValue(ss.loadDoubleWord(esp.getValue()&0xffff)&0xffff);
esp.setValue((esp.getValue()&0xffff0000)|((esp.getValue()+4)&0xffff));
flags=(ss.loadDoubleWord(esp.getValue()&0xffff));
esp.setValue((esp.getValue()&0xffff0000)|((esp.getValue()+4)&0xffff));
}
else if (!op32 && addr32)
{
eip.setValue(ss.loadWord(esp.getValue())&0xffff);
esp.setValue(esp.getValue()+2);
cs.setValue(ss.loadWord(esp.getValue())&0xffff);
esp.setValue(esp.getValue()+2);
flags=(ss.loadWord(esp.getValue())&0xffff);
esp.setValue(esp.getValue()+2);
}
else
{
eip.setValue(ss.loadDoubleWord(esp.getValue()));
esp.setValue(esp.getValue()+4);
cs.setValue(ss.loadDoubleWord(esp.getValue())&0xffff);
esp.setValue(esp.getValue()+4);
flags=(ss.loadDoubleWord(esp.getValue()));
esp.setValue(esp.getValue()+4);
}
// System.out.println("Returning from interrupt");
return flags;
}
private int iret_protected(boolean op32, boolean addr32)
{
int flags=0;
eip.setValue(ss.loadDoubleWord(esp.getValue()));
esp.setValue(esp.getValue()+4);
cs.setValue(ss.loadDoubleWord(esp.getValue())&0xffff);
esp.setValue(esp.getValue()+4);
flags=(ss.loadDoubleWord(esp.getValue()));
esp.setValue(esp.getValue()+4);
if (cs.rpl>current_privilege_level)
{
int newSP=ss.loadDoubleWord(esp.getValue());
esp.setValue(esp.getValue()+4);
int newSS=ss.loadDoubleWord(esp.getValue());
esp.setValue(newSP);
ss.setValue(newSS);
setCPL(cs.rpl);
// current_privilege_level=cs.rpl;
}
return flags;
}
private void ins(int port, int b, boolean addr32)
{
if (!addr32)
{
int addr = edi.getValue() & 0xffff;
if (b==1)
es.storeByte(addr & 0xffff, (byte)ioports.ioPortReadByte(port));
else if (b==2)
es.storeWord(addr & 0xffff, (short)ioports.ioPortReadWord(port));
else
es.storeDoubleWord(addr & 0xffff, ioports.ioPortReadLong(port));
if (direction.read())
addr -= b;
else
addr += b;
edi.setValue((edi.getValue()&~0xffff)|(addr&0xffff));
}
else
{
int addr = edi.getValue();
if (b==1)
es.storeByte(addr, (byte)ioports.ioPortReadByte(port));
else if (b==2)
es.storeWord(addr, (short)ioports.ioPortReadWord(port));
else
es.storeDoubleWord(addr, ioports.ioPortReadLong(port));
if (direction.read())
addr -= b;
else
addr += b;
edi.setValue(addr);
}
}
private void rep_ins(int port, int b, boolean addr32)
{
if (!addr32)
{
int count = ecx.getValue() & 0xffff;
int addr = edi.getValue() & 0xffff;
while (count != 0)
{
if (b==1)
es.storeByte(addr & 0xffff, (byte)ioports.ioPortReadByte(port));
else if (b==2)
es.storeWord(addr & 0xffff, (short)ioports.ioPortReadWord(port));
else
es.storeDoubleWord(addr & 0xffff, ioports.ioPortReadLong(port));
count--;
if (direction.read())
addr -= b;
else
addr += b;
}
ecx.setValue((ecx.getValue() & ~0xffff) | (count & 0xffff));
edi.setValue((edi.getValue() & ~0xffff) | (addr & 0xffff));
}
else
{
int count = ecx.getValue();
int addr = edi.getValue();
while (count != 0)
{
if (b==1)
es.storeByte(addr, (byte)ioports.ioPortReadByte(port));
else if (b==2)
es.storeWord(addr, (short)ioports.ioPortReadWord(port));
else
es.storeDoubleWord(addr, ioports.ioPortReadLong(port));
count--;
if (direction.read())
addr -= b;
else
addr += b;
}
ecx.setValue(count);
edi.setValue(addr);
}
}
private void outs(int port, Segment seg, int b, boolean addr32)
{
if (!addr32)
{
int addr = esi.getValue() & 0xffff;
if (b==1)
ioports.ioPortWriteByte(port, 0xff & seg.loadByte(addr&0xffff));
else if (b==2)
ioports.ioPortWriteWord(port, 0xffff & seg.loadWord(addr&0xffff));
else
ioports.ioPortWriteLong(port, seg.loadDoubleWord(addr&0xffff));
if (direction.read())
addr -= b;
else
addr += b;
if (esi.getValue()==0x3ffff) System.out.println("outs addr16 "+esi.getValue()+" "+addr);
esi.setValue((esi.getValue()&~0xffff)|(addr&0xffff));
}
else
{
int addr = esi.getValue();
if (b==1)
ioports.ioPortWriteByte(port, 0xff & seg.loadByte(addr));
else if (b==2)
ioports.ioPortWriteWord(port, 0xffff & seg.loadWord(addr));
else
ioports.ioPortWriteLong(port, seg.loadDoubleWord(addr));
if (direction.read())
addr -= b;
else
addr += b;
if (esi.getValue()==0x3ffff) System.out.println("outs addr32 "+esi.getValue()+" "+addr);
esi.setValue(addr);
}
}
private void rep_outs(int port, Segment seg, int b, boolean addr32)
{
if (!addr32)
{
int count = ecx.getValue() & 0xffff;
int addr = esi.getValue() & 0xffff;
while (count != 0)
{
if (b==1)
ioports.ioPortWriteByte(port, 0xff & seg.loadByte(addr&0xffff));
else if (b==2)
ioports.ioPortWriteWord(port, 0xffff & seg.loadWord(addr&0xffff));
else
ioports.ioPortWriteLong(port, seg.loadDoubleWord(addr&0xffff));
count--;
if (direction.read())
addr -= b;
else
addr += b;
}
ecx.setValue((ecx.getValue() & ~0xffff) | (count & 0xffff));
esi.setValue((esi.getValue() & ~0xffff) | (addr & 0xffff));
}
else
{
int count = ecx.getValue();
int addr = esi.getValue();
while (count != 0)
{
if (b==1)
ioports.ioPortWriteByte(port, 0xff & seg.loadByte(addr));
else if (b==2)
ioports.ioPortWriteWord(port, 0xffff & seg.loadWord(addr));
else
ioports.ioPortWriteLong(port, seg.loadDoubleWord(addr));
count--;
if (direction.read())
addr -= b;
else
addr += b;
}
ecx.setValue(count);
esi.setValue(addr);
}
}
private void lods(Segment seg, int b, boolean addr32)
{
int addr;
if(!addr32)
addr = esi.getValue() & 0xffff;
else
addr = esi.getValue();
if (b==1)
eax.setValue((eax.getValue()&~0xff)|(0xff&seg.loadByte(addr)));
else if (b==2)
eax.setValue((eax.getValue()&~0xffff)|(0xffff&seg.loadWord(addr)));
else
eax.setValue(seg.loadDoubleWord(addr));
if(direction.read())
addr-=b;
else
addr+=b;
if(!addr32)
esi.setValue((esi.getValue()&~0xffff)|(addr&0xffff));
else
esi.setValue(addr);
}
private void rep_lods(Segment seg, int b, boolean addr32)
{
int count,addr,data;
if(!addr32)
{
count = ecx.getValue()&0xffff;
addr = esi.getValue()&0xffff;
}
else
{
count=ecx.getValue();
addr=esi.getValue();
}
if(b==1)
data = eax.getValue()&0xff;
else if (b==2)
data = eax.getValue()&0xffff;
else
data = eax.getValue();
while(count!=0)
{
if(!addr32)
{
if(b==1)
data=0xff&seg.loadByte(addr&0xffff);
else if (b==2)
data=0xffff&seg.loadWord(addr&0xffff);
else
data=seg.loadDoubleWord(addr&0xffff);
}
else
{
if(b==1)
data=0xff&seg.loadByte(addr);
else if (b==2)
data=0xffff&seg.loadWord(addr);
else
data=seg.loadDoubleWord(addr);
}
count--;
if (direction.read())
addr-=b;
else
addr+=b;
}
if (b==1)
eax.setValue((eax.getValue()&~0xff)|data);
else if (b==2)
eax.setValue((eax.getValue()&~0xffff)|data);
else
eax.setValue(data);
if(!addr32)
{
ecx.setValue((ecx.getValue()&~0xffff)|(count&0xffff));
esi.setValue((esi.getValue()&~0xffff)|(addr&0xffff));
}
else
{
ecx.setValue(count);
esi.setValue(addr);
}
}
private void movs(Segment seg, int b, boolean addr32)
{
int inaddr,outaddr;
if(!addr32)
{
inaddr = edi.getValue() & 0xffff;
outaddr = esi.getValue() & 0xffff;
}
else
{
inaddr = edi.getValue();
outaddr = esi.getValue();
}
if (b==1)
es.storeByte(inaddr, seg.loadByte(outaddr));
else if (b==2)
es.storeWord(inaddr, seg.loadWord(outaddr));
else
es.storeDoubleWord(inaddr, seg.loadDoubleWord(outaddr));
if(direction.read())
{
inaddr-=b;
outaddr-=b;
}
else
{
inaddr+=b;
outaddr+=b;
}
if(!addr32)
{
esi.setValue((esi.getValue()&~0xffff)|(outaddr&0xffff));
edi.setValue((edi.getValue()&~0xffff)|(inaddr&0xffff));
}
else
{
esi.setValue(outaddr);
edi.setValue(inaddr);
}
}
private void rep_movs(Segment seg, int b, boolean addr32)
{
int count,inaddr,outaddr;
if(!addr32)
{
count = ecx.getValue()&0xffff;
outaddr = esi.getValue()&0xffff;
inaddr = edi.getValue()&0xffff;
}
else
{
count=ecx.getValue();
outaddr=esi.getValue();
inaddr=edi.getValue();
}
while(count!=0)
{
if(!addr32)
{
if(b==1)
es.storeByte(inaddr&0xffff, seg.loadByte(outaddr&0xffff));
else if (b==2)
es.storeWord(inaddr&0xffff, seg.loadWord(outaddr&0xffff));
else
es.storeDoubleWord(inaddr&0xffff, seg.loadDoubleWord(outaddr&0xffff));
}
else
{
if(b==1)
es.storeByte(inaddr, seg.loadByte(outaddr));
else if (b==2)
es.storeWord(inaddr, seg.loadWord(outaddr));
else
es.storeDoubleWord(inaddr, seg.loadDoubleWord(outaddr));
}
count--;
if (direction.read())
{
inaddr-=b;
outaddr-=b;
}
else
{
inaddr+=b;
outaddr+=b;
}
}
if(!addr32)
{
ecx.setValue((ecx.getValue()&~0xffff)|(count&0xffff));
esi.setValue((esi.getValue()&~0xffff)|(outaddr&0xffff));
edi.setValue((edi.getValue()&~0xffff)|(inaddr&0xffff));
}
else
{
ecx.setValue(count);
esi.setValue(outaddr);
edi.setValue(inaddr);
}
}
private void stos(int data, int b, boolean addr32)
{
int addr;
if(!addr32)
addr = edi.getValue() & 0xffff;
else
addr = edi.getValue();
if (b==1)
es.storeByte(addr,(byte)data);
else if (b==2)
es.storeWord(addr,(short)data);
else
es.storeDoubleWord(addr,data);
if(direction.read())
addr-=b;
else
addr+=b;
if(!addr32)
edi.setValue((edi.getValue()&~0xffff)|(addr&0xffff));
else
edi.setValue(addr);
}
private void rep_stos(int data, int b, boolean addr32)
{
int count,addr;
if(!addr32)
{
count = ecx.getValue()&0xffff;
addr = edi.getValue()&0xffff;
}
else
{
count=ecx.getValue();
addr=edi.getValue();
}
while(count!=0)
{
if(!addr32)
{
if(b==1)
es.storeByte(addr&0xffff,(byte)data);
else if (b==2)
es.storeWord(addr&0xffff,(short)data);
else
es.storeDoubleWord(addr&0xffff,data);
}
else
{
if(b==1)
es.storeByte(addr,(byte)data);
else if (b==2)
es.storeWord(addr,(short)data);
else
es.storeDoubleWord(addr,data);
}
count--;
if (direction.read())
addr-=b;
else
addr+=b;
}
if(!addr32)
{
ecx.setValue((ecx.getValue()&~0xffff)|(count&0xffff));
edi.setValue((edi.getValue()&~0xffff)|(addr&0xffff));
}
else
{
ecx.setValue(count);
edi.setValue(addr);
}
}
private void mul_08(int data)
{
int x = eax.getValue()&0xff;
int result = x*data;
eax.setValue((eax.getValue()&0xffff0000)|(result&0xffff));
overflow.set(result, Flag.OF_HIGH_BYTE_NZ);
carry.set(result, Flag.CY_HIGH_BYTE_NZ);
}
private void mul_16(int data)
{
int x = eax.getValue()&0xffff;
int result = x*data;
eax.setValue((eax.getValue()&0xffff0000)|(result&0xffff));
result=result>>16;
edx.setValue((edx.getValue()&0xffff0000)|(result&0xffff));
overflow.set(result, Flag.OF_LOW_WORD_NZ);
carry.set(result, Flag.CY_LOW_WORD_NZ);
}
private void mul_32(int data)
{
long x = eax.getValue()&0xffffffffl;
long y = 0xffffffffl&data;
long result=x*y;
eax.setValue((int)result);
result=result>>>32;
edx.setValue((int)result);
overflow.set((int)result, Flag.OF_NZ);
carry.set((int)result, Flag.CY_NZ);
}
private void imula_08(byte data)
{
byte x = (byte)eax.getValue();
int result = x*data;
eax.setValue((eax.getValue()&~0xffff)|(result&0xffff));
overflow.set(result, Flag.OF_NOT_BYTE);
carry.set(result, Flag.CY_NOT_BYTE);
}
private void imula_16(short data)
{
short x = (short)eax.getValue();
int result = x*data;
eax.setValue((eax.getValue()&~0xffff)|(result&0xffff));
edx.setValue((edx.getValue()&~0xffff)|(result>>>16));
overflow.set(result, Flag.OF_NOT_SHORT);
carry.set(result, Flag.CY_NOT_SHORT);
}
private void imula_32(int data)
{
long eaxvalue = (long)eax.getValue();
long y=(long)data;
long result=eaxvalue*y;
eax.setValue((int)result);
edx.setValue((int)(result>>>32));
overflow.set(result,Flag.OF_NOT_INT);
carry.set(result,Flag.CY_NOT_INT);
}
private int imul_16(short data0, short data1)
{
int result = data0*data1;
overflow.set(result, Flag.OF_NOT_SHORT);
carry.set(result, Flag.CY_NOT_SHORT);
return result;
}
private int imul_32(int data0, int data1)
{
long result = ((long)data0)*((long)data1);
overflow.set(result, Flag.OF_NOT_SHORT);
carry.set(result, Flag.CY_NOT_SHORT);
return (int)result;
}
private void div_08(int data)
{
if(data==0)
throw DIVIDE_ERROR;
int x = (eax.getValue()&0xffff);
int result=x/data;
if (result>0xff)
throw DIVIDE_ERROR;
int remainder = (x%data)<<8;
eax.setValue((eax.getValue()&~0xffff)|(0xff&result)|(0xff00&remainder));
}
private void div_16(int data)
{
if(data==0)
throw DIVIDE_ERROR;
long x = (edx.getValue()&0xffffl);
x<<=16;
x|=(eax.getValue()&0xffffl);
long result=x/data;
if (result>0xffffl)
throw DIVIDE_ERROR;
long remainder = (x%data);
eax.setValue((eax.getValue()&~0xffff)|(int)(result&0xffff));
edx.setValue((edx.getValue()&~0xffff)|(int)(remainder&0xffff));
}
private void div_32(int data)
{
long d = 0xffffffffl&data;
if(d==0) throw DIVIDE_ERROR;
long t = (long)edx.getValue();
t<<=32;
t|=(0xffffffffl&eax.getValue());
long r2=t&1;
long n2=t>>>1;
long q2=n2/d;
long m2=n2%d;
long q=q2<<1;
long r=(m2<<1)+r2;
q+=(r/d);
r%=d;
if (q>0xffffffffl) throw DIVIDE_ERROR;
eax.setValue((int)q);
edx.setValue((int)r);
}
private void idiv_08(byte data)
{
if(data==0)
throw DIVIDE_ERROR;
short x = (short)eax.getValue();
int result=x/(short)data;
int remainder = (x%data);
if((result>Byte.MAX_VALUE)||(result<Byte.MIN_VALUE))
throw DIVIDE_ERROR;
eax.setValue((eax.getValue()&~0xffff)|(0xff&result)|((0xff&remainder)<<8));
}
private void idiv_16(short data)
{
if(data==0)
throw DIVIDE_ERROR;
int x = (edx.getValue()<<16) | (eax.getValue()&0xffff);
int result=x/(int)data;
int remainder = (x%data);
if((result>Short.MAX_VALUE)||(result<Short.MIN_VALUE))
throw DIVIDE_ERROR;
eax.setValue((eax.getValue()&~0xffff)|(0xffff&result));
edx.setValue((edx.getValue()&~0xffff)|(0xffff&remainder));
}
private void idiv_32(int data)
{
if(data==0) throw DIVIDE_ERROR;
long t=(0xffffffffl&edx.getValue())<<32;
t|=(0xffffffffl&eax.getValue());
long result=t/data;
if(result>Integer.MAX_VALUE || result<Integer.MIN_VALUE) throw DIVIDE_ERROR;
long r = t%data;
eax.setValue((int)result);
edx.setValue((int)r);
}
private void btc_mem(int offset, Segment seg, int addr)
{
addr+=(offset>>>3);
offset&=0x7;
int data=0xff&seg.loadByte(addr);
seg.storeByte(addr,(byte)(data^(1<<offset)));
carry.set(data,offset,Flag.CY_NTH_BIT_SET);
}
private void bts_mem(int offset, Segment seg, int addr)
{
addr+=(offset>>>3);
offset&=0x7;
int data=0xff&seg.loadByte(addr);
seg.storeByte(addr,(byte)(data|(1<<offset)));
carry.set(data,offset,Flag.CY_NTH_BIT_SET);
}
private void btr_mem(int offset, Segment seg, int addr)
{
addr+=(offset>>>3);
offset&=0x7;
int data=0xff&seg.loadByte(addr);
seg.storeByte(addr,(byte)(data&~(1<<offset)));
carry.set(data,offset,Flag.CY_NTH_BIT_SET);
}
private void bt_mem(int offset, Segment seg, int addr)
{
addr+=(offset>>>3);
offset&=0x7;
int data=0xff&seg.loadByte(addr);
carry.set(data,offset,Flag.CY_NTH_BIT_SET);
}
private int bsf(int source, int initial)
{
if (source == 0)
{
zero.set();
return initial;
}
else
{
zero.clear();
int y;
int i=source;
if (i==0) return 32;
int n=31;
y=i<<16; if (y!=0) {n-=16; i=y;}
y=i<<8; if (y!=0) {n-=8; i=y;}
y=i<<4; if (y!=0) {n-=4; i=y;}
y=i<<2; if (y!=0) {n-=2; i=y;}
return n-((i<<1)>>>31);
}
}
private int bsr(int source, int initial)
{
if (source==0)
{
zero.set();
return initial;
}
else
{
zero.clear();
int i=source;
if (i == 0) return -1;
int n=1;
if (i >>> 16 == 0) { n += 16; i <<= 16; }
if (i >>> 24 == 0) { n += 8; i <<= 8; }
if (i >>> 28 == 0) { n += 4; i <<= 4; }
if (i >>> 30 == 0) { n += 2; i <<= 2; }
n-=i>>>31;
return 31-n;
}
}
private void aaa()
{
if (((eax.getValue() & 0xf) > 0x9) || auxiliaryCarry.read())
{
int alCarry = ((eax.getValue() & 0xff) > 0xf9) ? 0x100 : 0x000;
eax.setValue((0xffff0000 & eax.getValue()) | (0x0f & (eax.getValue() + 6)) | (0xff00 & (eax.getValue() + 0x100 + alCarry)));
auxiliaryCarry.set();
carry.set();
}
else
{
auxiliaryCarry.clear();
carry.clear();
eax.setValue(eax.getValue()&0xffffff0f);
}
}
private void aad(int base)
{
int tl = (eax.getValue() & 0xff);
int th = ((eax.getValue() >> 8) & 0xff);
int ax1 = th * base;
int ax2 = ax1 + tl;
eax.setValue((eax.getValue() & ~0xffff) | (ax2 & 0xff));
zero.set((byte)ax2);
parity.set((byte)ax2);
sign.set((byte)ax2);
auxiliaryCarry.set(ax1, ax2, Flag.AC_BIT4_NEQ);
carry.set(ax2, Flag.CY_GREATER_FF);
overflow.set(ax2, tl, Flag.OF_BIT7_DIFFERENT);
}
private int aam(int base)
{
int tl = 0xff & eax.getValue();
if (base == 0)
throw DIVIDE_ERROR;
int ah = 0xff & (tl / base);
int al = 0xff & (tl % base);
eax.setValue(eax.getValue() & ~0xffff);
eax.setValue(eax.getValue() | (al | (ah << 8)));
auxiliaryCarry.clear();
return (byte) al;
}
private void aas()
{
if (((eax.getValue() & 0xf) > 0x9) || auxiliaryCarry.read())
{
int alBorrow = (eax.getValue() & 0xff) < 6 ? 0x100 : 0x000;
eax.setValue((0xffff0000 & eax.getValue()) | (0x0f & (eax.getValue() - 6)) | (0xff00 & (eax.getValue() - 0x100 - alBorrow)));
auxiliaryCarry.set();
carry.set();
}
else
{
auxiliaryCarry.clear();
carry.clear();
eax.setValue(eax.getValue()&0xffffff0f);
}
}
private void daa()
{
int al = eax.getValue() & 0xff;
boolean newCF;
if (((eax.getValue() & 0xf) > 0x9) || auxiliaryCarry.read())
{
al += 6;
auxiliaryCarry.set();
}
else
auxiliaryCarry.clear();
if (((al & 0xff) > 0x9f) || carry.read())
{
al += 0x60;
newCF = true;
}
else
newCF = false;
eax.setValue((eax.getValue()&~0xff)|(0xff&al));
overflow.clear();
zero.set((byte)al);
parity.set((byte)al);
sign.set((byte)al);
carry.set(newCF);
}
private void das()
{
boolean tempCF = false;
int tempAL = 0xff & eax.getValue();
if (((tempAL & 0xf) > 0x9) || auxiliaryCarry.read())
{
auxiliaryCarry.set();
eax.setValue((eax.getValue() & ~0xff) | ((eax.getValue() - 0x06) & 0xff));
tempCF = (tempAL < 0x06) || carry.read();
}
if ((tempAL > 0x99) || carry.read())
{
eax.setValue( (eax.getValue() & ~0xff) | ((eax.getValue() - 0x60) & 0xff));
tempCF = true;
}
overflow.clear();
zero.set((byte)eax.getValue());
parity.set((byte)eax.getValue());
sign.set((byte)eax.getValue());
carry.set(tempCF);
}
private void lahf()
{
int result = 0x0200;
if (sign.read()) result|=0x8000;
if (zero.read()) result|=0x4000;
if (auxiliaryCarry.read()) result|=0x1000;
if (parity.read()) result|=0x0400;
if (carry.read()) result|=0x0100;
eax.setValue((eax.getValue()&0xffff00ff)|result);
}
private void sahf()
{
int ah = (eax.getValue()&0xff00);
carry.set(0!=(ah&0x0100));
parity.set(0!=(ah&0x0400));
auxiliaryCarry.set(0!=(ah&0x1000));
zero.set(0!=(ah&0x4000));
sign.set(0!=(ah&0x8000));
}
private long rdtsc()
{
return computer.clock.getTime();
}
private void cpuid()
{
switch(eax.getValue())
{
case 0x00:
eax.setValue(0x02);
//this spells out "GenuineIntel"
ebx.setValue(0x756e6547);
edx.setValue(0x49656e69);
ecx.setValue(0x6c65746e);
break;
case 0x01:
eax.setValue(0x633); //use Pentium II model 8 stepping 3 until I can find specs for an older proc.
ebx.setValue(8<<8);
ecx.setValue(0);
int features=0;
features|=0; //no features at all
// features |= 0x01; //Have an FPU;
features |= 0x00; //Have no FPU;
// features |= (1<< 8); // Support CMPXCHG8B instruction
// features |= (1<< 4); // implement TSC
// features |= (1<< 5); // support RDMSR/WRMSR
//features |= (1<<23); // support MMX
//features |= (1<<24); // Implement FSAVE/FXRSTOR instructions.
// features |= (1<<15); // Implement CMOV instructions.
//features |= (1<< 9); // APIC on chip
//features |= (1<<25); // support SSE
features |= (1<< 3); // Support Page-Size Extension (4M pages)
features |= (1<<13); // Support Global pages.
//features |= (1<< 6); // Support PAE.
// features |= (1<<11); // SYSENTER/SYSEXIT
edx.setValue(features);
break;
case 0x02:
eax.setValue(0x410601);
ebx.setValue(0);
ecx.setValue(0);
edx.setValue(0);
break;
}
}
private void bitwise_flags(int result)
{
overflow.clear();
carry.clear();
zero.set(result);
parity.set(result);
sign.set(result);
}
private void arithmetic_flags_08(int result, int operand1, int operand2)
{
zero.set((byte)result);
parity.set(result);
sign.set((byte)result);
carry.set(result, Flag.CY_TWIDDLE_FF);
auxiliaryCarry.set(operand1, operand2, result, Flag.AC_XOR);
}
private void arithmetic_flags_16(int result, int operand1, int operand2)
{
zero.set((short)result);
parity.set(result);
sign.set((short)result);
carry.set(result, Flag.CY_TWIDDLE_FFFF);
auxiliaryCarry.set(operand1, operand2, result, Flag.AC_XOR);
}
private void arithmetic_flags_32(long result, int operand1, int operand2)
{
zero.set((int)result);
parity.set((int)result);
sign.set((int)result);
carry.set(result, Flag.CY_TWIDDLE_FFFFFFFF);
auxiliaryCarry.set(operand1, operand2, (int)result, Flag.AC_XOR);
}
private void add_flags_08(int result, int operand1, int operand2)
{
arithmetic_flags_08(result, operand1, operand2);
overflow.set(result, operand1 , operand2, Flag.OF_ADD_BYTE);
}
private void add_flags_16(int result, int operand1, int operand2)
{
arithmetic_flags_16(result, operand1, operand2);
overflow.set(result, operand1 , operand2, Flag.OF_ADD_SHORT);
}
private void add_flags_32(long result, int operand1, int operand2)
{
long res = (0xffffffffl & operand1) + (0xffffffffl & operand2);
arithmetic_flags_32(res, operand1, operand2);
overflow.set((int)res, operand1 , operand2, Flag.OF_ADD_INT);
}
private void adc_flags_08(int result, int operand1, int operand2)
{
if (carry.read() && (operand2 == 0xff))
{
arithmetic_flags_08(result, operand1, operand2);
overflow.clear();
carry.set();
}
else
{
overflow.set(result, operand1, operand2, Flag.OF_ADD_BYTE);
arithmetic_flags_08(result, operand1, operand2);
}
}
private void adc_flags_16(int result, int operand1, int operand2)
{
if (carry.read() && (operand2 == 0xffff))
{
arithmetic_flags_16(result, operand1, operand2);
overflow.clear();
carry.set();
}
else
{
overflow.set(result, operand1, operand2, Flag.OF_ADD_SHORT);
arithmetic_flags_16(result, operand1, operand2);
}
}
private void adc_flags_32(long result, int operand1, int operand2)
{
long res = (0xffffffffl & operand1) + (0xffffffffl & operand2) + (carry.read()? 1l:0l);
if (carry.read() && (operand2 == 0xffffffff))
{
arithmetic_flags_32(res, operand1, operand2);
overflow.clear();
carry.set();
}
else
{
overflow.set((int)res, operand1, operand2, Flag.OF_ADD_INT);
arithmetic_flags_32(res, operand1, operand2);
}
}
private void sub_flags_08(int result, int operand1, int operand2)
{
arithmetic_flags_08(result, operand1, operand2);
overflow.set(result, operand1, operand2, Flag.OF_SUB_BYTE);
}
private void sub_flags_16(int result, int operand1, int operand2)
{
arithmetic_flags_16(result, operand1, operand2);
overflow.set(result, operand1, operand2, Flag.OF_SUB_SHORT);
}
private void sub_flags_32(long result, int operand1, int operand2)
{
long res = (0xffffffffl&operand1) - (0xffffffffl&operand2);
arithmetic_flags_32(res, operand1, operand2);
overflow.set((int)res, operand1, operand2, Flag.OF_SUB_INT);
}
private void rep_sub_flags_08(int used, int operand1, int operand2)
{
if (used == 0)
return;
int result = operand1 - operand2;
arithmetic_flags_08(result, operand1, operand2);
overflow.set(result, operand1, operand2, Flag.OF_SUB_BYTE);
}
private void rep_sub_flags_16(int used, int operand1, int operand2)
{
if (used == 0)
return;
int result = operand1 - operand2;
arithmetic_flags_16(result, operand1, operand2);
overflow.set(result, operand1, operand2, Flag.OF_SUB_SHORT);
}
private void rep_sub_flags_32(int used, int operand1, int operand2)
{
if (used == 0)
return;
long res = (0xffffffffl&operand1) - (0xffffffffl&operand2);
arithmetic_flags_32(res, operand1, operand2);
overflow.set((int)res, operand1, operand2, Flag.OF_SUB_INT);
}
private void sbb_flags_08(int result, int operand1, int operand2)
{
overflow.set(result, operand1, operand2, Flag.OF_SUB_BYTE);
arithmetic_flags_08(result, operand1, operand2);
}
private void sbb_flags_16(int result, int operand1, int operand2)
{
overflow.set(result, operand1, operand2, Flag.OF_SUB_SHORT);
arithmetic_flags_16(result, operand1, operand2);
}
private void sbb_flags_32(long result, int operand1, int operand2)
{
long res = (0xffffffffl&operand1) - (0xffffffffl&operand2) - (carry.read()? 1l:0l);
overflow.set((int)res, operand1, operand2, Flag.OF_SUB_INT);
arithmetic_flags_32(res, operand1, operand2);
}
private void dec_flags_08(byte result)
{
zero.set(result);
parity.set(result);
sign.set(result);
overflow.set(result, Flag.OF_MAX_BYTE);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_MAX);
}
private void dec_flags_16(short result)
{
zero.set(result);
parity.set(result);
sign.set(result);
overflow.set(result, Flag.OF_MAX_SHORT);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_MAX);
}
private void dec_flags_32(int result)
{
zero.set(result);
parity.set(result);
sign.set(result);
overflow.set(result, Flag.OF_MAX_INT);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_MAX);
}
private void inc_flags_08(byte result)
{
zero.set(result);
parity.set(result);
sign.set(result);
overflow.set(result, Flag.OF_MIN_BYTE);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_ZERO);
}
private void inc_flags_16(short result)
{
zero.set(result);
parity.set(result);
sign.set(result);
overflow.set(result, Flag.OF_MIN_SHORT);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_ZERO);
}
private void inc_flags_32(int result)
{
zero.set(result);
parity.set(result);
sign.set(result);
overflow.set(result, Flag.OF_MIN_INT);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_ZERO);
}
private void shl_flags_08(byte result, byte initial, int count)
{
if (count > 0)
{
carry.set(initial, count, Flag.CY_SHL_OUTBIT_BYTE);
if (count == 1)
overflow.set(result, Flag.OF_BIT7_XOR_CARRY);
zero.set(result);
parity.set(result);
sign.set(result);
}
}
private void shl_flags_16(short result, short initial, int count)
{
if (count > 0)
{
carry.set(initial, count, Flag.CY_SHL_OUTBIT_SHORT);
if (count == 1)
overflow.set(result, Flag.OF_BIT15_XOR_CARRY);
zero.set(result);
parity.set(result);
sign.set(result);
}
}
private void shl_flags_32(int result, int initial, int count)
{
if (count > 0)
{
carry.set(initial, count, Flag.CY_SHL_OUTBIT_INT);
if (count == 1)
overflow.set(result, Flag.OF_BIT31_XOR_CARRY);
zero.set(result);
parity.set(result);
sign.set(result);
}
}
private void shr_flags_08(byte result, int initial, int count)
{
if (count > 0)
{
carry.set(initial, count, Flag.CY_SHR_OUTBIT);
if (count == 1)
overflow.set(result, initial, Flag.OF_BIT7_DIFFERENT);
zero.set(result);
parity.set(result);
sign.set(result);
}
}
private void shr_flags_16(short result, int initial, int count)
{
if (count > 0)
{
carry.set(initial, count, Flag.CY_SHR_OUTBIT);
if (count == 1)
overflow.set(result, initial, Flag.OF_BIT15_DIFFERENT);
zero.set(result);
parity.set(result);
sign.set(result);
}
}
private void shr_flags_32(int result, int initial, int count)
{
if (count > 0)
{
carry.set(initial, count, Flag.CY_SHR_OUTBIT);
if (count == 1)
overflow.set(result, initial, Flag.OF_BIT31_DIFFERENT);
zero.set(result);
parity.set(result);
sign.set(result);
}
}
private void sar_flags(int result, int initial, int count)
{
if (count > 0)
{
carry.set(initial, count, Flag.CY_SHR_OUTBIT);
if (count == 1)
overflow.clear();
zero.set(result);
parity.set(result);
sign.set(result);
}
}
private void rol_flags_08(byte result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_LOWBIT);
if (count==1)
overflow.set(result, Flag.OF_BIT7_XOR_CARRY);
}
}
private void rol_flags_16(short result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_LOWBIT);
if (count==1)
overflow.set(result, Flag.OF_BIT15_XOR_CARRY);
}
}
private void rol_flags_32(int result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_LOWBIT);
if (count==1)
overflow.set(result, Flag.OF_BIT31_XOR_CARRY);
}
}
private void ror_flags_08(byte result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_HIGHBIT_BYTE);
if (count==1)
overflow.set(result, Flag.OF_BIT6_XOR_CARRY);
}
}
private void ror_flags_16(short result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_HIGHBIT_SHORT);
if (count==1)
overflow.set(result, Flag.OF_BIT14_XOR_CARRY);
}
}
private void ror_flags_32(int result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_HIGHBIT_INT);
if (count==1)
overflow.set(result, Flag.OF_BIT30_XOR_CARRY);
}
}
private void rcl_flags_08(int result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_OFFENDBIT_BYTE);
if (count==1)
overflow.set(result, Flag.OF_BIT7_XOR_CARRY);
}
}
private void rcl_flags_16(int result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_OFFENDBIT_SHORT);
if (count==1)
overflow.set(result, Flag.OF_BIT15_XOR_CARRY);
}
}
private void rcl_flags_32(long result, int count)
{
if (count>0)
{
carry.set(result, Flag.CY_OFFENDBIT_INT);
if (count==1)
overflow.set(result, Flag.OF_BIT31_XOR_CARRY);
}
}
private void rcr_flags_08(int result, int count, int over)
{
if (count>0)
{
carry.set(result, Flag.CY_OFFENDBIT_BYTE);
if (count==1)
overflow.set(over>0);
}
}
private void rcr_flags_16(int result, int count, int over)
{
if (count>0)
{
carry.set(result, Flag.CY_OFFENDBIT_SHORT);
if (count==1)
overflow.set(over>0);
}
}
private void rcr_flags_32(long result, int count, int over)
{
if (count>0)
{
carry.set(result, Flag.CY_OFFENDBIT_INT);
if (count==1)
overflow.set(over>0);
}
}
private void neg_flags_08(byte result)
{
carry.set(result, Flag.CY_NZ);
overflow.set(result, Flag.OF_MIN_BYTE);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_NZERO);
zero.set(result);
parity.set(result);
sign.set(result);
}
private void neg_flags_16(short result)
{
carry.set(result, Flag.CY_NZ);
overflow.set(result, Flag.OF_MIN_SHORT);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_NZERO);
zero.set(result);
parity.set(result);
sign.set(result);
}
private void neg_flags_32(int result)
{
carry.set(result, Flag.CY_NZ);
overflow.set(result, Flag.OF_MIN_INT);
auxiliaryCarry.set(result, Flag.AC_LNIBBLE_NZERO);
zero.set(result);
parity.set(result);
sign.set(result);
}
public void initializeDecoder()
{
//assemble the table of instruction inputs and outputs by instrution
//this will speed processing
//29 different sources / destinations, + 1 miscellaneous
int types=30;
operandTable = new int[0x200][types][4];
for (int i=0; i<types; i++)
{
for (int j=0; j<inputTable0[i].length; j++)
{
int inst = inputTable0[i][j];
if (inst>=0xf00)
inst-=0xe00;
operandTable[inst][i][0]=1;
}
for (int j=0; j<inputTable1[i].length; j++)
{
int inst = inputTable1[i][j];
if (inst>=0xf00)
inst-=0xe00;
operandTable[inst][i][1]=1;
}
for (int j=0; j<outputTable0[i].length; j++)
{
int inst = outputTable0[i][j];
if (inst>=0xf00)
inst-=0xe00;
operandTable[inst][i][2]=1;
}
for (int j=0; j<outputTable1[i].length; j++)
{
int inst = outputTable1[i][j];
if (inst>=0xf00)
inst-=0xe00;
operandTable[inst][i][3]=1;
}
}
}
//this routine will eventually be turned into a normal exception
public void panic(String reason)
{
System.out.println("PANIC: "+reason);
System.out.println("icount = "+computer.icount);
//System.exit(0);
}
//call this to start the decoding
public void decodeInstruction(boolean is32bit)
{
codeLength=0;
icodeLength=0;
addressDecoded=false;
if(is32bit)
{
pushCode(MICROCODE.PREFIX_OPCODE_32BIT);
pushCode(MICROCODE.PREFIX_ADDRESS_32BIT);
}
decodePrefix(is32bit);
decodeOpcode();
if(isCode(MICROCODE.PREFIX_OPCODE_32BIT))
replaceFlags1632();
}
//returns microinstruction codes
public MICROCODE[] getCodes()
{
return code;
}
//returns the length of the instruction in bytes
public int getInstructionLength()
{
return fetchQueue.instructionLength();
}
//add a new microcode to the sequence
private void pushCode(MICROCODE code)
{
this.code[codeLength++]=code;
}
private void pushCode(int code)
{
this.icode[icodeLength++]=code;
}
public MICROCODE getCode()
{
if(codesHandled>=codeLength)
panic("No more codes to read");
return this.code[codesHandled++];
}
private int getLastiCode()
{
if (icodesHandled==0)
return this.icode[0];
return this.icode[icodesHandled-1];
}
private int getiCode()
{
if(icodesHandled>=icodeLength)
panic("No more icodes to read");
return this.icode[icodesHandled++];
}
//is a particular microcode already in the array?
private boolean isCode(MICROCODE code)
{
for (int i=0; i<codeLength; i++)
if (this.code[i]==code)
return true;
return false;
}
private void removeCode(MICROCODE code)
{
int i;
for (i=0; i<codeLength; i++)
if (this.code[i]==code)
break;
if (i==codeLength)
return;
for (int j=i; j<codeLength-1; j++)
this.code[j]=this.code[j+1];
codeLength--;
}
private void decodePrefix(boolean is32bit)
{
int prefix;
//keep decoding prefices until no more
while(true)
{
prefix = (0xff & fetchQueue.readByte());
switch(prefix)
{
//Group 1, page 34
case 0xf0: pushCode(MICROCODE.PREFIX_LOCK); break;
case 0xf2: pushCode(MICROCODE.PREFIX_REPNE); break;
case 0xf3: pushCode(MICROCODE.PREFIX_REPE); break;
//Group 2, page 34
case 0x2e: pushCode(MICROCODE.PREFIX_CS); break;
case 0x36: pushCode(MICROCODE.PREFIX_SS); break;
case 0x3e: pushCode(MICROCODE.PREFIX_DS); break;
case 0x26: pushCode(MICROCODE.PREFIX_ES); break;
case 0x64: pushCode(MICROCODE.PREFIX_FS); break;
case 0x65: pushCode(MICROCODE.PREFIX_GS); break;
case 0x66:
if(!is32bit)
pushCode(MICROCODE.PREFIX_OPCODE_32BIT);
else
removeCode(MICROCODE.PREFIX_OPCODE_32BIT);
break;
case 0x67:
if(!is32bit)
pushCode(MICROCODE.PREFIX_ADDRESS_32BIT);
else
removeCode(MICROCODE.PREFIX_ADDRESS_32BIT);
break;
case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
return;
// panic("Floating point not implemented");
default:
//this isn't a prefix - it's the opcode
return;
}
//move beyond the prefix byte
fetchQueue.advance(1);
}
}
private void decodeOpcode()
{
//the opcode is either one or two bytes
//(intel manual mentions three, but I'll ignore that for now)
int opcode;
int modrm;
boolean hasmodrm;
int hasimmediate, hasdisplacement;
int tableindex=0;
int displacement;
long immediate;
int sib;
opcode=0xff & fetchQueue.readByte();
fetchQueue.advance(1);
tableindex=opcode;
//0x0f means a second byte
if (opcode==0x0f)
{
opcode=(opcode<<8) | (0xff & fetchQueue.readByte());
fetchQueue.advance(1);
tableindex=(opcode&0xff)+0x100;
}
else if (opcode>=0xd8 && opcode<=0xdf)
{
//floating point: throw away next byte
fetchQueue.advance(1);
}
if(computer.debugMode)
System.out.printf("opcode %x\n",opcode);
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_OPCODE_32BIT)) processorGUICode.push(GUICODE.DECODE_PREFIX,"op32");
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_ADDRESS_32BIT)) processorGUICode.push(GUICODE.DECODE_PREFIX,"addr32");
if (processorGUICode!=null && !isCode(MICROCODE.PREFIX_OPCODE_32BIT)) processorGUICode.push(GUICODE.DECODE_PREFIX,"op16");
if (processorGUICode!=null && !isCode(MICROCODE.PREFIX_ADDRESS_32BIT)) processorGUICode.push(GUICODE.DECODE_PREFIX,"addr16");
if (processorGUICode!=null && (isCode(MICROCODE.PREFIX_REPE)||isCode(MICROCODE.PREFIX_REPNE))) processorGUICode.push(GUICODE.DECODE_PREFIX,"rep");
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_CS)) processorGUICode.push(GUICODE.DECODE_PREFIX,"cs");
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_SS)) processorGUICode.push(GUICODE.DECODE_PREFIX,"ss");
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_DS)) processorGUICode.push(GUICODE.DECODE_PREFIX,"ds");
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_ES)) processorGUICode.push(GUICODE.DECODE_PREFIX,"es");
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_FS)) processorGUICode.push(GUICODE.DECODE_PREFIX,"fs");
if (processorGUICode!=null && isCode(MICROCODE.PREFIX_GS)) processorGUICode.push(GUICODE.DECODE_PREFIX,"gs");
if(processorGUICode!=null) processorGUICode.push(GUICODE.DECODE_OPCODE,opcode);
hasmodrm=(modrmTable[tableindex]==1);
//the next byte is the mod r/m byte, if the instruction has one
if (hasmodrm)
{
modrm = (0xff & fetchQueue.readByte());
fetchQueue.advance(1);
if(processorGUICode!=null) processorGUICode.push(GUICODE.DECODE_MODRM,modrm);
}
else
modrm=-1;
//the next byte might be the sib
sib=-1;
if (modrm!=-1 && isCode(MICROCODE.PREFIX_ADDRESS_32BIT))
{
if (sibTable[modrm]==1)
{
sib=(0xff&fetchQueue.readByte());
fetchQueue.advance(1);
if(processorGUICode!=null) processorGUICode.push(GUICODE.DECODE_SIB,sib);
}
}
//get the displacement, if any
hasdisplacement=0;
if(hasDisplacementTable[tableindex]==1)
{
if(!isCode(MICROCODE.PREFIX_ADDRESS_32BIT))
{
if ((modrm & 0xc0)==0 && (modrm & 0x7)==0x6)
hasdisplacement=2;
else if ((modrm & 0xc0)==0x40)
hasdisplacement=1;
else if ((modrm & 0xc0)==0x80)
hasdisplacement=2;
}
else
{
if ((modrm & 0xc0)==0 && (modrm & 0x7)==0x5)
hasdisplacement=4;
else if ((modrm & 0xc0)==0 && (modrm & 0x7)==0x4 && (sib!=-1) && (sib & 0x7)==0x5)
hasdisplacement=4;
else if ((modrm & 0xc0)==0x40)
hasdisplacement=1;
else if ((modrm & 0xc0)==0x80)
hasdisplacement=4;
}
}
displacement=0;
//handle the special a0-a3 case
if(hasDisplacementTable[tableindex]==4)
{
if(!isCode(MICROCODE.PREFIX_ADDRESS_32BIT))
hasdisplacement=2;
else
hasdisplacement=4;
}
if (hasdisplacement==1)
{
displacement=(0xff & fetchQueue.readByte());
fetchQueue.advance(1);
}
else if (hasdisplacement==2)
{
displacement=(0xff & fetchQueue.readByte());
fetchQueue.advance(1);
displacement=(displacement&0xff)|(0xff00 & (fetchQueue.readByte()<<8));
fetchQueue.advance(1);
}
else if (hasdisplacement==4)
{
displacement=(0xff & fetchQueue.readByte());
fetchQueue.advance(1);
displacement=(displacement&0xff)|(0xff00 & (fetchQueue.readByte()<<8));
fetchQueue.advance(1);
displacement=(displacement&0xffff)|(0xff0000 & (fetchQueue.readByte()<<16));
fetchQueue.advance(1);
displacement=(displacement&0xffffff)|(0xff000000 & (fetchQueue.readByte()<<24));
fetchQueue.advance(1);
}
if (hasdisplacement>0)
if(processorGUICode!=null) processorGUICode.push(GUICODE.DECODE_DISPLACEMENT,displacement);
//get the immediate
//get the displacement, if any
hasimmediate=hasImmediateTable[tableindex];
//since we're in 16-bit mode, change the 32-bit to 20-bit
if (!isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
if(hasimmediate==4)
hasimmediate=2;
else if(hasimmediate==6)
hasimmediate=4;
}
//the una instructions (f6 and f7) may or may not have an immediate, depending on modrm
if(opcode==0xf6 && (modrm&0x38)==0)
hasimmediate=1;
else if(opcode==0xf7 && (modrm&0x38)==0 && !isCode(MICROCODE.PREFIX_OPCODE_32BIT))
hasimmediate=2;
else if(opcode==0xf7 && (modrm&0x38)==0 && isCode(MICROCODE.PREFIX_OPCODE_32BIT))
hasimmediate=4;
immediate=0;
if (hasimmediate>=1)
{
immediate=fetchQueue.readByte();
fetchQueue.advance(1);
}
if (hasimmediate>=2)
{
immediate = (immediate&0xff)|(0xff00&(fetchQueue.readByte()<<8));
fetchQueue.advance(1);
}
if (hasimmediate>=3)
{
immediate = (immediate&0xffff)|(0xff0000&(fetchQueue.readByte()<<16));
fetchQueue.advance(1);
}
if (hasimmediate>=4)
{
immediate = (immediate&0xffffff)|(0xff000000&(fetchQueue.readByte()<<24));
fetchQueue.advance(1);
}
if (hasimmediate>=6)
{
immediate = (immediate&0xffffffffl)|(((fetchQueue.readByte()&0xffl)|((fetchQueue.readByte(1)<<8)&0xff00l))<<32);
fetchQueue.advance(2);
}
if (hasimmediate>0)
if(processorGUICode!=null) processorGUICode.push(GUICODE.DECODE_IMMEDIATE,(int)immediate);
decodeOperands(opcode, modrm, sib, displacement, immediate, true);
decodeOperation(opcode, modrm);
decodeOperands(opcode, modrm, sib, displacement, immediate, false);
decodeFlags(opcode, modrm);
}
private void decodeOperands(int opcode, int modrm, int sib, int displacement, long immediate, boolean inputOperands)
{
//30 different operand types
int types=30;
int opcodeLookup = opcode;
if (opcodeLookup>=0xf00)
opcodeLookup-=0xe00;
//step through load 0, load 1, store 0, store 1
int start=inputOperands? 0:2;
int end=inputOperands? 2:4;
for (int operand=start; operand<end; operand++)
{
for (int type=0; type<types; type++)
{
if(operandTable[opcodeLookup][type][operand]==0)
continue;
if (type==0)
effective_byte(modrm,sib,displacement,operand);
else if (type==1)
{
if(isCode(MICROCODE.PREFIX_OPCODE_32BIT))
effective_double(modrm,sib,displacement,operand);
else
effective_word(modrm,sib,displacement,operand);
}
else if (type==2)
register_byte(modrm,operand);
else if (type==3)
{
if(isCode(MICROCODE.PREFIX_OPCODE_32BIT))
register_double(modrm,operand);
else
register_word(modrm,operand);
}
else if (type==4)
{
if (operand==0)
pushCode(MICROCODE.LOAD0_IB);
else if (operand==1)
pushCode(MICROCODE.LOAD1_IB);
pushCode((int)immediate);
}
else if (type==5)
{
if(isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
if (operand==0)
pushCode(MICROCODE.LOAD0_ID);
else if (operand==1)
pushCode(MICROCODE.LOAD1_ID);
pushCode((int)immediate);
}
else
{
if (operand==0)
pushCode(MICROCODE.LOAD0_IW);
else if (operand==1)
pushCode(MICROCODE.LOAD1_IW);
pushCode((int)immediate);
}
}
else if (type>=6 && type<=28)
{
MICROCODE c = operandRegisterTable[operand*23+type-6];
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
if (c==MICROCODE.LOAD0_AX) c=MICROCODE.LOAD0_EAX;
else if (c==MICROCODE.LOAD0_BX) c=MICROCODE.LOAD0_EBX;
else if (c==MICROCODE.LOAD0_CX) c=MICROCODE.LOAD0_ECX;
else if (c==MICROCODE.LOAD0_DX) c=MICROCODE.LOAD0_EDX;
else if (c==MICROCODE.LOAD0_SI) c=MICROCODE.LOAD0_ESI;
else if (c==MICROCODE.LOAD0_DI) c=MICROCODE.LOAD0_EDI;
else if (c==MICROCODE.LOAD0_SP) c=MICROCODE.LOAD0_ESP;
else if (c==MICROCODE.LOAD0_BP) c=MICROCODE.LOAD0_EBP;
else if (c==MICROCODE.LOAD0_FLAGS) c=MICROCODE.LOAD0_EFLAGS;
else if (c==MICROCODE.LOAD1_AX) c=MICROCODE.LOAD1_EAX;
else if (c==MICROCODE.LOAD1_BX) c=MICROCODE.LOAD1_EBX;
else if (c==MICROCODE.LOAD1_CX) c=MICROCODE.LOAD1_ECX;
else if (c==MICROCODE.LOAD1_DX) c=MICROCODE.LOAD1_EDX;
else if (c==MICROCODE.LOAD1_SI) c=MICROCODE.LOAD1_ESI;
else if (c==MICROCODE.LOAD1_DI) c=MICROCODE.LOAD1_EDI;
else if (c==MICROCODE.LOAD1_SP) c=MICROCODE.LOAD1_ESP;
else if (c==MICROCODE.LOAD1_BP) c=MICROCODE.LOAD1_EBP;
else if (c==MICROCODE.LOAD1_FLAGS) c=MICROCODE.LOAD1_EFLAGS;
else if (c==MICROCODE.STORE0_AX) c=MICROCODE.STORE0_EAX;
else if (c==MICROCODE.STORE0_BX) c=MICROCODE.STORE0_EBX;
else if (c==MICROCODE.STORE0_CX) c=MICROCODE.STORE0_ECX;
else if (c==MICROCODE.STORE0_DX) c=MICROCODE.STORE0_EDX;
else if (c==MICROCODE.STORE0_SI) c=MICROCODE.STORE0_ESI;
else if (c==MICROCODE.STORE0_DI) c=MICROCODE.STORE0_EDI;
else if (c==MICROCODE.STORE0_SP) c=MICROCODE.STORE0_ESP;
else if (c==MICROCODE.STORE0_BP) c=MICROCODE.STORE0_EBP;
else if (c==MICROCODE.STORE0_FLAGS) c=MICROCODE.STORE0_EFLAGS;
else if (c==MICROCODE.STORE1_AX) c=MICROCODE.STORE1_EAX;
else if (c==MICROCODE.STORE1_BX) c=MICROCODE.STORE1_EBX;
else if (c==MICROCODE.STORE1_CX) c=MICROCODE.STORE1_ECX;
else if (c==MICROCODE.STORE1_DX) c=MICROCODE.STORE1_EDX;
else if (c==MICROCODE.STORE1_SI) c=MICROCODE.STORE1_ESI;
else if (c==MICROCODE.STORE1_DI) c=MICROCODE.STORE1_EDI;
else if (c==MICROCODE.STORE1_SP) c=MICROCODE.STORE1_ESP;
else if (c==MICROCODE.STORE1_BP) c=MICROCODE.STORE1_EBP;
else if (c==MICROCODE.STORE1_FLAGS) c=MICROCODE.STORE1_EFLAGS;
}
pushCode(c);
}
else
decodeIrregularOperand(opcode, modrm, sib, displacement, immediate, operand);
break;
}
}
//a few instructions have a third input
if (inputOperands && (opcode==0xfa4 || opcode==0xfa5 || opcode==0xfac || opcode==0xfad || opcode==0xfb0 || opcode==0xfb1))
{
switch(opcode)
{
case 0xfa4: case 0xfac:
pushCode(MICROCODE.LOAD2_IB);
pushCode((int)immediate);
break;
case 0xfa5: case 0xfad:
pushCode(MICROCODE.LOAD2_CL);
break;
case 0xfb0:
pushCode(MICROCODE.LOAD2_AL);
break;
case 0xfb1:
if(isCode(MICROCODE.PREFIX_OPCODE_32BIT))
pushCode(MICROCODE.LOAD2_EAX);
else
pushCode(MICROCODE.LOAD2_AX);
break;
}
}
}
private void effective_byte(int modrm, int sib, int displacement, int operand)
{
if ((modrm & 0xc7)>=0xc0 && (modrm & 0xc7)<=0xc7)
pushCode(modrmRegisterTable[operand*9 + (modrm&7)]);
else
{
decode_memory(modrm, sib, displacement);
pushCode(modrmRegisterTable[operand*9+8]);
}
}
private void effective_word(int modrm, int sib, int displacement, int operand)
{
if ((modrm & 0xc7)>=0xc0 && (modrm & 0xc7)<=0xc7)
pushCode(modrmRegisterTable[36 + operand*9 + (modrm&7)]);
else
{
decode_memory(modrm, sib, displacement);
pushCode(modrmRegisterTable[36 + operand*9+8]);
}
}
private void effective_double(int modrm, int sib, int displacement, int operand)
{
if ((modrm & 0xc7)>=0xc0 && (modrm & 0xc7)<=0xc7)
pushCode(modrmRegisterTable[72 + operand*9 + (modrm&7)]);
else
{
decode_memory(modrm, sib, displacement);
pushCode(modrmRegisterTable[72 + operand*9+8]);
}
}
private void register_byte(int modrm, int operand)
{
pushCode(modrmRegisterTable[operand*9+((modrm&0x38)>>3)]);
}
private void register_word(int modrm, int operand)
{
pushCode(modrmRegisterTable[36+operand*9+((modrm&0x38)>>3)]);
}
private void register_double(int modrm, int operand)
{
pushCode(modrmRegisterTable[72+operand*9+((modrm&0x38)>>3)]);
}
private boolean isAddressDecoded()
{
if(addressDecoded)
return true;
addressDecoded=true;
return false;
}
private void store0_Rd(int modrm)
{
switch(modrm&0xc7)
{
case 0xc0: pushCode(MICROCODE.STORE0_EAX); break;
case 0xc1: pushCode(MICROCODE.STORE0_ECX); break;
case 0xc2: pushCode(MICROCODE.STORE0_EDX); break;
case 0xc3: pushCode(MICROCODE.STORE0_EBX); break;
case 0xc4: pushCode(MICROCODE.STORE0_ESP); break;
case 0xc5: pushCode(MICROCODE.STORE0_EBP); break;
case 0xc6: pushCode(MICROCODE.STORE0_ESI); break;
case 0xc7: pushCode(MICROCODE.STORE0_EDI); break;
default: panic("Bad store0 Rd");
}
}
private void load0_Rd(int modrm)
{
switch(modrm&0xc7)
{
case 0xc0: pushCode(MICROCODE.LOAD0_EAX); break;
case 0xc1: pushCode(MICROCODE.LOAD0_ECX); break;
case 0xc2: pushCode(MICROCODE.LOAD0_EDX); break;
case 0xc3: pushCode(MICROCODE.LOAD0_EBX); break;
case 0xc4: pushCode(MICROCODE.LOAD0_ESP); break;
case 0xc5: pushCode(MICROCODE.LOAD0_EBP); break;
case 0xc6: pushCode(MICROCODE.LOAD0_ESI); break;
case 0xc7: pushCode(MICROCODE.LOAD0_EDI); break;
default: panic("Bad store0 Rd");
}
}
private void load0_Cd(int modrm)
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.LOAD0_CR0); break;
case 0x10: pushCode(MICROCODE.LOAD0_CR2); break;
case 0x18: pushCode(MICROCODE.LOAD0_CR3); break;
case 0x20: pushCode(MICROCODE.LOAD0_CR4); break;
default: panic("Bad load0 Cd");
}
}
private void store0_Cd(int modrm)
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.STORE0_CR0); break;
case 0x10: pushCode(MICROCODE.STORE0_CR2); break;
case 0x18: pushCode(MICROCODE.STORE0_CR3); break;
case 0x20: pushCode(MICROCODE.STORE0_CR4); break;
default: panic("Bad load0 Cd");
}
}
private void decode_memory(int modrm, int sib, int displacement)
{
if(isAddressDecoded()) return;
if (isCode(MICROCODE.PREFIX_ADDRESS_32BIT))
{
//first figure out which segment to access
if (isCode(MICROCODE.PREFIX_CS))
pushCode(MICROCODE.LOAD_SEG_CS);
else if (isCode(MICROCODE.PREFIX_SS))
pushCode(MICROCODE.LOAD_SEG_SS);
else if (isCode(MICROCODE.PREFIX_DS))
pushCode(MICROCODE.LOAD_SEG_DS);
else if (isCode(MICROCODE.PREFIX_ES))
pushCode(MICROCODE.LOAD_SEG_ES);
else if (isCode(MICROCODE.PREFIX_FS))
pushCode(MICROCODE.LOAD_SEG_FS);
else if (isCode(MICROCODE.PREFIX_GS))
pushCode(MICROCODE.LOAD_SEG_GS);
else if ((modrm&0xc7)==0x45 || (modrm&0xc7)==0x55)
pushCode(MICROCODE.LOAD_SEG_SS);
else if ((modrm&0xc7)==0x04 || (modrm&0xc7)==0x44 || (modrm&0xc7)==0x84) { }
else
pushCode(MICROCODE.LOAD_SEG_DS);
if ((modrm & 0x7)==0)
pushCode(MICROCODE.ADDR_EAX);
else if ((modrm & 0x7)==1)
pushCode(MICROCODE.ADDR_ECX);
else if ((modrm & 0x7)==2)
pushCode(MICROCODE.ADDR_EDX);
else if ((modrm & 0x7)==3)
pushCode(MICROCODE.ADDR_EBX);
else if ((modrm & 0x7)==4)
{
decodeSIB(modrm, sib, displacement);
}
else if ((modrm & 0x7)==5 && (modrm & 0xc0)==0x00)
{
pushCode(MICROCODE.ADDR_ID);
pushCode(displacement);
}
else if ((modrm & 0x7)==5)
pushCode(MICROCODE.ADDR_EBP);
else if ((modrm & 0x7)==6)
pushCode(MICROCODE.ADDR_ESI);
else if ((modrm & 0x7)==7)
pushCode(MICROCODE.ADDR_EDI);
//now add the displacement
if ((modrm & 0xc0)==0x40)
{
pushCode(MICROCODE.ADDR_IB);
pushCode(displacement);
}
else if ((modrm & 0xc0)==0x80)
{
pushCode(MICROCODE.ADDR_ID);
pushCode(displacement);
}
}
else
{
//first figure out which segment to access
if (isCode(MICROCODE.PREFIX_CS))
pushCode(MICROCODE.LOAD_SEG_CS);
else if (isCode(MICROCODE.PREFIX_SS))
pushCode(MICROCODE.LOAD_SEG_SS);
else if (isCode(MICROCODE.PREFIX_DS))
pushCode(MICROCODE.LOAD_SEG_DS);
else if (isCode(MICROCODE.PREFIX_ES))
pushCode(MICROCODE.LOAD_SEG_ES);
else if (isCode(MICROCODE.PREFIX_FS))
pushCode(MICROCODE.LOAD_SEG_FS);
else if (isCode(MICROCODE.PREFIX_GS))
pushCode(MICROCODE.LOAD_SEG_GS);
else if ((modrm&0xc7)==0x02 || (modrm&0xc7)==0x03 || (modrm&0xc7)==0x42 || (modrm&0xc7)==0x43 || (modrm&0xc7)==0x46 || (modrm&0xc7)==0x82 || (modrm&0xc7)==0x83 || (modrm&0xc7)==0x86)
pushCode(MICROCODE.LOAD_SEG_SS);
else
pushCode(MICROCODE.LOAD_SEG_DS);
if ((modrm & 0x7)==0 || (modrm & 0x7)==1 || (modrm & 0x7)==7)
pushCode(MICROCODE.ADDR_BX);
else if ((modrm & 0x7)==2 || (modrm & 0x7)==3)
pushCode(MICROCODE.ADDR_BP);
else if ((modrm & 0x7)==4)
pushCode(MICROCODE.ADDR_SI);
else if ((modrm & 0x7)==5)
pushCode(MICROCODE.ADDR_DI);
else if ((modrm & 0xc0)!=0)
pushCode(MICROCODE.ADDR_BP);
else
{
pushCode(MICROCODE.ADDR_IW);
pushCode(displacement);
}
//in some cases SI or DI is added
if ((modrm & 0x7)==0 || (modrm & 0x7)==2)
pushCode(MICROCODE.ADDR_SI);
else if ((modrm & 0x7)==1 || (modrm & 0x7)==3)
pushCode(MICROCODE.ADDR_DI);
//now add the displacement
if ((modrm & 0xc0)==0x40)
{
pushCode(MICROCODE.ADDR_IB);
pushCode(displacement);
}
else if ((modrm & 0xc0)==0x80)
{
pushCode(MICROCODE.ADDR_IW);
pushCode(displacement);
}
pushCode(MICROCODE.ADDR_MASK_16);
}
}
private void decodeSIB(int modrm, int sib, int displacement)
{
if (isCode(MICROCODE.PREFIX_CS)) pushCode(MICROCODE.LOAD_SEG_CS);
else if (isCode(MICROCODE.PREFIX_SS)) pushCode(MICROCODE.LOAD_SEG_SS);
else if (isCode(MICROCODE.PREFIX_DS)) pushCode(MICROCODE.LOAD_SEG_DS);
else if (isCode(MICROCODE.PREFIX_ES)) pushCode(MICROCODE.LOAD_SEG_ES);
else if (isCode(MICROCODE.PREFIX_FS)) pushCode(MICROCODE.LOAD_SEG_FS);
else if (isCode(MICROCODE.PREFIX_GS)) pushCode(MICROCODE.LOAD_SEG_GS);
else
{
if ((sib&0x7)==0x4)
pushCode(MICROCODE.LOAD_SEG_SS);
else if ((sib&0x7)==0x5)
{
if ((modrm&0xc0)==0)
pushCode(MICROCODE.LOAD_SEG_SS);
else
pushCode(MICROCODE.LOAD_SEG_DS);
}
else
pushCode(MICROCODE.LOAD_SEG_DS);
}
if ((sib&0x7)==0) pushCode(MICROCODE.ADDR_EAX);
else if ((sib&0x7)==1) pushCode(MICROCODE.ADDR_ECX);
else if ((sib&0x7)==2) pushCode(MICROCODE.ADDR_EDX);
else if ((sib&0x7)==3) pushCode(MICROCODE.ADDR_EBX);
else if ((sib&0x7)==4) pushCode(MICROCODE.ADDR_ESP);
else if ((sib&0x7)==6) pushCode(MICROCODE.ADDR_ESI);
else if ((sib&0x7)==7) pushCode(MICROCODE.ADDR_EDI);
else if ((modrm&0xc0)!=0) pushCode(MICROCODE.ADDR_EBP);
else
{
pushCode(MICROCODE.ADDR_ID);
pushCode(displacement);
}
switch(sib&0xf8)
{
case 0x00: pushCode(MICROCODE.ADDR_EAX); break;
case 0x08: pushCode(MICROCODE.ADDR_ECX); break;
case 0x10: pushCode(MICROCODE.ADDR_EDX); break;
case 0x18: pushCode(MICROCODE.ADDR_EBX); break;
case 0x28: pushCode(MICROCODE.ADDR_EBP); break;
case 0x30: pushCode(MICROCODE.ADDR_ESI); break;
case 0x38: pushCode(MICROCODE.ADDR_EDI); break;
case 0x40: pushCode(MICROCODE.ADDR_2EAX); break;
case 0x48: pushCode(MICROCODE.ADDR_2ECX); break;
case 0x50: pushCode(MICROCODE.ADDR_2EDX); break;
case 0x58: pushCode(MICROCODE.ADDR_2EBX); break;
case 0x68: pushCode(MICROCODE.ADDR_2EBP); break;
case 0x70: pushCode(MICROCODE.ADDR_2ESI); break;
case 0x78: pushCode(MICROCODE.ADDR_2EDI); break;
case 0x80: pushCode(MICROCODE.ADDR_4EAX); break;
case 0x88: pushCode(MICROCODE.ADDR_4ECX); break;
case 0x90: pushCode(MICROCODE.ADDR_4EDX); break;
case 0x98: pushCode(MICROCODE.ADDR_4EBX); break;
case 0xa8: pushCode(MICROCODE.ADDR_4EBP); break;
case 0xb0: pushCode(MICROCODE.ADDR_4ESI); break;
case 0xb8: pushCode(MICROCODE.ADDR_4EDI); break;
case 0xc0: pushCode(MICROCODE.ADDR_8EAX); break;
case 0xc8: pushCode(MICROCODE.ADDR_8ECX); break;
case 0xd0: pushCode(MICROCODE.ADDR_8EDX); break;
case 0xd8: pushCode(MICROCODE.ADDR_8EBX); break;
case 0xe8: pushCode(MICROCODE.ADDR_8EBP); break;
case 0xf0: pushCode(MICROCODE.ADDR_8ESI); break;
case 0xf8: pushCode(MICROCODE.ADDR_8EDI); break;
}
}
private void decodeSegmentPrefix()
{
if (isCode(MICROCODE.PREFIX_CS))
pushCode(MICROCODE.LOAD_SEG_CS);
else if (isCode(MICROCODE.PREFIX_SS))
pushCode(MICROCODE.LOAD_SEG_SS);
else if (isCode(MICROCODE.PREFIX_DS))
pushCode(MICROCODE.LOAD_SEG_DS);
else if (isCode(MICROCODE.PREFIX_ES))
pushCode(MICROCODE.LOAD_SEG_ES);
else if (isCode(MICROCODE.PREFIX_FS))
pushCode(MICROCODE.LOAD_SEG_FS);
else if (isCode(MICROCODE.PREFIX_GS))
pushCode(MICROCODE.LOAD_SEG_GS);
else
pushCode(MICROCODE.LOAD_SEG_DS);
}
private void decodeO(int modrm, int displacement)
{
//first figure out which segment to access
if (isCode(MICROCODE.PREFIX_CS))
pushCode(MICROCODE.LOAD_SEG_CS);
else if (isCode(MICROCODE.PREFIX_SS))
pushCode(MICROCODE.LOAD_SEG_SS);
else if (isCode(MICROCODE.PREFIX_DS))
pushCode(MICROCODE.LOAD_SEG_DS);
else if (isCode(MICROCODE.PREFIX_ES))
pushCode(MICROCODE.LOAD_SEG_ES);
else if (isCode(MICROCODE.PREFIX_FS))
pushCode(MICROCODE.LOAD_SEG_FS);
else if (isCode(MICROCODE.PREFIX_GS))
pushCode(MICROCODE.LOAD_SEG_GS);
else if ((modrm&0xc7)==0x02 || (modrm&0xc7)==0x03 || (modrm&0xc7)==0x42 || (modrm&0xc7)==0x43 || (modrm&0xc7)==0x46 || (modrm&0xc7)==0x82 || (modrm&0xc7)==0x83 || (modrm&0xc7)==0x86)
pushCode(MICROCODE.LOAD_SEG_SS);
else
pushCode(MICROCODE.LOAD_SEG_DS);
if(isAddressDecoded()) return;
if (isCode(MICROCODE.PREFIX_ADDRESS_32BIT))
pushCode(MICROCODE.ADDR_ID);
else
{
pushCode(MICROCODE.ADDR_IW);
pushCode(MICROCODE.ADDR_MASK_16);
}
pushCode(displacement);
}
private void decodeIrregularOperand(int opcode, int modrm, int sib, int displacement, long immediate, int operand)
{
//input 0
/*{ 0xc8, 0x62, 0xa0, 0xa1, 0xa4, 0xa5, 0xa6, 0xa7, 0xac, 0xad, 0xfa3, 0xfab, 0xfb3, 0xfbb, 0x6e, 0x6f, 0xd7, 0xf00, 0xf01, 0xf20, 0xf21, 0xf23, 0xfba, 0xfc8, 0xfc9, 0xfca, 0xfcb, 0xfcc, 0xfcd, 0xfce, 0xfcf}*/
if (operand==0)
{
switch(opcode)
{
case 0x8e: case 0xfb7: case 0xfbf:
effective_word(modrm, sib, displacement, operand);
break;
case 0xec: case 0xed: case 0xee: case 0xef: case 0x6c: case 0x6d:
pushCode(MICROCODE.LOAD0_DX);
break;
case 0xc2: case 0xca:
pushCode(MICROCODE.LOAD0_IW);
pushCode((int)(immediate));
break;
case 0xea: case 0x9a: //far jump or call
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
pushCode(MICROCODE.LOAD0_ID);
pushCode((int)immediate);
}
else
{
pushCode(MICROCODE.LOAD0_IW);
pushCode((int)(0xffff & immediate));
}
break;
case 0x8d: //lea
decode_memory(modrm, sib, displacement);
pushCode(MICROCODE.LOAD0_ADDR);
break;
case 0x8c: //store to segment register
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.LOAD0_ES); break;
case 0x08: pushCode(MICROCODE.LOAD0_CS); break;
case 0x10: pushCode(MICROCODE.LOAD0_SS); break;
case 0x18: pushCode(MICROCODE.LOAD0_DS); break;
case 0x20: pushCode(MICROCODE.LOAD0_FS); break;
case 0x28: pushCode(MICROCODE.LOAD0_GS); break;
// default: panic("Bad segment operand");
} break;
case 0xa0:
decodeO(modrm, displacement);
pushCode(MICROCODE.LOAD0_MEM_BYTE);
break;
case 0xa1:
decodeO(modrm, displacement);
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
pushCode(MICROCODE.LOAD0_MEM_DOUBLE);
else
pushCode(MICROCODE.LOAD0_MEM_WORD);
break;
case 0xa4: case 0xa5: case 0xa6: case 0xa7: case 0xac: case 0xad:
decodeSegmentPrefix();
break;
case 0x6e: case 0x6f:
pushCode(MICROCODE.LOAD0_DX);
decodeSegmentPrefix();
break;
case 0xc8:
pushCode(MICROCODE.LOAD0_IW);
// pushCode((int)(0xffffl & (immediate>>>16)));
pushCode((int)(0xffffl & immediate));
break;
case 0xd7:
if(isCode(MICROCODE.PREFIX_CS))
pushCode(MICROCODE.LOAD_SEG_CS);
else if(isCode(MICROCODE.PREFIX_SS))
pushCode(MICROCODE.LOAD_SEG_SS);
else if(isCode(MICROCODE.PREFIX_ES))
pushCode(MICROCODE.LOAD_SEG_ES);
else if(isCode(MICROCODE.PREFIX_FS))
pushCode(MICROCODE.LOAD_SEG_FS);
else if(isCode(MICROCODE.PREFIX_GS))
pushCode(MICROCODE.LOAD_SEG_GS);
else
pushCode(MICROCODE.LOAD_SEG_DS);
if (isCode(MICROCODE.PREFIX_ADDRESS_32BIT))
{
pushCode(MICROCODE.ADDR_EBX);
pushCode(MICROCODE.ADDR_AL);
}
else
{
pushCode(MICROCODE.ADDR_BX);
pushCode(MICROCODE.ADDR_AL);
pushCode(MICROCODE.ADDR_MASK_16);
}
pushCode(MICROCODE.LOAD0_MEM_BYTE);
break;
case 0xf00:
if ((modrm&0x38)==0x10 || (modrm&0x38)==0x18 || (modrm&0x38)==0x20 || (modrm&0x38)==0x28)
effective_word(modrm,sib,displacement,operand);
break;
case 0xf01:
if ((modrm&0x38)==0x10 || (modrm&0x38)==0x18 || (modrm&0x38)==0x30)
effective_word(modrm,sib,displacement,operand);
else if ((modrm&0x38)==0x38)
decode_memory(modrm,sib,displacement);
break;
case 0xf20:
load0_Cd(modrm); break;
case 0xf22:
load0_Rd(modrm); break;
case 0xfab: case 0xfa3: case 0xfbb: case 0xfb3:
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
switch(modrm&0xc7)
{
case 0xc0: pushCode(MICROCODE.LOAD0_EAX); break;
case 0xc1: pushCode(MICROCODE.LOAD0_ECX); break;
case 0xc2: pushCode(MICROCODE.LOAD0_EDX); break;
case 0xc3: pushCode(MICROCODE.LOAD0_EBX); break;
case 0xc4: pushCode(MICROCODE.LOAD0_ESP); break;
case 0xc5: pushCode(MICROCODE.LOAD0_EBP); break;
case 0xc6: pushCode(MICROCODE.LOAD0_ESI); break;
case 0xc7: pushCode(MICROCODE.LOAD0_EDI); break;
default: decode_memory(modrm, sib, displacement); break;
}
}
else
{
switch(modrm&0xc7)
{
case 0xc0: pushCode(MICROCODE.LOAD0_AX); break;
case 0xc1: pushCode(MICROCODE.LOAD0_CX); break;
case 0xc2: pushCode(MICROCODE.LOAD0_DX); break;
case 0xc3: pushCode(MICROCODE.LOAD0_BX); break;
case 0xc4: pushCode(MICROCODE.LOAD0_SP); break;
case 0xc5: pushCode(MICROCODE.LOAD0_BP); break;
case 0xc6: pushCode(MICROCODE.LOAD0_SI); break;
case 0xc7: pushCode(MICROCODE.LOAD0_DI); break;
default: decode_memory(modrm, sib, displacement); break;
}
}
break;
default:
panic("Need to decode irregular input 0 operand: "+opcode);
}
}
//input 1
/*{0xc8, 0xf6, 0xf7, 0x62, 0xc4, 0xc5, 0xfb2, 0xfb4, 0xfb5, 0xfba}*/
else if (operand==1)
{
switch(opcode)
{
case 0xc8: //enter
pushCode(MICROCODE.LOAD1_IB);
// pushCode((int)(0xffl & immediate));
pushCode((int)(0xffl & (immediate>>>24)));
break;
case 0xea: case 0x9a: //far jump or call
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
pushCode(MICROCODE.LOAD1_IW);
pushCode((int)(immediate>>>32));
}
else
{
pushCode(MICROCODE.LOAD1_IW);
pushCode((int)(immediate>>>16));
}
break;
case 0xf6: //una
if((modrm&0x38)==0)
{
pushCode(MICROCODE.LOAD1_IB);
pushCode((int)immediate);
} break;
case 0xf7: //una
if(isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
if((modrm&0x38)==0)
{
pushCode(MICROCODE.LOAD1_ID);
pushCode((int)immediate);
}
}
else
{
if((modrm&0x38)==0)
{
pushCode(MICROCODE.LOAD1_IW);
pushCode((int)immediate);
}
}
break;
case 0xff: //various jumps
if((modrm&0x38)==0x18 || (modrm&0x38)==0x28)
{
pushCode(MICROCODE.ADDR_IB);
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
pushCode(4);
else
pushCode(2);
pushCode(MICROCODE.LOAD1_MEM_WORD);
} break;
case 0xd0: case 0xd1:
pushCode(MICROCODE.LOAD1_IB);
pushCode(1);
break;
case 0xc4: case 0xc5: case 0xfb2: case 0xfb4: case 0xfb5:
pushCode(MICROCODE.ADDR_IB);
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
pushCode(4);
else
pushCode(2);
pushCode(MICROCODE.LOAD1_MEM_WORD);
break;
case 0xf01:
if ((modrm&0x38)==0x10 || (modrm&0x38)==0x18)
{
pushCode(MICROCODE.ADDR_ID);
pushCode(2);
pushCode(MICROCODE.LOAD1_MEM_DOUBLE);
}
break;
case 0xfab: case 0xfa3: case 0xfbb: case 0xfb3:
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.LOAD1_EAX); break;
case 0x08: pushCode(MICROCODE.LOAD1_ECX); break;
case 0x10: pushCode(MICROCODE.LOAD1_EDX); break;
case 0x18: pushCode(MICROCODE.LOAD1_EBX); break;
case 0x20: pushCode(MICROCODE.LOAD1_ESP); break;
case 0x28: pushCode(MICROCODE.LOAD1_EBP); break;
case 0x30: pushCode(MICROCODE.LOAD1_ESI); break;
case 0x38: pushCode(MICROCODE.LOAD1_EDI); break;
}
}
else
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.LOAD1_AX); break;
case 0x08: pushCode(MICROCODE.LOAD1_CX); break;
case 0x10: pushCode(MICROCODE.LOAD1_DX); break;
case 0x18: pushCode(MICROCODE.LOAD1_BX); break;
case 0x20: pushCode(MICROCODE.LOAD1_SP); break;
case 0x28: pushCode(MICROCODE.LOAD1_BP); break;
case 0x30: pushCode(MICROCODE.LOAD1_SI); break;
case 0x38: pushCode(MICROCODE.LOAD1_DI); break;
}
}
break;
default:
panic("Need to decode irregular input 1 operand: "+opcode);
}
}
//output 0
/*{0x8e, 0xa2, 0xd0, 0xd1, 0xf6, 0xf7, 0xf00, 0xf01, 0xf20, 0xf21, 0xf22, 0xf23, 0xf31, 0xf32, 0xfab, 0xfb3, 0xfbb, 0xfba, 0xfc8, 0xfc9, 0xfca, 0xfcb, 0xfcc, 0xfcd, 0xfce, 0xfcf}*/
else if (operand==2)
{
switch(opcode)
{
case 0x8e: //store to segment register
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.STORE0_ES); break;
case 0x08: pushCode(MICROCODE.STORE0_CS); break;
case 0x10: pushCode(MICROCODE.STORE0_SS); break;
case 0x18: pushCode(MICROCODE.STORE0_DS); break;
case 0x20: pushCode(MICROCODE.STORE0_FS); break;
case 0x28: pushCode(MICROCODE.STORE0_GS); break;
default: panic("Bad segment operand");
} break;
case 0xff:
if((modrm&0x38)==0x00 || (modrm&0x38)==0x08)
{
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
effective_double(modrm,sib,displacement,2);
else
effective_word(modrm,sib,displacement,2);
} break;
case 0xf6:
if((modrm&0x38)==0x10 || (modrm&0x38)==0x18)
{
effective_byte(modrm,sib,displacement,2);
} break;
case 0xf7:
if((modrm&0x38)==0x10 || (modrm&0x38)==0x18)
{
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
effective_double(modrm,sib,displacement,2);
else
effective_word(modrm,sib,displacement,2);
} break;
case 0xa2:
decodeO(modrm, displacement);
pushCode(MICROCODE.STORE0_MEM_BYTE);
break;
case 0xa3:
decodeO(modrm, displacement);
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
pushCode(MICROCODE.STORE0_MEM_DOUBLE);
else
pushCode(MICROCODE.STORE0_MEM_WORD);
break;
case 0x80: case 0x82:
if((modrm&0x38)!=0x38)
effective_byte(modrm,sib,displacement,2);
break;
case 0x81: case 0x83:
if((modrm&0x38)!=0x38)
{
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
effective_double(modrm,sib,displacement,2);
else
effective_word(modrm,sib,displacement,2);
}
break;
case 0xfab: case 0xfb3: case 0xfbb:
if((modrm&0xc0)==0xc0)
{
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
effective_double(modrm,sib,displacement,2);
else
effective_word(modrm,sib,displacement,2);
}
break;
case 0xf00:
if ((modrm&0x38)==0)
effective_word(modrm,sib,displacement,2);
else if ((modrm&0x38)==0x8)
{
if (isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
switch(modrm&0xc7)
{
case 0xc0: pushCode(MICROCODE.STORE0_EAX); break;
case 0xc1: pushCode(MICROCODE.STORE0_ECX); break;
case 0xc2: pushCode(MICROCODE.STORE0_EDX); break;
case 0xc3: pushCode(MICROCODE.STORE0_EBX); break;
case 0xc4: pushCode(MICROCODE.STORE0_ESP); break;
case 0xc5: pushCode(MICROCODE.STORE0_EBP); break;
case 0xc6: pushCode(MICROCODE.STORE0_ESI); break;
case 0xc7: pushCode(MICROCODE.STORE0_EDI); break;
default: decode_memory(modrm,sib,displacement); pushCode(MICROCODE.STORE0_MEM_WORD); break;
}
}
else
effective_word(modrm,sib,displacement,2);
}
break;
case 0xf01:
if ((modrm&0x38)==0x00 || (modrm&0x38)==0x08 || (modrm&0x38)==0x20)
effective_word(modrm,sib,displacement,2);
break;
case 0xf20:
store0_Rd(modrm); break;
case 0xf22:
store0_Cd(modrm); break;
case 0xf31:
pushCode(MICROCODE.STORE0_EAX); break;
default:
panic("Need to decode irregular output 0 operand: "+opcode);
}
}
//output 1
/*{0xf01, 0xf31, 0xf32}*/
else
{
switch(opcode)
{
case 0xf01:
if ((modrm&0x38)==0x0 || (modrm&0x38)==0x08)
{
pushCode(MICROCODE.ADDR_ID);
pushCode(2);
pushCode(MICROCODE.STORE1_MEM_DOUBLE);
}
break;
case 0xf31:
pushCode(MICROCODE.STORE0_EDX); break;
default:
panic("Need to decode irregular output 1 operand: "+opcode);
}
}
}
private void decodeFlags(int opcode, int modrm)
{
int tableindex=opcode;
if(tableindex>=0x0f00)
tableindex-=0xe00;
MICROCODE code=flagTable[tableindex];
if (code==MICROCODE.FLAG_ROTATE_08)
{
int val=((modrm & 0x38)>>3);
code=rotationTable[val];
pushCode(code);
}
else if (code==MICROCODE.FLAG_ROTATE_16)
{
int val=((modrm & 0x38)>>3);
code=rotationTable[8+val];
pushCode(code);
}
else if (code==MICROCODE.FLAG_80_82)
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.FLAG_ADD_08); break;
case 0x08: pushCode(MICROCODE.FLAG_BITWISE_08); break;
case 0x10: pushCode(MICROCODE.FLAG_ADC_08); break;
case 0x18: pushCode(MICROCODE.FLAG_SBB_08); break;
case 0x20: pushCode(MICROCODE.FLAG_BITWISE_08); break;
case 0x28: pushCode(MICROCODE.FLAG_SUB_08); break;
case 0x30: pushCode(MICROCODE.FLAG_BITWISE_08); break;
case 0x38: pushCode(MICROCODE.FLAG_SUB_08); break;
}
}
else if (code==MICROCODE.FLAG_81_83)
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.FLAG_ADD_16); break;
case 0x08: pushCode(MICROCODE.FLAG_BITWISE_16); break;
case 0x10: pushCode(MICROCODE.FLAG_ADC_16); break;
case 0x18: pushCode(MICROCODE.FLAG_SBB_16); break;
case 0x20: pushCode(MICROCODE.FLAG_BITWISE_16); break;
case 0x28: pushCode(MICROCODE.FLAG_SUB_16); break;
case 0x30: pushCode(MICROCODE.FLAG_BITWISE_16); break;
case 0x38: pushCode(MICROCODE.FLAG_SUB_16); break;
}
}
else if (code==MICROCODE.FLAG_REP_SUB_08)
{
if (isCode(MICROCODE.PREFIX_REPNE)||isCode(MICROCODE.PREFIX_REPE))
pushCode(MICROCODE.FLAG_REP_SUB_08);
else
pushCode(MICROCODE.FLAG_SUB_08);
}
else if (code==MICROCODE.FLAG_REP_SUB_16)
{
if (isCode(MICROCODE.PREFIX_REPNE)||isCode(MICROCODE.PREFIX_REPE))
pushCode(MICROCODE.FLAG_REP_SUB_16);
else
pushCode(MICROCODE.FLAG_SUB_16);
}
else if (code==MICROCODE.FLAG_F6)
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.FLAG_BITWISE_08); break;
case 0x18: pushCode(MICROCODE.FLAG_NEG_08); break;
}
}
else if (code==MICROCODE.FLAG_F7)
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.FLAG_BITWISE_16); break;
case 0x18: pushCode(MICROCODE.FLAG_NEG_16); break;
}
}
/* else if (code==MICROCODE.FLAG_8F)
{
// panic("Need to implement flags for instruction 0x8F");
if(!isCode(MICROCODE.STORE0_SP))
pushCode(MICROCODE.STORE1_ESP);
}*/
else if (code==MICROCODE.FLAG_FE)
{
switch(modrm & 0x38)
{
case 0x00: pushCode(MICROCODE.FLAG_INC_08); break;
case 0x08: pushCode(MICROCODE.FLAG_DEC_08); break;
}
}
else if (code==MICROCODE.FLAG_FF)
{
switch(modrm & 0x38)
{
case 0x00: pushCode(MICROCODE.FLAG_INC_16); break;
case 0x08: pushCode(MICROCODE.FLAG_DEC_16); break;
}
}
else if (code==MICROCODE.FLAG_UNIMPLEMENTED)
panic("Unimplemented flag code "+opcode);
else if (code==MICROCODE.FLAG_BAD)
panic("Invalid flag code "+opcode);
else
{
pushCode(code);
}
}
private void decodeOperation(int opcode, int modrm)
{
int tableindex=opcode;
if(tableindex>=0x0f00)
tableindex-=0xe00;
MICROCODE code=opcodeTable[tableindex];
//a few codes need to be decoded further
if (code==MICROCODE.OP_CBW) //CBW: 0x98
{
if(!isCode(MICROCODE.PREFIX_OPCODE_32BIT))
{
pushCode(MICROCODE.LOAD0_AL);
pushCode(MICROCODE.OP_SIGN_EXTEND_8_16);
pushCode(MICROCODE.STORE0_AX);
}
else
{
pushCode(MICROCODE.LOAD0_AX);
pushCode(MICROCODE.OP_SIGN_EXTEND_16_32);
pushCode(MICROCODE.STORE0_EAX);
}
}
else if (code==MICROCODE.OP_BT_16_32)
{
if ((modrm&0xc7)==0)
pushCode(MICROCODE.OP_BT_MEM);
else
pushCode(code);
}
else if (code==MICROCODE.OP_BTC_16_32)
{
if ((modrm&0xc7)==0)
pushCode(MICROCODE.OP_BTC_MEM);
else
pushCode(code);
}
else if (code==MICROCODE.OP_BTR_16_32)
{
if ((modrm&0xc7)==0)
pushCode(MICROCODE.OP_BTR_MEM);
else
pushCode(code);
}
else if (code==MICROCODE.OP_BTS_16_32)
{
if ((modrm&0xc7)==0)
pushCode(MICROCODE.OP_BTS_MEM);
else
pushCode(code);
}
else if (code==MICROCODE.OP_ROTATE_08) //rotates: 0xc0, 0xd0, 0xd2
{
int val=((modrm & 0x38)>>3);
code=rotationTable[16+val];
pushCode(code);
}
else if (code==MICROCODE.OP_ROTATE_16_32) //rotates: 0xc1, 0xd1, 0xd3
{
int val=((modrm & 0x38)>>3);
code=rotationTable[24+val];
pushCode(code);
}
else if (code==MICROCODE.OP_80_83) //imm: 80, 81, 82, 83
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.OP_ADD); break;
case 0x08: pushCode(MICROCODE.OP_OR); break;
case 0x10: pushCode(MICROCODE.OP_ADC); break;
case 0x18: pushCode(MICROCODE.OP_SBB); break;
case 0x20: pushCode(MICROCODE.OP_AND); break;
case 0x28: pushCode(MICROCODE.OP_SUB); break;
case 0x30: pushCode(MICROCODE.OP_XOR); break;
case 0x38: pushCode(MICROCODE.OP_SUB); break;
}
}
else if (code==MICROCODE.OP_F6) //una
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.OP_AND); break;
case 0x10: pushCode(MICROCODE.OP_NOT); break;
case 0x18: pushCode(MICROCODE.OP_NEG); break;
case 0x20: pushCode(MICROCODE.OP_MUL_08); break;
case 0x28: pushCode(MICROCODE.OP_IMULA_08); break;
case 0x30: pushCode(MICROCODE.OP_DIV_08); break;
case 0x38: pushCode(MICROCODE.OP_IDIV_08); break;
// default: panic("Bad UNA F6");
}
}
else if (code==MICROCODE.OP_F7) //una
{
switch(modrm&0x38)
{
case 0x00: pushCode(MICROCODE.OP_AND); break;
case 0x10: pushCode(MICROCODE.OP_NOT); break;
case 0x18: pushCode(MICROCODE.OP_NEG); break;
case 0x20: pushCode(MICROCODE.OP_MUL_16_32); break;
case 0x28: pushCode(MICROCODE.OP_IMULA_16_32); break;
case 0x30: pushCode(MICROCODE.OP_DIV_16_32); break;
case 0x38: pushCode(MICROCODE.OP_IDIV_16_32); break;
// default: panic("Bad UNA F7");
}
}
else if (code==MICROCODE.OP_FE)
{
switch(modrm & 0x38)
{
case 0x00: pushCode(MICROCODE.OP_INC); break;
case 0x08: pushCode(MICROCODE.OP_DEC); break;
}
}
else if (code==MICROCODE.OP_FF)
{
switch(modrm & 0x38)
{
case 0x00: pushCode(MICROCODE.OP_INC); break;
case 0x08: pushCode(MICROCODE.OP_DEC); break;
case 0x10: pushCode(MICROCODE.OP_CALL_ABS); break;
case 0x18: pushCode(MICROCODE.OP_CALL_FAR); break;
case 0x20: pushCode(MICROCODE.OP_JMP_ABS); break;
case 0x28: pushCode(MICROCODE.OP_JMP_FAR); break;
case 0x30: pushCode(MICROCODE.OP_PUSH); break;
default: //panic("Invalid operation FF code");
}
}
else if (code==MICROCODE.OP_F00)
{
switch(modrm & 0x38)
{
case 0x00: pushCode(MICROCODE.OP_SLDT); break;
case 0x08: pushCode(MICROCODE.OP_STR); break;
case 0x10: pushCode(MICROCODE.OP_LLDT); break;
case 0x18: pushCode(MICROCODE.OP_LTR); break;
case 0x20: pushCode(MICROCODE.OP_VERR); break;
case 0x28: pushCode(MICROCODE.OP_VERW); break;
default: panic("Invalid operation F00 code: "+(modrm&0x38)); break;
}
}
else if (code==MICROCODE.OP_F01)
{
switch(modrm & 0x38)
{
case 0x00: pushCode(MICROCODE.OP_SGDT); break;
case 0x08: pushCode(MICROCODE.OP_SIDT); break;
case 0x10: pushCode(MICROCODE.OP_LGDT); break;
case 0x18: pushCode(MICROCODE.OP_LIDT); break;
case 0x20: pushCode(MICROCODE.OP_SMSW); break;
case 0x30: pushCode(MICROCODE.OP_LMSW); break;
default: panic("Invalid operation F01 code"); break;
}
}
else if (code==MICROCODE.OP_BAD)
{
panic("Invalid instruction "+opcode);
return;
}
else if (code==MICROCODE.OP_UNIMPLEMENTED)
{
// pushCode(MICROCODE.OP_UNIMPLEMENTED);
panic("Unimplemented instruction "+opcode);
return;
}
else
{
//handle repeat codes
if(isCode(MICROCODE.PREFIX_REPE) || isCode(MICROCODE.PREFIX_REPNE))
switch(opcode)
{
case 0x6c: pushCode(MICROCODE.OP_REP_INSB); break;
case 0x6d: pushCode(MICROCODE.OP_REP_INSW); break;
case 0x6e: pushCode(MICROCODE.OP_REP_OUTSB); break;
case 0x6f: pushCode(MICROCODE.OP_REP_OUTSW); break;
case 0xa4: pushCode(MICROCODE.OP_REP_MOVSB); break;
case 0xa5: pushCode(MICROCODE.OP_REP_MOVSW); break;
case 0xaa: pushCode(MICROCODE.OP_REP_STOSB); break;
case 0xab: pushCode(MICROCODE.OP_REP_STOSW); break;
case 0xac: pushCode(MICROCODE.OP_REP_LODSB); break;
case 0xad: pushCode(MICROCODE.OP_REP_LODSW); break;
case 0xa6:
if(isCode(MICROCODE.PREFIX_REPE)) pushCode(MICROCODE.OP_REPE_CMPSB);
else pushCode(MICROCODE.OP_REPNE_CMPSB);
break;
case 0xa7:
if(isCode(MICROCODE.PREFIX_REPE)) pushCode(MICROCODE.OP_REPE_CMPSW);
else pushCode(MICROCODE.OP_REPNE_CMPSW);
break;
case 0xae:
if(isCode(MICROCODE.PREFIX_REPE)) pushCode(MICROCODE.OP_REPE_SCASB);
else pushCode(MICROCODE.OP_REPNE_SCASB);
break;
case 0xaf:
if(isCode(MICROCODE.PREFIX_REPE)) pushCode(MICROCODE.OP_REPE_SCASW);
else pushCode(MICROCODE.OP_REPNE_SCASW);
break;
}
//normal instructions: repush
else
pushCode(code);
}
if(processorGUICode!=null) processorGUICode.pushInstruction(this.code[codeLength-1],opcode);
}
private void replaceFlags1632()
{
for (int i=0; i<codeLength; i++)
{
if (code[i]==MICROCODE.FLAG_BITWISE_16) code[i]=MICROCODE.FLAG_BITWISE_32;
else if (code[i]==MICROCODE.FLAG_ADD_16) code[i]=MICROCODE.FLAG_ADD_32;
else if (code[i]==MICROCODE.FLAG_ADC_16) code[i]=MICROCODE.FLAG_ADC_32;
else if (code[i]==MICROCODE.FLAG_SUB_16) code[i]=MICROCODE.FLAG_SUB_32;
else if (code[i]==MICROCODE.FLAG_SBB_16) code[i]=MICROCODE.FLAG_SBB_32;
else if (code[i]==MICROCODE.FLAG_SHL_16) code[i]=MICROCODE.FLAG_SHL_32;
else if (code[i]==MICROCODE.FLAG_SHR_16) code[i]=MICROCODE.FLAG_SHR_32;
else if (code[i]==MICROCODE.FLAG_SAR_16) code[i]=MICROCODE.FLAG_SAR_32;
else if (code[i]==MICROCODE.FLAG_ROL_16) code[i]=MICROCODE.FLAG_ROL_32;
else if (code[i]==MICROCODE.FLAG_ROR_16) code[i]=MICROCODE.FLAG_ROR_32;
else if (code[i]==MICROCODE.FLAG_RCL_16) code[i]=MICROCODE.FLAG_RCL_32;
else if (code[i]==MICROCODE.FLAG_RCR_16) code[i]=MICROCODE.FLAG_RCR_32;
else if (code[i]==MICROCODE.FLAG_NEG_16) code[i]=MICROCODE.FLAG_NEG_32;
else if (code[i]==MICROCODE.FLAG_REP_SUB_16) code[i]=MICROCODE.FLAG_REP_SUB_32;
else if (code[i]==MICROCODE.FLAG_INC_16) code[i]=MICROCODE.FLAG_INC_32;
else if (code[i]==MICROCODE.FLAG_DEC_16) code[i]=MICROCODE.FLAG_DEC_32;
}
}
public final Processor_Exception DIVIDE_ERROR = new Processor_Exception(0x00);
public final Processor_Exception DEBUG = new Processor_Exception(0x01);
public final Processor_Exception BREAKPOINT = new Processor_Exception(0x03);
public final Processor_Exception OVERFLOW = new Processor_Exception(0x04);
public final Processor_Exception BOUND_RANGE = new Processor_Exception(0x05);
public final Processor_Exception UNDEFINED = new Processor_Exception(0x06);
public final Processor_Exception NO_FPU = new Processor_Exception(0x07);
public final Processor_Exception DOUBLE_FAULT = new Processor_Exception(0x08);
public final Processor_Exception FPU_SEGMENT_OVERRUN = new Processor_Exception(0x09);
public final Processor_Exception TASK_SWITCH = new Processor_Exception(0x0a);
public final Processor_Exception NOT_PRESENT = new Processor_Exception(0x0b);
public final Processor_Exception STACK_SEGMENT = new Processor_Exception(0x0c);
public final Processor_Exception GENERAL_PROTECTION = new Processor_Exception(0x0d);
public final Processor_Exception PAGE_FAULT = new Processor_Exception(0x0e);
public final Processor_Exception FLOATING_POINT = new Processor_Exception(0x10);
public final Processor_Exception ALIGNMENT_CHECK = new Processor_Exception(0x11);
public final Processor_Exception MACHINE_CHECK = new Processor_Exception(0x12);
public final Processor_Exception SIMD_FLOATING_POINT = new Processor_Exception(0x13);
public class Processor_Exception extends RuntimeException
{
private static final long serialVersionUID = 1L;
int vector;
public Processor_Exception(int vector)
{
this.vector=vector;
}
}
public void constructProcessorGUICode()
{
processorGUICode=new ProcessorGUICode();
}
public class ProcessorGUICode
{
private String addressString;
ArrayList<GUICODE> code;
ArrayList<String> name;
ArrayList<String> value;
int instructionNumber;
// int displacement;
public ProcessorGUICode()
{
code=new ArrayList<GUICODE>();
name=new ArrayList<String>();
value=new ArrayList<String>();
addressString="";
instructionNumber=instructionCount++;
}
public void updateMemoryGUI()
{
if (computer.memoryGUI==null) return;
try{
for (int i=0; i<code.size(); i++)
{
int j;
if (code.get(i)==null) return;
switch(code.get(i))
{
case CS_MEMORY_READ: computer.memoryGUI.codeRead(Integer.parseInt(name.get(i),16)); break;
case CS_MEMORY_WRITE: computer.memoryGUI.codeWrite(Integer.parseInt(name.get(i),16)); break;
case SS_MEMORY_READ: computer.memoryGUI.stackRead(Integer.parseInt(name.get(i),16)); break;
case SS_MEMORY_WRITE:
for (j=0; j<i; j++)
if (code.get(j)==GUICODE.DECODE_INPUT_OPERAND_0)
break;
if (j<i)
{
int size=1;
if (!name.equals("") && name.get(j).charAt(0)=='e') size=4;
else if (name.get(j).equals("ax")||name.get(j).equals("bx")||name.get(j).equals("cx")||name.get(j).equals("dx")||name.get(j).equals("sp")||name.get(j).equals("bp")||name.get(j).equals("si")||name.get(j).equals("di")||name.get(j).equals("cs")||name.get(j).equals("ss")||name.get(j).equals("ds")||name.get(j).equals("es")||name.get(j).equals("fs")||name.get(j).equals("gs")||name.get(j).equals("ip")) size=2;
computer.memoryGUI.stackWrite(Integer.parseInt(name.get(i),16),name.get(j),size); break;
}
computer.memoryGUI.stackWrite(Integer.parseInt(name.get(i),16)); break;
case DS_MEMORY_READ: computer.memoryGUI.dataRead(Integer.parseInt(name.get(i),16)); break;
case DS_MEMORY_WRITE: computer.memoryGUI.dataWrite(Integer.parseInt(name.get(i),16)); break;
case ES_MEMORY_READ: case FS_MEMORY_READ: case GS_MEMORY_READ:
computer.memoryGUI.extraRead(Integer.parseInt(name.get(i),16)); break;
case ES_MEMORY_WRITE: case FS_MEMORY_WRITE: case GS_MEMORY_WRITE:
computer.memoryGUI.extraWrite(Integer.parseInt(name.get(i),16)); break;
case IDTR_MEMORY_READ: computer.memoryGUI.interruptRead(Integer.parseInt(name.get(i),16)); break;
case IDTR_MEMORY_WRITE: computer.memoryGUI.interruptWrite(Integer.parseInt(name.get(i),16)); break;
}
}
}catch(Exception e){}
computer.memoryGUI.updateIP(cs.address(eip.getValue()));
}
public void updateGUI()
{
if (computer.processorGUI==null) return;
if (!computer.debugMode && !computer.updateGUIOnPlay) return;
System.out.println("Instruction "+instructionNumber+":");
for (int i=0; i<code.size(); i++)
{
if (computer.processorGUI!=null) computer.processorGUI.applyCode(code.get(i),name.get(i),value.get(i));
System.out.print(code.get(i));
System.out.print(" ");
if (!name.get(i).equals(""))
System.out.print(name.get(i)+" ");
if (!value.get(i).equals(""))
System.out.print(value.get(i));
System.out.println();
}
}
public String constructName()
{
boolean o0=false, i0=false;
String n="";
for (int i=0; i<code.size(); i++)
{
if (code.get(i)==GUICODE.DECODE_INSTRUCTION)
{
n=name.get(i);
break;
}
}
for (int i=0; i<code.size(); i++)
{
if (code.get(i)==GUICODE.DECODE_OUTPUT_OPERAND_0)
{
n=n+" "+name.get(i);
o0=true;
break;
}
}
for (int i=0; i<code.size(); i++)
{
if (code.get(i)==GUICODE.DECODE_INPUT_OPERAND_0)
{
i0=true;
if(o0)
n=n+" =";
if (name.get(i).equals("immediate"))
n=n+" "+Integer.toHexString(getLastiCode());
else
n=n+" "+name.get(i);
break;
}
}
for (int i=0; i<code.size(); i++)
{
if (code.get(i)==GUICODE.DECODE_INPUT_OPERAND_1)
{
if(i0)
n=n+",";
else if (o0)
n=n+" =";
if (name.get(i).equals("immediate"))
n=n+" "+Integer.toHexString(getLastiCode());
else
n=n+" "+name.get(i);
break;
}
}
for (int i=0; i<code.size(); i++)
{
if (code.get(i)==GUICODE.DECODE_INPUT_OPERAND_2)
{
if(i0)
n=n+",";
else if (o0)
n=n+" =";
if (name.get(i).equals("immediate"))
n=n+" "+Integer.toHexString(getLastiCode());
else
n=n+" "+name.get(i);
break;
}
}
return n;
}
public void push(GUICODE guicode)
{
code.add(guicode);
name.add("");
value.add("");
}
public void push(GUICODE guicode, String name)
{
code.add(guicode);
this.name.add(name);
value.add("");
}
public void push(GUICODE guicode, String name, int value)
{
code.add(guicode);
this.name.add(name);
this.value.add(Integer.toHexString(value));
}
public void push(GUICODE guicode, int name, int value)
{
code.add(guicode);
this.name.add(Integer.toHexString(name));
this.value.add(Integer.toHexString(value));
}
public void push(GUICODE guicode, int name)
{
code.add(guicode);
this.name.add(Integer.toHexString(name));
this.value.add("");
}
public void pushFetch(int ip)
{
push(GUICODE.FETCH,ip);
}
public void pushFlag(int type, int value)
{
String name="";
switch(type)
{
case Flag.AUXILIARYCARRY: name="auxiliary carry"; break;
case Flag.CARRY: name="carry"; break;
case Flag.SIGN: name="sign"; break;
case Flag.PARITY: name="parity"; break;
case Flag.ZERO: name="zero"; break;
case Flag.OVERFLOW: name="overflow"; break;
default: name="other"; break;
}
if (value==0)
push(GUICODE.FLAG_CLEAR,name);
else if (value==1)
push(GUICODE.FLAG_SET,name);
// else
// push(GUICODE.FLAG_READ,name);
}
public void pushRegister(int id, int access, int value)
{
String name="";
switch(id)
{
case Register.EAX: name="eax"; break;
case Register.EBX: name="ebx"; break;
case Register.ECX: name="ecx"; break;
case Register.EDX: name="edx"; break;
case Register.ESI: name="esi"; break;
case Register.EDI: name="edi"; break;
case Register.ESP: name="esp"; break;
case Register.EBP: name="ebp"; break;
case Register.EIP: name="eip"; break;
case Register.CR0: name="cr0"; break;
case Register.CR2: name="cr2"; break;
case Register.CR3: name="cr3"; break;
case Register.CR4: name="cr4"; break;
}
if (access!=0)
push(GUICODE.REGISTER_WRITE,name,value);
// else
// push(GUICODE.REGISTER_READ,name,value);
}
public void pushSegment(int id, int access, int value)
{
String name="";
switch(id)
{
case Segment.CS: name="cs"; break;
case Segment.SS: name="ss"; break;
case Segment.DS: name="ds"; break;
case Segment.ES: name="es"; break;
case Segment.FS: name="fs"; break;
case Segment.GS: name="gs"; break;
case Segment.IDTR: name="idtr"; break;
case Segment.GDTR: name="gdtr"; break;
case Segment.LDTR: name="ldtr"; break;
case Segment.TSS: name="tss"; break;
}
if (access!=0)
push(GUICODE.REGISTER_WRITE,name,value);
// else
// push(GUICODE.REGISTER_READ,name,value);
}
public void pushMemory(int segid, int segvalue, int access, int address, short value)
{
pushMemory(segid,segvalue,access,address,(byte)(value));
pushMemory(segid,segvalue,access,address,(byte)(value>>>8));
}
public void pushMemory(int segid, int segvalue, int access, int address, int value)
{
pushMemory(segid,segvalue,access,address,(byte)(value));
pushMemory(segid,segvalue,access,address,(byte)(value>>>8));
pushMemory(segid,segvalue,access,address,(byte)(value>>>16));
pushMemory(segid,segvalue,access,address,(byte)(value>>>24));
}
public void pushMemory(int segid, int segvalue, int access, int address, long value)
{
pushMemory(segid,segvalue,access,address,(byte)(value));
pushMemory(segid,segvalue,access,address,(byte)(value>>>8));
pushMemory(segid,segvalue,access,address,(byte)(value>>>16));
pushMemory(segid,segvalue,access,address,(byte)(value>>>24));
pushMemory(segid,segvalue,access,address,(byte)(value>>>32));
pushMemory(segid,segvalue,access,address,(byte)(value>>>40));
pushMemory(segid,segvalue,access,address,(byte)(value>>>48));
pushMemory(segid,segvalue,access,address,(byte)(value>>>56));
}
public void pushMemory(int segid, int segvalue, int access, int address, byte value)
{
pushSegment(segid,0,segvalue);
if(access==0)
{
switch(segid)
{
case Segment.CS: push(GUICODE.CS_MEMORY_READ,address,value); break;
case Segment.SS: push(GUICODE.SS_MEMORY_READ,address,value); break;
case Segment.DS: push(GUICODE.DS_MEMORY_READ,address,value); break;
case Segment.ES: push(GUICODE.ES_MEMORY_READ,address,value); break;
case Segment.FS: push(GUICODE.FS_MEMORY_READ,address,value); break;
case Segment.GS: push(GUICODE.GS_MEMORY_READ,address,value); break;
case Segment.IDTR: push(GUICODE.IDTR_MEMORY_READ,address,value); break;
case Segment.GDTR: push(GUICODE.GDTR_MEMORY_READ,address,value); break;
case Segment.LDTR: push(GUICODE.LDTR_MEMORY_READ,address,value); break;
case Segment.TSS: push(GUICODE.TSS_MEMORY_READ,address,value); break;
}
}
else
{
switch(segid)
{
case Segment.CS: push(GUICODE.CS_MEMORY_WRITE,address,value); break;
case Segment.SS: push(GUICODE.SS_MEMORY_WRITE,address,value); break;
case Segment.DS: push(GUICODE.DS_MEMORY_WRITE,address,value); break;
case Segment.ES: push(GUICODE.ES_MEMORY_WRITE,address,value); break;
case Segment.FS: push(GUICODE.FS_MEMORY_WRITE,address,value); break;
case Segment.GS: push(GUICODE.GS_MEMORY_WRITE,address,value); break;
case Segment.IDTR: push(GUICODE.IDTR_MEMORY_WRITE,address,value); break;
case Segment.GDTR: push(GUICODE.GDTR_MEMORY_WRITE,address,value); break;
case Segment.LDTR: push(GUICODE.LDTR_MEMORY_WRITE,address,value); break;
case Segment.TSS: push(GUICODE.TSS_MEMORY_WRITE,address,value); break;
}
}
}
public void pushInstruction(MICROCODE microcode, int opcode)
{
String name="";
switch(microcode)
{
case OP_MOV: name="mov"; break;
case OP_JMP_FAR: name="jmp far"; break;
case OP_JMP_ABS: name="jmp abs"; break;
case OP_JMP_08: name="jmp"; break;
case OP_JMP_16_32: name="jmp"; break;
case OP_CALL_FAR: name="call far"; break;
case OP_CALL_ABS: name="call abs"; break;
case OP_CALL: name="call"; break;
case OP_RET: name="ret"; break;
case OP_RET_IW: name="ret iw"; break;
case OP_RET_FAR: name="ret far"; break;
case OP_RET_FAR_IW: name="ret far iw"; break;
case OP_JO: name="jo"; break;
case OP_JO_16_32: name="jo"; break;
case OP_JNO: name="jno"; break;
case OP_JNO_16_32: name="jno"; break;
case OP_JC: name="jc"; break;
case OP_JC_16_32: name="jc"; break;
case OP_JNC: name="jnc"; break;
case OP_JNC_16_32: name="jnc"; break;
case OP_JS: name="js"; break;
case OP_JS_16_32: name="js"; break;
case OP_JNS: name="jns"; break;
case OP_JNS_16_32: name="jns"; break;
case OP_JZ: name="jz"; break;
case OP_JZ_16_32: name="jz"; break;
case OP_JNZ: name="jnz"; break;
case OP_JNZ_16_32: name="jnz"; break;
case OP_JP: name="jp"; break;
case OP_JP_16_32: name="jp"; break;
case OP_JNP: name="jnp"; break;
case OP_JNP_16_32: name="jnp"; break;
case OP_JA: name="ja"; break;
case OP_JA_16_32: name="ja"; break;
case OP_JNA: name="jna"; break;
case OP_JNA_16_32: name="jna"; break;
case OP_JL: name="jl"; break;
case OP_JL_16_32: name="jl"; break;
case OP_JNL: name="jnl"; break;
case OP_JNL_16_32: name="jnl"; break;
case OP_JG: name="jg"; break;
case OP_JG_16_32: name="jg"; break;
case OP_JNG: name="jng"; break;
case OP_JNG_16_32: name="jng"; break;
case OP_LOOP_CX: name="loop cx"; break;
case OP_LOOPZ_CX: name="loopz cx"; break;
case OP_LOOPNZ_CX: name="loopnz cx"; break;
case OP_JCXZ: name="jcxz"; break;
case OP_IN_08: name="in"; break;
case OP_IN_16_32: name="in"; break;
case OP_INSB: name="insb"; break;
case OP_INSW: name="insw"; break;
case OP_REP_INSB: name="rep insb"; break;
case OP_REP_INSW: name="rep insw"; break;
case OP_OUT_08: name="out"; break;
case OP_OUT_16_32: name="out"; break;
case OP_OUTSB: name="outsb"; break;
case OP_OUTSW: name="outsw"; break;
case OP_REP_OUTSB: name="rep outsb"; break;
case OP_REP_OUTSW: name="rep outsw"; break;
case OP_INT: name="int"; break;
case OP_INT3: name="int"; break;
case OP_IRET: name="iret"; break;
case OP_INC: name="inc"; break;
case OP_DEC: name="dec"; break;
case OP_ADD: name="add"; break;
case OP_ADC: name="adc"; break;
case OP_SUB: name="sub"; break;
case OP_CMP: name="cmp"; break;
case OP_SBB: name="sbb"; break;
case OP_AND: name="and"; break;
case OP_TEST: name="test"; break;
case OP_OR: name="or"; break;
case OP_XOR: name="xor"; break;
case OP_ROL_08: name="rol"; break;
case OP_ROL_16_32: name="rol"; break;
case OP_ROR_08: name="ror"; break;
case OP_ROR_16_32: name="ror"; break;
case OP_RCL_08: name="rcl"; break;
case OP_RCL_16_32: name="rcl"; break;
case OP_RCR_08: name="rcr"; break;
case OP_RCR_16_32: name="rcr"; break;
case OP_SHL: name="shl"; break;
case OP_SHR: name="shr"; break;
case OP_SAR_08: name="sar"; break;
case OP_SAR_16_32: name="sar"; break;
case OP_NOT: name="not"; break;
case OP_NEG: name="neg"; break;
case OP_MUL_08: name="mul"; break;
case OP_MUL_16_32: name="mul"; break;
case OP_IMULA_08: name="imula"; break;
case OP_IMULA_16_32: name="imula"; break;
case OP_IMUL_16_32: name="imul"; break;
case OP_DIV_08: name="div"; break;
case OP_DIV_16_32: name="div"; break;
case OP_IDIV_08: name="idiv"; break;
case OP_IDIV_16_32: name="idiv"; break;
case OP_BT_MEM: name="bt_mem"; break;
case OP_BTS_MEM: name="bts_mem"; break;
case OP_BTR_MEM: name="btr_mem"; break;
case OP_BTC_MEM: name="btc_mem"; break;
case OP_BT_16_32: name="bt"; break;
case OP_BTS_16_32: name="bts"; break;
case OP_BTR_16_32: name="btr"; break;
case OP_BTC_16_32: name="btc"; break;
case OP_SHLD_16_32: name="shld"; break;
case OP_SHRD_16_32: name="shrd"; break;
case OP_AAA: name="aaa"; break;
case OP_AAD: name="aad"; break;
case OP_AAM: name="aam"; break;
case OP_AAS: name="aas"; break;
case OP_CWD: name="cwd"; break;
case OP_DAA: name="daa"; break;
case OP_DAS: name="das"; break;
case OP_BOUND: name="bound"; break;
case OP_SIGN_EXTEND: name="cdw"; break;
case OP_SIGN_EXTEND_8_16: name="cdw"; break;
case OP_SIGN_EXTEND_8_32: name="cdw"; break;
case OP_SIGN_EXTEND_16_32: name="cdw"; break;
case OP_SCASB: name="scasb"; break;
case OP_SCASW: name="scasw"; break;
case OP_REPNE_SCASB: name="repne scasb"; break;
case OP_REPE_SCASB: name="repe scasb"; break;
case OP_REPNE_SCASW: name="repne scasw"; break;
case OP_REPE_SCASW: name="repe scasw"; break;
case OP_CMPSB: name="cmpsb"; break;
case OP_CMPSW: name="cmpsw"; break;
case OP_REPNE_CMPSB: name="repne cmpsb"; break;
case OP_REPE_CMPSB: name="repe cmpsb"; break;
case OP_REPNE_CMPSW: name="repne cmpsw"; break;
case OP_REPE_CMPSW: name="repe cmpsw"; break;
case OP_LODSB: name="lodsb"; break;
case OP_LODSW: name="lodsw"; break;
case OP_REP_LODSB: name="rep lodsb"; break;
case OP_REP_LODSW: name="rep lodsw"; break;
case OP_STOSB: name="stosb"; break;
case OP_STOSW: name="stosw"; break;
case OP_REP_STOSB: name="rep stosb"; break;
case OP_REP_STOSW: name="rep stosw"; break;
case OP_MOVSB: name="movsb"; break;
case OP_MOVSW: name="movsw"; break;
case OP_REP_MOVSB: name="rep movsb"; break;
case OP_REP_MOVSW: name="rep movsw"; break;
case OP_CLC: name="clc"; break;
case OP_STC: name="stc"; break;
case OP_CLI: name="cli"; break;
case OP_STI: name="sti"; break;
case OP_CLD: name="cld"; break;
case OP_STD: name="std"; break;
case OP_CMC: name="cmc"; break;
case OP_SETO: name="seto"; break;
case OP_SETNO: name="setno"; break;
case OP_SETC: name="setc"; break;
case OP_SETNC: name="setnc"; break;
case OP_SETZ: name="setz"; break;
case OP_SETNZ: name="setnz"; break;
case OP_SETA: name="seta"; break;
case OP_SETNA: name="setna"; break;
case OP_SETL: name="setl"; break;
case OP_SETNL: name="setnl"; break;
case OP_SETG: name="setg"; break;
case OP_SETNG: name="setng"; break;
case OP_SETS: name="sets"; break;
case OP_SETNS: name="setns"; break;
case OP_SETP: name="setp"; break;
case OP_SETNP: name="setnp"; break;
case OP_SALC: name="salc"; break;
case OP_LAHF: name="lahf"; break;
case OP_SAHF: name="sahf"; break;
case OP_CMOVO: name="cmovo"; break;
case OP_CMOVNO: name="cmovno"; break;
case OP_CMOVC: name="cmovc"; break;
case OP_CMOVNC: name="cmovnc"; break;
case OP_CMOVZ: name="cmovz"; break;
case OP_CMOVNZ: name="cmovnz"; break;
case OP_CMOVP: name="cmovp"; break;
case OP_CMOVNP: name="cmovnp"; break;
case OP_CMOVS: name="cmovs"; break;
case OP_CMOVNS: name="cmovns"; break;
case OP_CMOVL: name="cmovl"; break;
case OP_CMOVNL: name="cmovnl"; break;
case OP_CMOVG: name="cmovg"; break;
case OP_CMOVNG: name="cmovng"; break;
case OP_CMOVA: name="cmova"; break;
case OP_CMOVNA: name="cmovna"; break;
case OP_POP: name="pop"; break;
case OP_POPF: name="popf"; break;
case OP_POPA: name="popa"; break;
case OP_LEAVE: name="leave"; break;
case OP_PUSH: name="push"; break;
case OP_PUSHF: name="pushf"; break;
case OP_PUSHA: name="pusha"; break;
case OP_ENTER: name="enter"; break;
case OP_LGDT: name="lgdt"; break;
case OP_LIDT: name="lidt"; break;
case OP_LLDT: name="lldt"; break;
case OP_LMSW: name="lmsw"; break;
case OP_LTR: name="ltr"; break;
case OP_SGDT: name="sgdt"; break;
case OP_SIDT: name="sidt"; break;
case OP_SLDT: name="sldt"; break;
case OP_SMSW: name="smsw"; break;
case OP_STR: name="str"; break;
case OP_CLTS: name="clts"; break;
case OP_CPUID: name="cpuid"; break;
case OP_HALT: name="halt"; break;
case OP_RDTSC: name="rdtsc"; break;
default: name="nop"; break;
}
push(GUICODE.DECODE_INSTRUCTION, name);
}
public void pushMicrocode(MICROCODE microcode, int reg0, int reg1, int reg2, int addr, int displacement, boolean condition)
{
String name="";
switch(microcode)
{
case LOAD_SEG_CS: addressString="cs:"; push(GUICODE.DECODE_SEGMENT_ADDRESS,"cs"); break;
case LOAD_SEG_SS: addressString="ss:"; push(GUICODE.DECODE_SEGMENT_ADDRESS,"ss"); break;
case LOAD_SEG_DS: addressString="ds:"; push(GUICODE.DECODE_SEGMENT_ADDRESS,"ds"); break;
case LOAD_SEG_ES: addressString="es:"; push(GUICODE.DECODE_SEGMENT_ADDRESS,"es"); break;
case LOAD_SEG_FS: addressString="fs:"; push(GUICODE.DECODE_SEGMENT_ADDRESS,"fs"); break;
case LOAD_SEG_GS: addressString="gs:"; push(GUICODE.DECODE_SEGMENT_ADDRESS,"gs"); break;
case ADDR_AX: addressString+="ax+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"ax"); break;
case ADDR_BX: addressString+="bx+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bx"); break;
case ADDR_CX: addressString+="cx+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"cx"); break;
case ADDR_DX: addressString+="dx+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"dx"); break;
case ADDR_SP: addressString+="sp+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"sp"); break;
case ADDR_BP: addressString+="bp+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bp"); break;
case ADDR_SI: addressString+="si+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"si"); break;
case ADDR_DI: addressString+="di+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"di"); break;
case ADDR_EAX: addressString+="eax+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"ax"); break;
case ADDR_EBX: addressString+="ebx+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bx"); break;
case ADDR_ECX: addressString+="ecx+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"cx"); break;
case ADDR_EDX: addressString+="edx+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"dx"); break;
case ADDR_ESP: addressString+="esp+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"sp"); break;
case ADDR_EBP: addressString+="ebp+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bp"); break;
case ADDR_ESI: addressString+="esi+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"si"); break;
case ADDR_EDI: addressString+="edi+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"di"); break;
case ADDR_2EAX: addressString+="eax*2+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"ax"); break;
case ADDR_2EBX: addressString+="ebx*2+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bx"); break;
case ADDR_2ECX: addressString+="ecx*2+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"cx"); break;
case ADDR_2EDX: addressString+="edx*2+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"dx"); break;
case ADDR_2EBP: addressString+="ebp*2+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bp"); break;
case ADDR_2ESI: addressString+="esi*2+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"si"); break;
case ADDR_2EDI: addressString+="edi*2+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"di"); break;
case ADDR_4EAX: addressString+="eax*4+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"ax"); break;
case ADDR_4EBX: addressString+="ebx*4+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bx"); break;
case ADDR_4ECX: addressString+="ecx*4+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"cx"); break;
case ADDR_4EDX: addressString+="edx*4+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"dx"); break;
case ADDR_4EBP: addressString+="ebp*4+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bp"); break;
case ADDR_4ESI: addressString+="esi*4+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"si"); break;
case ADDR_4EDI: addressString+="edi*4+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"di"); break;
case ADDR_8EAX: addressString+="eax*8+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"ax"); break;
case ADDR_8EBX: addressString+="ebx*8+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bx"); break;
case ADDR_8ECX: addressString+="ecx*8+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"cx"); break;
case ADDR_8EDX: addressString+="edx*8+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"dx"); break;
case ADDR_8EBP: addressString+="ebp*8+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"bp"); break;
case ADDR_8ESI: addressString+="esi*8+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"si"); break;
case ADDR_8EDI: addressString+="edi*8+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"di"); break;
case ADDR_IB: addressString+=Integer.toHexString(displacement)+"+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"displacement",displacement); break;
case ADDR_IW: addressString+=Integer.toHexString(displacement)+"+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"displacement",displacement); break;
case ADDR_ID: addressString+=Integer.toHexString(displacement)+"+"; push(GUICODE.DECODE_MEMORY_ADDRESS,"displacement",displacement); break;
case LOAD2_AX: name="ax"; push(GUICODE.DECODE_INPUT_OPERAND_2,name,reg2); break;
case LOAD2_EAX: name="eax"; push(GUICODE.DECODE_INPUT_OPERAND_2,name,reg2); break;
case LOAD2_AL: name="al"; push(GUICODE.DECODE_INPUT_OPERAND_2,name,reg2); break;
case LOAD2_CL: name="cl"; push(GUICODE.DECODE_INPUT_OPERAND_2,name,reg2); break;
case LOAD2_IB: name="immediate"; push(GUICODE.DECODE_INPUT_OPERAND_2,name,reg2); break;
case LOAD0_AX: name="ax"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_EAX: name="eax"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_AL: name="al"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_AH: name="ah"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_BX: name="bx"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_EBX: name="ebx"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_BL: name="bl"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_BH: name="bh"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CX: name="cx"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_ECX: name="ecx"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CL: name="cl"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CH: name="ch"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_DX: name="dx"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_EDX: name="edx"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_DL: name="dl"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_DH: name="dh"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_SI: name="si"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_ESI: name="esi"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_DI: name="di"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_EDI: name="edi"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_SP: name="sp"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_ESP: name="esp"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_BP: name="bp"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_EBP: name="ebp"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CS: name="cs"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_DS: name="ds"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_SS: name="ss"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_ES: name="es"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_FS: name="fs"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_GS: name="gs"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_FLAGS: case LOAD0_EFLAGS: name="flags"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_ADDR: name="["+addressString.substring(0,addressString.length()-1)+"]"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_IB: case LOAD0_IW: case LOAD0_ID: name="immediate"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CR0: name="cr0"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CR2: name="cr2"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CR3: name="cr3"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_CR4: name="cr4"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD0_MEM_BYTE: case LOAD0_MEM_WORD: case LOAD0_MEM_DOUBLE: name="memory["+addressString.substring(0,addressString.length()-1)+"]"; push(GUICODE.DECODE_INPUT_OPERAND_0,name,reg0); break;
case LOAD1_AX: name="ax"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_EAX: name="eax"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_AL: name="al"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_AH: name="ah"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_BX: name="bx"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_EBX: name="ebx"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_BL: name="bl"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_BH: name="bh"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_CX: name="cx"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_ECX: name="ecx"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_CL: name="cl"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_CH: name="ch"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_DX: name="dx"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_EDX: name="edx"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_DL: name="dl"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_DH: name="dh"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_SI: name="si"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_ESI: name="esi"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_DI: name="di"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_EDI: name="edi"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_SP: name="sp"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_ESP: name="esp"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_BP: name="bp"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_EBP: name="ebp"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_CS: name="cs"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_DS: name="ds"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_SS: name="ss"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_ES: name="es"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_FS: name="fs"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_GS: name="gs"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_FLAGS: case LOAD1_EFLAGS: name="flags"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_IB: case LOAD1_IW: case LOAD1_ID: name="immediate"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case LOAD1_MEM_BYTE: case LOAD1_MEM_WORD: case LOAD1_MEM_DOUBLE: name="memory["+addressString.substring(0,addressString.length()-1)+"]"; push(GUICODE.DECODE_INPUT_OPERAND_1,name,reg1); break;
case STORE0_AX: name="ax"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_EAX: name="eax"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_AL: name="al"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_AH: name="ah"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_BX: name="bx"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_EBX: name="ebx"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_BL: name="bl"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_BH: name="bh"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CX: name="cx"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_ECX: name="ecx"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CL: name="cl"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CH: name="ch"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_DX: name="dx"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_EDX: name="edx"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_DL: name="dl"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_DH: name="dh"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_SI: name="si"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_ESI: name="esi"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_DI: name="di"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_EDI: name="edi"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_SP: name="sp"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_ESP: name="esp"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_BP: name="bp"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_EBP: name="ebp"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CS: name="cs"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_DS: name="ds"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_SS: name="ss"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_ES: name="es"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_FS: name="fs"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_GS: name="gs"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_FLAGS: case STORE0_EFLAGS: name="flags"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CR0: name="cr0"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CR2: name="cr2"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CR3: name="cr3"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_CR4: name="cr4"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE0_MEM_BYTE: case STORE0_MEM_WORD: case STORE0_MEM_DOUBLE: name="memory["+addressString.substring(0,addressString.length()-1)+"]"; push(GUICODE.DECODE_OUTPUT_OPERAND_0,name,reg0); break;
case STORE1_AX: name="ax"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_EAX: name="eax"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_AL: name="al"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_AH: name="ah"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_BX: name="bx"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_EBX: name="ebx"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_BL: name="bl"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_BH: name="bh"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_CX: name="cx"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_ECX: name="ecx"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_CL: name="cl"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_CH: name="ch"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_DX: name="dx"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_EDX: name="edx"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_DL: name="dl"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_DH: name="dh"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_SI: name="si"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_ESI: name="esi"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_DI: name="di"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_EDI: name="edi"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_SP: name="sp"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_ESP: name="esp"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_BP: name="bp"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_EBP: name="ebp"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_CS: name="cs"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_DS: name="ds"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_SS: name="ss"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_ES: name="es"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_FS: name="fs"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_GS: name="gs"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_FLAGS: case STORE1_EFLAGS: name="flags"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case STORE1_MEM_BYTE: case STORE1_MEM_WORD: case STORE1_MEM_DOUBLE: name="memory["+addressString.substring(0,addressString.length()-1)+"]"; push(GUICODE.DECODE_OUTPUT_OPERAND_1,name,reg1); break;
case OP_JMP_FAR:
case OP_JMP_ABS:
push(GUICODE.EXECUTE_JUMP_ABSOLUTE,reg0); break;
case OP_JMP_08:
case OP_JMP_16_32:
push(GUICODE.EXECUTE_JUMP,reg0); break;
case OP_CALL_FAR:
case OP_CALL_ABS:
push(GUICODE.EXECUTE_CALL_STACK,reg0); push(GUICODE.EXECUTE_JUMP_ABSOLUTE,reg0); break;
case OP_CALL:
push(GUICODE.EXECUTE_CALL_STACK,reg0); push(GUICODE.EXECUTE_JUMP,reg0); break;
case OP_RET:
case OP_RET_IW:
case OP_RET_FAR:
case OP_RET_FAR_IW:
push(GUICODE.EXECUTE_RETURN); break;
case OP_JO:
case OP_JO_16_32:
case OP_JNO:
case OP_JNO_16_32:
case OP_JC:
case OP_JC_16_32:
case OP_JNC:
case OP_JNC_16_32:
case OP_JS:
case OP_JS_16_32:
case OP_JNS:
case OP_JNS_16_32:
case OP_JZ:
case OP_JZ_16_32:
case OP_JNZ:
case OP_JNZ_16_32:
case OP_JP:
case OP_JP_16_32:
case OP_JNP:
case OP_JNP_16_32:
case OP_JA:
case OP_JA_16_32:
case OP_JNA:
case OP_JNA_16_32:
case OP_JL:
case OP_JL_16_32:
case OP_JNL:
case OP_JNL_16_32:
case OP_JG:
case OP_JG_16_32:
case OP_JNG:
case OP_JNG_16_32:
case OP_LOOP_CX:
case OP_LOOPZ_CX:
case OP_LOOPNZ_CX:
case OP_JCXZ:
push(GUICODE.EXECUTE_CONDITION);
if(condition)
push(GUICODE.EXECUTE_JUMP,reg0);
break;
case OP_IN_08:
case OP_IN_16_32:
case OP_INSB:
case OP_INSW:
case OP_REP_INSB:
case OP_REP_INSW:
push(GUICODE.EXECUTE_PORT_READ); break;
case OP_OUT_08:
case OP_OUT_16_32:
case OP_OUTSB:
case OP_OUTSW:
case OP_REP_OUTSB:
case OP_REP_OUTSW:
push(GUICODE.EXECUTE_PORT_WRITE); break;
case OP_INT:
case OP_INT3:
push(GUICODE.EXECUTE_INTERRUPT,reg0); break;
case OP_IRET:
push(GUICODE.EXECUTE_INTERRUPT_RETURN); break;
case OP_INC:
case OP_DEC:
case OP_NOT:
case OP_NEG:
case OP_SHRD_16_32:
case OP_AAA:
case OP_AAD:
case OP_AAM:
case OP_AAS:
case OP_CWD:
case OP_DAA:
case OP_DAS:
case OP_BOUND:
case OP_SIGN_EXTEND:
case OP_SIGN_EXTEND_8_16:
case OP_SIGN_EXTEND_8_32:
case OP_SIGN_EXTEND_16_32:
push(GUICODE.EXECUTE_ARITHMETIC_1_1); push(GUICODE.EXECUTE_FLAG); break;
case OP_ADD:
case OP_ADC:
case OP_SUB:
case OP_CMP:
case OP_SBB:
case OP_AND:
case OP_TEST:
case OP_OR:
case OP_XOR:
case OP_ROL_08:
case OP_ROL_16_32:
case OP_ROR_08:
case OP_ROR_16_32:
case OP_RCL_08:
case OP_RCL_16_32:
case OP_RCR_08:
case OP_RCR_16_32:
case OP_SHL:
case OP_SHR:
case OP_SAR_08:
case OP_SAR_16_32:
case OP_MUL_08:
case OP_MUL_16_32:
case OP_IMULA_08:
case OP_IMULA_16_32:
case OP_IMUL_16_32:
case OP_DIV_08:
case OP_DIV_16_32:
case OP_IDIV_08:
case OP_IDIV_16_32:
case OP_SHLD_16_32:
case OP_BT_MEM:
case OP_BTS_MEM:
case OP_BTR_MEM:
case OP_BTC_MEM:
case OP_BT_16_32:
case OP_BTS_16_32:
case OP_BTR_16_32:
case OP_BTC_16_32:
push(GUICODE.EXECUTE_ARITHMETIC_2_1); push(GUICODE.EXECUTE_FLAG); break;
case OP_SCASB:
case OP_SCASW:
case OP_REPNE_SCASB:
case OP_REPE_SCASB:
case OP_REPNE_SCASW:
case OP_REPE_SCASW:
case OP_CMPSB:
case OP_CMPSW:
case OP_REPNE_CMPSB:
case OP_REPE_CMPSB:
case OP_REPNE_CMPSW:
case OP_REPE_CMPSW:
push(GUICODE.EXECUTE_MEMORY_COMPARE); break;
case OP_LODSB:
case OP_LODSW:
case OP_REP_LODSB:
case OP_REP_LODSW:
case OP_STOSB:
case OP_STOSW:
case OP_REP_STOSB:
case OP_REP_STOSW:
case OP_MOVSB:
case OP_MOVSW:
case OP_REP_MOVSB:
case OP_REP_MOVSW:
push(GUICODE.EXECUTE_MEMORY_TRANSFER); break;
case OP_CLC:
case OP_STC:
case OP_CLI:
case OP_STI:
case OP_CLD:
case OP_STD:
case OP_CMC:
case OP_SETO:
case OP_SETNO:
case OP_SETC:
case OP_SETNC:
case OP_SETZ:
case OP_SETNZ:
case OP_SETA:
case OP_SETNA:
case OP_SETL:
case OP_SETNL:
case OP_SETG:
case OP_SETNG:
case OP_SETS:
case OP_SETNS:
case OP_SETP:
case OP_SETNP:
case OP_SALC:
case OP_LAHF:
case OP_SAHF:
push(GUICODE.EXECUTE_FLAG); break;
case OP_CMOVO:
case OP_CMOVNO:
case OP_CMOVC:
case OP_CMOVNC:
case OP_CMOVZ:
case OP_CMOVNZ:
case OP_CMOVP:
case OP_CMOVNP:
case OP_CMOVS:
case OP_CMOVNS:
case OP_CMOVL:
case OP_CMOVNL:
case OP_CMOVG:
case OP_CMOVNG:
case OP_CMOVA:
case OP_CMOVNA:
push(GUICODE.EXECUTE_CONDITION);
if(condition)
push(GUICODE.EXECUTE_TRANSFER);
break;
case OP_POP:
case OP_POPF:
case OP_POPA:
case OP_LEAVE:
push(GUICODE.EXECUTE_POP);
break;
case OP_PUSH:
case OP_PUSHF:
case OP_PUSHA:
case OP_ENTER:
push(GUICODE.EXECUTE_PUSH);
break;
case OP_LGDT:
case OP_LIDT:
case OP_LLDT:
case OP_LMSW:
case OP_LTR:
case OP_SGDT:
case OP_SIDT:
case OP_SLDT:
case OP_SMSW:
case OP_STR:
case OP_CPUID:
case OP_RDTSC:
push(GUICODE.EXECUTE_TRANSFER);
break;
case OP_HALT:
push(GUICODE.EXECUTE_HALT);
break;
}
}
}
enum MICROCODE
{
PREFIX_LOCK, PREFIX_REPNE, PREFIX_REPE, PREFIX_CS, PREFIX_SS, PREFIX_DS, PREFIX_ES, PREFIX_FS, PREFIX_GS, PREFIX_OPCODE_32BIT, PREFIX_ADDRESS_32BIT,
LOAD0_AX, LOAD0_AL, LOAD0_AH, LOAD0_BX, LOAD0_BL, LOAD0_BH, LOAD0_CX, LOAD0_CL, LOAD0_CH, LOAD0_DX, LOAD0_DL, LOAD0_DH, LOAD0_SP, LOAD0_BP, LOAD0_SI, LOAD0_DI, LOAD0_CS, LOAD0_SS, LOAD0_DS, LOAD0_ES, LOAD0_FS, LOAD0_GS, LOAD0_FLAGS, LOAD1_AX, LOAD1_AL, LOAD1_AH, LOAD1_BX, LOAD1_BL, LOAD1_BH, LOAD1_CX, LOAD1_CL, LOAD1_CH, LOAD1_DX, LOAD1_DL, LOAD1_DH, LOAD1_SP, LOAD1_BP, LOAD1_SI, LOAD1_DI, LOAD1_CS, LOAD1_SS, LOAD1_DS, LOAD1_ES, LOAD1_FS, LOAD1_GS, LOAD1_FLAGS, STORE0_AX, STORE0_AL, STORE0_AH, STORE0_BX, STORE0_BL, STORE0_BH, STORE0_CX, STORE0_CL, STORE0_CH, STORE0_DX, STORE0_DL, STORE0_DH, STORE0_SP, STORE0_BP, STORE0_SI, STORE0_DI, STORE0_CS, STORE0_SS, STORE0_DS, STORE0_ES, STORE0_FS, STORE0_GS, STORE1_AX, STORE1_AL, STORE1_AH, STORE1_BX, STORE1_BL, STORE1_BH, STORE1_CX, STORE1_CL, STORE1_CH, STORE1_DX, STORE1_DL, STORE1_DH, STORE1_SP, STORE1_BP, STORE1_SI, STORE1_DI, STORE1_CS, STORE1_SS, STORE1_DS, STORE1_ES, STORE1_FS, STORE1_GS, STORE1_FLAGS, LOAD0_MEM_BYTE, LOAD0_MEM_WORD, STORE0_MEM_BYTE, STORE0_MEM_WORD, LOAD1_MEM_BYTE, LOAD1_MEM_WORD, STORE1_MEM_BYTE, STORE1_MEM_WORD, STORE1_ESP, STORE0_FLAGS, LOAD0_IB, LOAD0_IW, LOAD1_IB, LOAD1_IW, LOAD_SEG_CS, LOAD_SEG_SS, LOAD_SEG_DS, LOAD_SEG_ES, LOAD_SEG_FS, LOAD_SEG_GS, LOAD0_ADDR, LOAD0_EAX, LOAD0_EBX, LOAD0_ECX, LOAD0_EDX, LOAD0_ESI, LOAD0_EDI, LOAD0_EBP, LOAD0_ESP, LOAD1_EAX, LOAD1_EBX, LOAD1_ECX, LOAD1_EDX, LOAD1_ESI, LOAD1_EDI, LOAD1_EBP, LOAD1_ESP, STORE0_EAX, STORE0_EBX, STORE0_ECX, STORE0_EDX, STORE0_ESI, STORE0_EDI, STORE0_ESP, STORE0_EBP, STORE1_EAX, STORE1_EBX, STORE1_ECX, STORE1_EDX, STORE1_ESI, STORE1_EDI, STORE1_EBP, LOAD0_MEM_DOUBLE, LOAD1_MEM_DOUBLE, STORE0_MEM_DOUBLE, STORE1_MEM_DOUBLE, LOAD0_EFLAGS, LOAD1_EFLAGS, STORE0_EFLAGS, STORE1_EFLAGS, LOAD0_ID, LOAD1_ID, LOAD0_CR0, LOAD0_CR2, LOAD0_CR3, LOAD0_CR4, STORE0_CR0, STORE0_CR2, STORE0_CR3, STORE0_CR4,
LOAD2_AL, LOAD2_CL, LOAD2_AX, LOAD2_EAX, LOAD2_IB,
FLAG_BITWISE_08, FLAG_BITWISE_16, FLAG_BITWISE_32, FLAG_SUB_08, FLAG_SUB_16, FLAG_SUB_32, FLAG_REP_SUB_08, FLAG_REP_SUB_16, FLAG_REP_SUB_32, FLAG_ADD_08, FLAG_ADD_16, FLAG_ADD_32, FLAG_ADC_08, FLAG_ADC_16, FLAG_ADC_32, FLAG_SBB_08, FLAG_SBB_16, FLAG_SBB_32, FLAG_DEC_08, FLAG_DEC_16, FLAG_DEC_32, FLAG_INC_08, FLAG_INC_16, FLAG_INC_32, FLAG_SHL_08, FLAG_SHL_16, FLAG_SHL_32, FLAG_SHR_08, FLAG_SHR_16, FLAG_SHR_32, FLAG_SAR_08, FLAG_SAR_16, FLAG_SAR_32, FLAG_RCL_08, FLAG_RCL_16, FLAG_RCL_32, FLAG_RCR_08, FLAG_RCR_16, FLAG_RCR_32, FLAG_ROL_08, FLAG_ROL_16, FLAG_ROL_32, FLAG_ROR_08, FLAG_ROR_16, FLAG_ROR_32, FLAG_NEG_08, FLAG_NEG_16, FLAG_NEG_32, FLAG_ROTATE_08, FLAG_ROTATE_16, FLAG_ROTATE_32, FLAG_UNIMPLEMENTED, FLAG_8F, FLAG_NONE, FLAG_BAD, FLAG_80_82, FLAG_81_83, FLAG_FF, FLAG_F6, FLAG_F7, FLAG_FE, FLAG_FLOAT_NOP,
ADDR_AX, ADDR_BX, ADDR_CX, ADDR_DX, ADDR_SP, ADDR_BP, ADDR_SI, ADDR_DI, ADDR_IB, ADDR_IW, ADDR_AL, ADDR_EAX, ADDR_EBX, ADDR_ECX, ADDR_EDX, ADDR_ESP, ADDR_EBP, ADDR_ESI, ADDR_EDI, ADDR_ID, ADDR_MASK_16, ADDR_2EAX, ADDR_2EBX, ADDR_2ECX, ADDR_2EDX, ADDR_2EBP, ADDR_2ESI, ADDR_2EDI, ADDR_4EAX, ADDR_4EBX, ADDR_4ECX, ADDR_4EDX, ADDR_4EBP, ADDR_4ESI, ADDR_4EDI, ADDR_8EAX, ADDR_8EBX, ADDR_8ECX, ADDR_8EDX, ADDR_8EBP, ADDR_8ESI, ADDR_8EDI,
OP_JMP_FAR, OP_JMP_ABS, OP_CALL, OP_CALL_FAR, OP_CALL_ABS, OP_RET, OP_RET_IW, OP_RET_FAR, OP_RET_FAR_IW, OP_ENTER, OP_LEAVE, OP_JMP_08, OP_JMP_16_32, OP_JO, OP_JO_16_32, OP_JNO, OP_JNO_16_32, OP_JC, OP_JC_16_32, OP_JNC, OP_JNC_16_32, OP_JZ, OP_JZ_16_32, OP_JNZ, OP_JNZ_16_32, OP_JS, OP_JS_16_32, OP_JNS, OP_JNS_16_32, OP_JP, OP_JP_16_32, OP_JNP, OP_JNP_16_32, OP_JA, OP_JA_16_32, OP_JNA, OP_JNA_16_32, OP_JL, OP_JL_16_32, OP_JNL, OP_JNL_16_32, OP_JG, OP_JG_16_32, OP_JNG, OP_JNG_16_32, OP_INT, OP_INT3, OP_IRET, OP_IN_08, OP_IN_16_32, OP_OUT_08, OP_OUT_16_32, OP_INC, OP_DEC, OP_ADD, OP_ADC, OP_SUB, OP_SBB, OP_AND, OP_TEST, OP_OR, OP_XOR, OP_ROL_08, OP_ROL_16_32, OP_ROR_08, OP_ROR_16_32, OP_RCL_08, OP_RCL_16_32, OP_RCR_08, OP_RCR_16_32, OP_SHR, OP_SAR_08, OP_SAR_16_32, OP_NOT, OP_NEG, OP_MUL_08, OP_MUL_16_32, OP_IMULA_08, OP_IMULA_16_32, OP_IMUL_16_32, OP_BSF, OP_BSR, OP_BT_MEM, OP_BTS_MEM, OP_BTR_MEM, OP_BTC_MEM, OP_BT_16_32, OP_BTS_16_32, OP_BTR_16_32, OP_BTC_16_32, OP_SHLD_16_32, OP_SHRD_16_32, OP_CWD, OP_CDQ, OP_AAA, OP_AAD, OP_AAM, OP_AAS, OP_DAA, OP_DAS, OP_BOUND, OP_CLC, OP_STC, OP_CLI, OP_STI, OP_CLD, OP_STD, OP_CMC, OP_SETO, OP_SETNO, OP_SETC, OP_SETNC, OP_SETZ, OP_SETNZ, OP_SETA, OP_SETNA, OP_SETS, OP_SETNS, OP_SETP, OP_SETNP, OP_SETL, OP_SETNL, OP_SETG, OP_SETNG, OP_SALC, OP_CMOVO, OP_CMOVNO, OP_CMOVC, OP_CMOVNC, OP_CMOVZ, OP_CMOVNZ, OP_CMOVS, OP_CMOVNS, OP_CMOVP, OP_CMOVNP, OP_CMOVA, OP_CMOVNA, OP_CMOVL, OP_CMOVNL, OP_CMOVG, OP_CMOVNG, OP_LAHF, OP_SAHF, OP_POP, OP_POPF, OP_PUSH, OP_PUSHA, OP_POPA, OP_SIGN_EXTEND_8_16, OP_SIGN_EXTEND_8_32, OP_SIGN_EXTEND_16_32, OP_SIGN_EXTEND, OP_INSB, OP_INSW, OP_REP_INSB, OP_REP_INSW, OP_LODSB, OP_LODSW, OP_REP_LODSB, OP_REP_LODSW, OP_MOVSB, OP_MOVSW, OP_REP_MOVSB, OP_REP_MOVSW, OP_OUTSB, OP_OUTSW, OP_REP_OUTSB, OP_REP_OUTSW, OP_STOSB, OP_STOSW, OP_REP_STOSB, OP_REP_STOSW, OP_LOOP_CX, OP_LOOPZ_CX, OP_LOOPNZ_CX, OP_JCXZ, OP_HALT, OP_CPUID, OP_NOP, OP_MOV, OP_CMP, OP_BAD, OP_UNIMPLEMENTED, OP_ROTATE_08, OP_ROTATE_16_32, OP_INT0, OP_CBW, OP_PUSHF, OP_SHL, OP_80_83, OP_FF, OP_F6, OP_F7, OP_DIV_08, OP_DIV_16_32, OP_IDIV_08, OP_IDIV_16_32, OP_SCASB, OP_SCASW, OP_REPE_SCASB, OP_REPE_SCASW, OP_REPNE_SCASB, OP_REPNE_SCASW, OP_CMPSB, OP_CMPSW, OP_REPE_CMPSB, OP_REPE_CMPSW, OP_REPNE_CMPSB, OP_REPNE_CMPSW, OP_FE, OP_FLOAT_NOP, OP_SGDT, OP_SIDT, OP_LGDT, OP_LIDT, OP_SMSW, OP_LMSW, OP_F01, OP_F00, OP_SLDT, OP_STR, OP_LLDT, OP_LTR, OP_VERR, OP_VERW, OP_CLTS, OP_RDTSC
}
enum GUICODE
{
//processor action codes
FETCH, DECODE_PREFIX, DECODE_INSTRUCTION, DECODE_OPCODE, DECODE_MODRM, DECODE_SIB, DECODE_INPUT_OPERAND_0, DECODE_INPUT_OPERAND_1, DECODE_INPUT_OPERAND_2, DECODE_OUTPUT_OPERAND_0, DECODE_OUTPUT_OPERAND_1, DECODE_IMMEDIATE, DECODE_DISPLACEMENT, HARDWARE_INTERRUPT, SOFTWARE_INTERRUPT, EXCEPTION, DECODE_MEMORY_ADDRESS, DECODE_SEGMENT_ADDRESS,
EXECUTE_JUMP, EXECUTE_JUMP_ABSOLUTE, EXECUTE_RETURN, EXECUTE_CALL_STACK, EXECUTE_CONDITION, EXECUTE_PORT_READ, EXECUTE_PORT_WRITE, EXECUTE_INTERRUPT, EXECUTE_INTERRUPT_RETURN, EXECUTE_ARITHMETIC_1_1, EXECUTE_ARITHMETIC_2_1, EXECUTE_MEMORY_COMPARE, EXECUTE_MEMORY_TRANSFER, EXECUTE_FLAG, EXECUTE_TRANSFER, EXECUTE_PUSH, EXECUTE_POP, EXECUTE_HALT,
//mode codes
MODE_REAL, MODE_PROTECTED,
//storage codes
FLAG_SET, FLAG_CLEAR, FLAG_READ, REGISTER_READ, REGISTER_WRITE, PORT_READ, PORT_WRITE, CS_MEMORY_READ, CS_MEMORY_WRITE, SS_MEMORY_READ, SS_MEMORY_WRITE, DS_MEMORY_READ, DS_MEMORY_WRITE, ES_MEMORY_READ, ES_MEMORY_WRITE, FS_MEMORY_READ, FS_MEMORY_WRITE, GS_MEMORY_READ, GS_MEMORY_WRITE, IDTR_MEMORY_READ, IDTR_MEMORY_WRITE, GDTR_MEMORY_READ, GDTR_MEMORY_WRITE, LDTR_MEMORY_READ, LDTR_MEMORY_WRITE, TSS_MEMORY_READ, TSS_MEMORY_WRITE,
};
//decode tables
public static final MICROCODE[] rotationTable = new MICROCODE[]
{
MICROCODE.FLAG_ROL_08, MICROCODE.FLAG_ROR_08, MICROCODE.FLAG_RCL_08, MICROCODE.FLAG_RCR_08, MICROCODE.FLAG_SHL_08, MICROCODE.FLAG_SHR_08, MICROCODE.FLAG_SHL_08, MICROCODE.FLAG_SAR_08,
MICROCODE.FLAG_ROL_16, MICROCODE.FLAG_ROR_16, MICROCODE.FLAG_RCL_16, MICROCODE.FLAG_RCR_16, MICROCODE.FLAG_SHL_16, MICROCODE.FLAG_SHR_16, MICROCODE.FLAG_SHL_16, MICROCODE.FLAG_SAR_16,
MICROCODE.OP_ROL_08, MICROCODE.OP_ROR_08, MICROCODE.OP_RCL_08, MICROCODE.OP_RCR_08, MICROCODE.OP_SHL, MICROCODE.OP_SHR, MICROCODE.OP_SHL, MICROCODE.OP_SAR_08,
MICROCODE.OP_ROL_16_32, MICROCODE.OP_ROR_16_32, MICROCODE.OP_RCL_16_32, MICROCODE.OP_RCR_16_32, MICROCODE.OP_SHL, MICROCODE.OP_SHR, MICROCODE.OP_SHL, MICROCODE.OP_SAR_16_32
};
public static final int[][] inputTable0 = new int[][]
{
//effective byte
{0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x84, 0x86, 0x8a, 0xfb6, 0xfbe, 0x80, 0x82, 0xc0, 0xfb0, 0xd0, 0xd2, 0xf6, 0xfe},
//effective word
{0x01, 0x09, 0x11, 0x19, 0x21, 0x29, 0x31, 0x39, 0x85, 0x87, 0x8b, 0x81, 0xc1, 0x83, 0x69, 0x6b, 0xc4, 0xc5, 0xfb2, 0xfb4, 0xfb5, 0xfa4, 0xfac, 0xfa5, 0xfad, 0xfb1, 0xd1, 0xd3, 0xfb1, 0xff, 0xf7},
//register byte
{0x88, 0x02, 0x0a, 0x12, 0x1a, 0x22, 0x2a, 0x32, 0x3a, 0xfc0},
//register word
{0x89, 0x03, 0x0b, 0x13, 0x1b, 0x23, 0x2b, 0x33, 0x3b, 0xfaf, 0xfbc, 0xfbd, 0xfc1, 0xf40, 0xf41, 0xf42, 0xf43, 0xf44, 0xf45, 0xf46, 0xf47, 0xf48, 0xf49, 0xf4a, 0xf4b, 0xf4c, 0xf4d, 0xf4e, 0xf4f},
//immediate byte
{0xc6, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xe4, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0xcd, 0xd4, 0xd5, 0xe0, 0xe1, 0xe2, 0xe3, 0xeb, 0xe5, 0xe6, 0xe7},
//immediate word
{0xc7, 0x68, 0x6a, 0xe8, 0xe9, 0xf80, 0xf81, 0xf82, 0xf83, 0xf84, 0xf85, 0xf86, 0xf87, 0xf88, 0xf89, 0xf8a, 0xf8b, 0xf8c, 0xf8d, 0xf8e, 0xf8f, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf},
//AX
{0x05, 0x0d, 0x15, 0x1d, 0x25, 0x2d, 0x35, 0x3d, 0xa9, 0x40, 0x48, 0x50, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0xa3, 0xab, 0xaf},
//AL
{0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c, 0xa8, 0xa2, 0xaa, 0xae},{},
//BX
{0x43, 0x4b, 0x53},{},{},
//CX
{0x41, 0x49, 0x51, 0xf30, 0xf32},{},{},
//DX
{0x42, 0x4a, 0x52},{},{},
//SP
{0x44, 0x4c, 0x54},
//BP
{0x45, 0x4d, 0x55},
//SI
{0x46, 0x4e, 0x56},
//DI
{0x47, 0x4f, 0x57},
//CS
{0x0e},
//SS
{0x16},
//DS
{0x1e},
//ES
{0x06},
//FS
{0xfa0},
//GS
{0xfa8},
//flags
{0x9c},
//special
{0x9a, 0xea, 0xc8, 0x62, 0x8c, 0xa0, 0xa1, 0xa4, 0xa5, 0xa6, 0xa7, 0xac, 0xad, 0xfa3, 0xfab, 0xfb3, 0xfbb, 0x6e, 0x6f, 0xd7, 0xf00, 0xf01, 0xf20, 0xf21, 0xf22, 0xf23, 0xfba, 0xfc8, 0xfc9, 0xfca, 0xfcb, 0xfcc, 0xfcd, 0xfce, 0xfcf, 0x8d, 0xec, 0xed, 0xee, 0xef, 0x8e, 0xfb7, 0xfbf, 0x6c, 0x6d, 0xca, 0xc2}
};
public static final int[][] inputTable1 = new int[][]
{
//effective byte
{0x02, 0x0a, 0x12, 0x1a, 0x22, 0x2a, 0x32, 0x3a, 0xfc0},
//effective word
{0x03, 0x0b, 0x13, 0x1b, 0x23, 0x2b, 0x33, 0x3b, 0xfaf, 0xfbc, 0xfbd, 0xfc1, 0xf40, 0xf41, 0xf42, 0xf43, 0xf44, 0xf45, 0xf46, 0xf47, 0xf48, 0xf49, 0xf4a, 0xf4b, 0xf4c, 0xf4d, 0xf4e, 0xf4f},
//register byte
{0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x84, 0x86, 0xfb0},
//register word
{0x01, 0x09, 0x11, 0x19, 0x21, 0x29, 0x31, 0x39, 0x85, 0x87, 0x62, 0xfa4, 0xfac, 0xfa5, 0xfad, 0xfb1},
//immediate byte
{0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c, 0xa8, 0x80, 0x82, 0xc0, 0xc1},
//immediate word
{0x69, 0x6b, 0x05, 0x0d, 0x15, 0x1d, 0x25, 0x2d, 0x35, 0x3d, 0xa9, 0x81, 0x83},
//AX
{0xef, 0xe7},
//AL
{0xee, 0xe6},{},
//BX
{0x93},{},{},
//CX
{0x91},
//CL
{0xd2, 0xd3},{},
//DX
{0x92, 0xf30},{},{},
//SP
{0x94},
//BP
{0x95},
//SI
{0x96},
//DI
{0x97},{},{},{},{},{},{},{},
//special
{0x9a, 0xea, 0xc8, 0xf6, 0xf7, 0x62, 0xc4, 0xc5, 0xfb2, 0xfb4, 0xfb5, 0xfba, 0xff, 0xd1, 0xd0, 0xf01, 0xfa3, 0xfab, 0xfb3, 0xfbb}
};
public static final int[][] outputTable0 = new int[][]
{
//effective byte
{0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x88, 0xc0, 0xc6, 0xfe, 0xf90, 0xf91, 0xf92, 0xf93, 0xf94, 0xf95, 0xf96, 0xf97, 0xf98, 0xf99, 0xf9a, 0xf9b, 0xf9c, 0xf9d, 0xf9e, 0xf9f, 0xfb0, 0xfc0, 0xd0, 0xd2},
//effective word
{0x01, 0x09, 0x11, 0x19, 0x21, 0x29, 0x31, 0x89, 0x21, 0x29, 0x31, 0x89, 0xc7, 0xc1, 0x8f, 0xd1, 0xd3, 0x8c, 0xfa4, 0xfa5, 0xfac, 0xfad, 0xfc1, 0xfb1},
//register byte
{0x86, 0x02, 0x0a, 0x12, 0x1a, 0x22, 0x2a, 0x32, 0x8a},
//register word
{0x87, 0x03, 0x0b, 0x13, 0x1b, 0x23, 0x2b, 0x33, 0x69, 0x6b, 0x8b, 0x8d, 0xf40, 0xf41, 0xf42, 0xf43, 0xf44, 0xf45, 0xf46, 0xf47, 0xf48, 0xf49, 0xf4a, 0xf4b, 0xf4c, 0xf4d, 0xf4e, 0xf4f, 0xfaf, 0xfb6, 0xfb7, 0xfbc, 0xfbd, 0xfbe, 0xfbf, 0xfb2, 0xfb4, 0xfb5, 0x62, 0xc4, 0xc5},{},{},
//AX
{0x05, 0x0d, 0x15, 0x1d, 0x25, 0x2d, 0x35, 0xb8, 0xe5, 0x40, 0x48, 0x58, 0xed, 0xa1},
//AL
{0xec, 0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0xe4, 0xb0, 0xa0, 0xd6, 0xd7},
//AH
{0xb4},
//BX
{0x43, 0x4b, 0x5b, 0xbb, 0x93},
//BL
{0xb3},
//BH
{0xb7},
//CX
{0x41, 0x49, 0x59, 0xb9, 0x91},
//CL
{0xb1},
//CH
{0xb5},
//DX
{0x42, 0x4a, 0x5a, 0xba, 0x92},
//DL
{0xb2},
//DH
{0xb6},
//SP
{0x44, 0x4c, 0x5c, 0xbc, 0x94},
//BP
{0x45, 0x4d, 0x5d, 0xbd, 0x95},
//SI
{0x46, 0x4e, 0x5e, 0xbe, 0x96},
//DI
{0x47, 0x4f, 0x5f, 0xbf, 0x97},{},
//SS
{0x17},
//DS
{0x1f},
//ES
{0x07},
//FS
{0xfa1},
//GS
{0xfa9},
//flags
{0x9d},
//special
{0x8e, 0xa2, 0xa3, 0xd0, 0xd1, 0xf6, 0xf7, 0xff, 0xf00, 0xf01, 0xf20, 0xf21, 0xf22, 0xf23, 0xf31, 0xf32, 0xfab, 0xfb3, 0xfbb, 0xfba, 0xfc8, 0xfc9, 0xfca, 0xfcb, 0xfcc, 0xfcd, 0xfce, 0xfcf, 0x80, 0x81, 0x82, 0x83}
};
public static final int[][] outputTable1 = new int[][]
{
//effective byte
{0x86},
//effective word
{0x87},
{},{},{},{},
//AX
{0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97},
{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},
//SS
{0xfb2},
//DS
{0xc5},
//ES
{0xc4},
//FS
{0xfb4},
//GS
{0xfb5},{},
//special
{0xf01, 0xf31, 0xf32}
};
public static final MICROCODE[] operandRegisterTable = new MICROCODE[]
{
MICROCODE.LOAD0_AX, MICROCODE.LOAD0_AL, MICROCODE.LOAD0_AH, MICROCODE.LOAD0_BX, MICROCODE.LOAD0_BL, MICROCODE.LOAD0_BH, MICROCODE.LOAD0_CX, MICROCODE.LOAD0_CL, MICROCODE.LOAD0_CH, MICROCODE.LOAD0_DX, MICROCODE.LOAD0_DL, MICROCODE.LOAD0_DH, MICROCODE.LOAD0_SP, MICROCODE.LOAD0_BP, MICROCODE.LOAD0_SI, MICROCODE.LOAD0_DI, MICROCODE.LOAD0_CS, MICROCODE.LOAD0_SS, MICROCODE.LOAD0_DS, MICROCODE.LOAD0_ES, MICROCODE.LOAD0_FS, MICROCODE.LOAD0_GS, MICROCODE.LOAD0_FLAGS, MICROCODE.LOAD1_AX, MICROCODE.LOAD1_AL, MICROCODE.LOAD1_AH, MICROCODE.LOAD1_BX, MICROCODE.LOAD1_BL, MICROCODE.LOAD1_BH, MICROCODE.LOAD1_CX, MICROCODE.LOAD1_CL, MICROCODE.LOAD1_CH, MICROCODE.LOAD1_DX, MICROCODE.LOAD1_DL, MICROCODE.LOAD1_DH, MICROCODE.LOAD1_SP, MICROCODE.LOAD1_BP, MICROCODE.LOAD1_SI, MICROCODE.LOAD1_DI, MICROCODE.LOAD1_CS, MICROCODE.LOAD1_SS, MICROCODE.LOAD1_DS, MICROCODE.LOAD1_ES, MICROCODE.LOAD1_FS, MICROCODE.LOAD1_GS, MICROCODE.LOAD1_FLAGS, MICROCODE.STORE0_AX, MICROCODE.STORE0_AL, MICROCODE.STORE0_AH, MICROCODE.STORE0_BX, MICROCODE.STORE0_BL, MICROCODE.STORE0_BH, MICROCODE.STORE0_CX, MICROCODE.STORE0_CL, MICROCODE.STORE0_CH, MICROCODE.STORE0_DX, MICROCODE.STORE0_DL, MICROCODE.STORE0_DH, MICROCODE.STORE0_SP, MICROCODE.STORE0_BP, MICROCODE.STORE0_SI, MICROCODE.STORE0_DI, MICROCODE.STORE0_CS, MICROCODE.STORE0_SS, MICROCODE.STORE0_DS, MICROCODE.STORE0_ES, MICROCODE.STORE0_FS, MICROCODE.STORE0_GS, MICROCODE.STORE0_FLAGS, MICROCODE.STORE1_AX, MICROCODE.STORE1_AL, MICROCODE.STORE1_AH, MICROCODE.STORE1_BX, MICROCODE.STORE1_BL, MICROCODE.STORE1_BH, MICROCODE.STORE1_CX, MICROCODE.STORE1_CL, MICROCODE.STORE1_CH, MICROCODE.STORE1_DX, MICROCODE.STORE1_DL, MICROCODE.STORE1_DH, MICROCODE.STORE1_SP, MICROCODE.STORE1_BP, MICROCODE.STORE1_SI, MICROCODE.STORE1_DI, MICROCODE.STORE1_CS, MICROCODE.STORE1_SS, MICROCODE.STORE1_DS, MICROCODE.STORE1_ES, MICROCODE.STORE1_FS, MICROCODE.STORE1_GS, MICROCODE.STORE1_FLAGS
};
public static final MICROCODE[] modrmRegisterTable = new MICROCODE[]
{
MICROCODE.LOAD0_AL, MICROCODE.LOAD0_CL, MICROCODE.LOAD0_DL, MICROCODE.LOAD0_BL, MICROCODE.LOAD0_AH, MICROCODE.LOAD0_CH, MICROCODE.LOAD0_DH, MICROCODE.LOAD0_BH, MICROCODE.LOAD0_MEM_BYTE,
MICROCODE.LOAD1_AL, MICROCODE.LOAD1_CL, MICROCODE.LOAD1_DL, MICROCODE.LOAD1_BL, MICROCODE.LOAD1_AH, MICROCODE.LOAD1_CH, MICROCODE.LOAD1_DH, MICROCODE.LOAD1_BH, MICROCODE.LOAD1_MEM_BYTE,
MICROCODE.STORE0_AL, MICROCODE.STORE0_CL, MICROCODE.STORE0_DL, MICROCODE.STORE0_BL, MICROCODE.STORE0_AH, MICROCODE.STORE0_CH, MICROCODE.STORE0_DH, MICROCODE.STORE0_BH, MICROCODE.STORE0_MEM_BYTE,
MICROCODE.STORE1_AL, MICROCODE.STORE1_CL, MICROCODE.STORE1_DL, MICROCODE.STORE1_BL, MICROCODE.STORE1_AH, MICROCODE.STORE1_CH, MICROCODE.STORE1_DH, MICROCODE.STORE1_BH, MICROCODE.STORE1_MEM_BYTE,
MICROCODE.LOAD0_AX, MICROCODE.LOAD0_CX, MICROCODE.LOAD0_DX, MICROCODE.LOAD0_BX, MICROCODE.LOAD0_SP, MICROCODE.LOAD0_BP, MICROCODE.LOAD0_SI, MICROCODE.LOAD0_DI, MICROCODE.LOAD0_MEM_WORD,
MICROCODE.LOAD1_AX, MICROCODE.LOAD1_CX, MICROCODE.LOAD1_DX, MICROCODE.LOAD1_BX, MICROCODE.LOAD1_SP, MICROCODE.LOAD1_BP, MICROCODE.LOAD1_SI, MICROCODE.LOAD1_DI, MICROCODE.LOAD1_MEM_WORD,
MICROCODE.STORE0_AX, MICROCODE.STORE0_CX, MICROCODE.STORE0_DX, MICROCODE.STORE0_BX, MICROCODE.STORE0_SP, MICROCODE.STORE0_BP, MICROCODE.STORE0_SI, MICROCODE.STORE0_DI, MICROCODE.STORE0_MEM_WORD,
MICROCODE.STORE1_AX, MICROCODE.STORE1_CX, MICROCODE.STORE1_DX, MICROCODE.STORE1_BX, MICROCODE.STORE1_SP, MICROCODE.STORE1_BP, MICROCODE.STORE1_SI, MICROCODE.STORE1_DI, MICROCODE.STORE1_MEM_WORD,
MICROCODE.LOAD0_EAX, MICROCODE.LOAD0_ECX, MICROCODE.LOAD0_EDX, MICROCODE.LOAD0_EBX, MICROCODE.LOAD0_ESP, MICROCODE.LOAD0_EBP, MICROCODE.LOAD0_ESI, MICROCODE.LOAD0_EDI, MICROCODE.LOAD0_MEM_DOUBLE,
MICROCODE.LOAD1_EAX, MICROCODE.LOAD1_ECX, MICROCODE.LOAD1_EDX, MICROCODE.LOAD1_EBX, MICROCODE.LOAD1_ESP, MICROCODE.LOAD1_EBP, MICROCODE.LOAD1_ESI, MICROCODE.LOAD1_EDI, MICROCODE.LOAD1_MEM_DOUBLE,
MICROCODE.STORE0_EAX, MICROCODE.STORE0_ECX, MICROCODE.STORE0_EDX, MICROCODE.STORE0_EBX, MICROCODE.STORE0_ESP, MICROCODE.STORE0_EBP, MICROCODE.STORE0_ESI, MICROCODE.STORE0_EDI, MICROCODE.STORE0_MEM_DOUBLE,
MICROCODE.STORE1_EAX, MICROCODE.STORE1_ECX, MICROCODE.STORE1_EDX, MICROCODE.STORE1_EBX, MICROCODE.STORE1_ESP, MICROCODE.STORE1_EBP, MICROCODE.STORE1_ESI, MICROCODE.STORE1_EDI, MICROCODE.STORE1_MEM_DOUBLE
};
//indexed by the opcode value
//tells whether the instruction has a displacement, and if so, how many bytes
//a displacement is an immediate added to the memory address
public static final int[] hasDisplacementTable = new int[]
{
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
//indexed by the opcode value
//tells whether the opcode is followed by an immediate, and if so, how many bytes
public static final int[] hasImmediateTable = new int[]
{
0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0,
0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0,
0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0,
0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4,
1, 1, 2, 0, 0, 0, 1, 4, 3, 0, 2, 0, 0, 1, 0, 0,
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 6, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
//this list, indexed by the opcode value, tells whether the opcode is followed by a MODR/M byte
private static int[] modrmTable = new int[]
{
1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0,
1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,
1,1,1,1,0,0,0,0,0,0,0,1,0,0,0,0,
1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,
1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
};
//this list, indexed by the opcode, tells whether the instruction has an SIB byte
//the SIB is only relevent in 32-bit opcode mode
private static int[] sibTable = new int[]
{
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
//gives the flag changes when indexed by the opcode value
public static final MICROCODE[] flagTable = new MICROCODE[]
{
MICROCODE.FLAG_ADD_08, MICROCODE.FLAG_ADD_16, MICROCODE.FLAG_ADD_08, MICROCODE.FLAG_ADD_16, MICROCODE.FLAG_ADD_08, MICROCODE.FLAG_ADD_16, //0-5
MICROCODE.FLAG_NONE, //6
MICROCODE.FLAG_NONE, //7
MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, //8-d
MICROCODE.FLAG_NONE, //e
MICROCODE.FLAG_BAD, //f
MICROCODE.FLAG_ADC_08, MICROCODE.FLAG_ADC_16, MICROCODE.FLAG_ADC_08, MICROCODE.FLAG_ADC_16, MICROCODE.FLAG_ADC_08, MICROCODE.FLAG_ADC_16, //10-15
MICROCODE.FLAG_NONE, //16
MICROCODE.FLAG_NONE, //17
MICROCODE.FLAG_SBB_08, MICROCODE.FLAG_SBB_16, MICROCODE.FLAG_SBB_08, MICROCODE.FLAG_SBB_16, MICROCODE.FLAG_SBB_08, MICROCODE.FLAG_SBB_16, //18-1d
MICROCODE.FLAG_NONE, //1e
MICROCODE.FLAG_NONE, //1f
MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, //20-25
MICROCODE.FLAG_BAD, //26
MICROCODE.FLAG_NONE, //27
MICROCODE.FLAG_SUB_08, //28
MICROCODE.FLAG_SUB_16, //29
MICROCODE.FLAG_SUB_08, //2a
MICROCODE.FLAG_SUB_16, //2b
MICROCODE.FLAG_SUB_08, //2c
MICROCODE.FLAG_SUB_16, //2d
MICROCODE.FLAG_BAD, //2e
MICROCODE.FLAG_NONE, //2f
MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, //30-35
MICROCODE.FLAG_BAD, //36
MICROCODE.FLAG_NONE, //37
MICROCODE.FLAG_SUB_08, //38
MICROCODE.FLAG_SUB_16, //39
MICROCODE.FLAG_SUB_08, //3a
MICROCODE.FLAG_SUB_16, //3b
MICROCODE.FLAG_SUB_08, //3c
MICROCODE.FLAG_SUB_16, //3d
MICROCODE.FLAG_BAD, //3e
MICROCODE.FLAG_NONE, //3f
MICROCODE.FLAG_INC_16, MICROCODE.FLAG_INC_16, MICROCODE.FLAG_INC_16, MICROCODE.FLAG_INC_16, MICROCODE.FLAG_INC_16, MICROCODE.FLAG_INC_16, MICROCODE.FLAG_INC_16, MICROCODE.FLAG_INC_16, //40-47
MICROCODE.FLAG_DEC_16, MICROCODE.FLAG_DEC_16, MICROCODE.FLAG_DEC_16, MICROCODE.FLAG_DEC_16, MICROCODE.FLAG_DEC_16, MICROCODE.FLAG_DEC_16, MICROCODE.FLAG_DEC_16, MICROCODE.FLAG_DEC_16, //48-4f
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //50-57
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //58-5b
MICROCODE.FLAG_NONE, //5c
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //5d-5f
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //60-63
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //64-7f
MICROCODE.FLAG_80_82, MICROCODE.FLAG_81_83, MICROCODE.FLAG_80_82, MICROCODE.FLAG_81_83, //80-83
MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, //84-85
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //86-8e
MICROCODE.FLAG_NONE, //8f
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //90-a5
MICROCODE.FLAG_REP_SUB_08, MICROCODE.FLAG_REP_SUB_16, //a6-a7
MICROCODE.FLAG_BITWISE_08, MICROCODE.FLAG_BITWISE_16, //a8-a9
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //aa-ad
MICROCODE.FLAG_REP_SUB_08, MICROCODE.FLAG_REP_SUB_16, //ae-af
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //b0-bf
MICROCODE.FLAG_ROTATE_08, MICROCODE.FLAG_ROTATE_16, //c0-c1
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //c2-ce
MICROCODE.STORE0_FLAGS, //cf
MICROCODE.FLAG_ROTATE_08, MICROCODE.FLAG_ROTATE_16, MICROCODE.FLAG_ROTATE_08, MICROCODE.FLAG_ROTATE_16, //d0-d3
MICROCODE.FLAG_BITWISE_08, //d4
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //d5-d7
MICROCODE.FLAG_FLOAT_NOP, MICROCODE.FLAG_FLOAT_NOP, MICROCODE.FLAG_FLOAT_NOP, MICROCODE.FLAG_FLOAT_NOP, MICROCODE.FLAG_FLOAT_NOP, MICROCODE.FLAG_FLOAT_NOP, MICROCODE.FLAG_FLOAT_NOP, MICROCODE.FLAG_FLOAT_NOP, //d8-df
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //e0-ef
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //f0-f3
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //f4-f5
MICROCODE.FLAG_F6, MICROCODE.FLAG_F7, //f6-f7
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //f8-fd
MICROCODE.FLAG_FE, MICROCODE.FLAG_FF, //fe-ff
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //f00-f05
MICROCODE.FLAG_NONE, //f06
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //f07-f08
MICROCODE.FLAG_NONE, //f09
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //f0a-f1f
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //f20-f23
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //f24-f2f
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //f30-f32
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //f33-f3f
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //f40-f4f
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //f50-f7f
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //f80-fa0
MICROCODE.FLAG_NONE, //fa1
MICROCODE.FLAG_NONE, //fa2
MICROCODE.FLAG_NONE,
MICROCODE.FLAG_SHL_16, MICROCODE.FLAG_SHL_16, //fa4-fa5
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //fa6-fa7
MICROCODE.FLAG_NONE, //fa8
MICROCODE.FLAG_NONE, //fa9
MICROCODE.FLAG_BAD, //faa
MICROCODE.FLAG_NONE, //fab
MICROCODE.FLAG_SHR_16, MICROCODE.FLAG_SHR_16, //fac-fad
MICROCODE.FLAG_BAD, //fae
MICROCODE.FLAG_NONE, //faf
MICROCODE.FLAG_UNIMPLEMENTED, MICROCODE.FLAG_UNIMPLEMENTED, //fb0-fb1
MICROCODE.FLAG_NONE, //fb2
MICROCODE.FLAG_NONE, //fb3
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //fb4-fb7
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //fb8-fb9
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //fba-fbb
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //fbc-fbf
MICROCODE.FLAG_ADD_08, MICROCODE.FLAG_ADD_16, //fc0-fc1
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, //fc2-fc7
MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, MICROCODE.FLAG_NONE, //fc8-fcf
MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD, MICROCODE.FLAG_BAD //fd0-fdf
};
//gives the opcode microcode when indexed by the opcode value
public static final MICROCODE[] opcodeTable = new MICROCODE[]
{
MICROCODE.OP_ADD, MICROCODE.OP_ADD, MICROCODE.OP_ADD, MICROCODE.OP_ADD, MICROCODE.OP_ADD, MICROCODE.OP_ADD, //0x00-0x05
MICROCODE.OP_PUSH, //0x06
MICROCODE.OP_POP, //0x07
MICROCODE.OP_OR, MICROCODE.OP_OR, MICROCODE.OP_OR, MICROCODE.OP_OR, MICROCODE.OP_OR, MICROCODE.OP_OR, //0x08-0x0d
MICROCODE.OP_PUSH, //0xe
MICROCODE.OP_BAD, //0xe-0xf
MICROCODE.OP_ADC, MICROCODE.OP_ADC, MICROCODE.OP_ADC, MICROCODE.OP_ADC, MICROCODE.OP_ADC, MICROCODE.OP_ADC, //0x10-0x15
MICROCODE.OP_PUSH, //0x16
MICROCODE.OP_POP, //0x17
MICROCODE.OP_SBB, MICROCODE.OP_SBB, MICROCODE.OP_SBB, MICROCODE.OP_SBB, MICROCODE.OP_SBB, MICROCODE.OP_SBB, //0x18-0x1d
MICROCODE.OP_PUSH, //0x1e
MICROCODE.OP_POP, //0x1f
MICROCODE.OP_AND, MICROCODE.OP_AND, MICROCODE.OP_AND, MICROCODE.OP_AND, MICROCODE.OP_AND, MICROCODE.OP_AND, //0x20-0x25
MICROCODE.OP_BAD, //0x26
MICROCODE.OP_DAA, //0x27
MICROCODE.OP_SUB, MICROCODE.OP_SUB, MICROCODE.OP_SUB, MICROCODE.OP_SUB, MICROCODE.OP_SUB, MICROCODE.OP_SUB, //0x28-0x2d
MICROCODE.OP_BAD, //0x2e
MICROCODE.OP_DAS, //0x2f
MICROCODE.OP_XOR, MICROCODE.OP_XOR, MICROCODE.OP_XOR, MICROCODE.OP_XOR, MICROCODE.OP_XOR, MICROCODE.OP_XOR, //0x30-0x35
MICROCODE.OP_BAD, //0x36
MICROCODE.OP_AAA, //0x37
MICROCODE.OP_CMP, MICROCODE.OP_CMP, MICROCODE.OP_CMP, MICROCODE.OP_CMP, MICROCODE.OP_CMP, MICROCODE.OP_CMP, //0x38-0x3d
MICROCODE.OP_BAD, //0x3e
MICROCODE.OP_AAS, //0x3f
MICROCODE.OP_INC, MICROCODE.OP_INC, MICROCODE.OP_INC, MICROCODE.OP_INC, MICROCODE.OP_INC, MICROCODE.OP_INC, MICROCODE.OP_INC, MICROCODE.OP_INC, //0x40-0x47
MICROCODE.OP_DEC, MICROCODE.OP_DEC, MICROCODE.OP_DEC, MICROCODE.OP_DEC, MICROCODE.OP_DEC, MICROCODE.OP_DEC, MICROCODE.OP_DEC, MICROCODE.OP_DEC, //0x48-0x4f
MICROCODE.OP_PUSH, MICROCODE.OP_PUSH, MICROCODE.OP_PUSH, MICROCODE.OP_PUSH, MICROCODE.OP_PUSH, MICROCODE.OP_PUSH, MICROCODE.OP_PUSH, MICROCODE.OP_PUSH, //0x50-0x57
MICROCODE.OP_POP, MICROCODE.OP_POP, MICROCODE.OP_POP, MICROCODE.OP_POP, MICROCODE.OP_POP, MICROCODE.OP_POP, MICROCODE.OP_POP, MICROCODE.OP_POP, //0x58-0x5f
MICROCODE.OP_PUSHA, //0x60
MICROCODE.OP_POPA, //0x61
MICROCODE.OP_BOUND, //0x62
MICROCODE.OP_MOV, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0x63-0x67
MICROCODE.OP_PUSH, //0x68
MICROCODE.OP_IMUL_16_32, //0x69
MICROCODE.OP_PUSH, //0x6a
MICROCODE.OP_IMUL_16_32, //0x6b
MICROCODE.OP_INSB, //0x6c
MICROCODE.OP_INSW, //0x6d
MICROCODE.OP_OUTSB, //0x6e
MICROCODE.OP_OUTSW, //0x6f
MICROCODE.OP_JO, MICROCODE.OP_JNO, MICROCODE.OP_JC, MICROCODE.OP_JNC, MICROCODE.OP_JZ, MICROCODE.OP_JNZ, MICROCODE.OP_JNA, MICROCODE.OP_JA, MICROCODE.OP_JS, MICROCODE.OP_JNS, MICROCODE.OP_JP, MICROCODE.OP_JNP, MICROCODE.OP_JL, MICROCODE.OP_JNL, MICROCODE.OP_JNG, MICROCODE.OP_JG, //0x70-0x7f
MICROCODE.OP_80_83, MICROCODE.OP_80_83, MICROCODE.OP_80_83, MICROCODE.OP_80_83, //0x80-0x83
MICROCODE.OP_TEST, MICROCODE.OP_TEST, //0x84-0x85
MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, //0x86-0x8e
MICROCODE.OP_POP, //0x8f
MICROCODE.OP_NOP, //0x90
MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, //0x91-0x97
MICROCODE.OP_CBW, //0x98
MICROCODE.OP_CWD, //0x99
MICROCODE.OP_CALL_FAR, //0x9a
MICROCODE.OP_FLOAT_NOP, //0x9b
MICROCODE.OP_PUSHF, //0x9c
MICROCODE.OP_POPF, //0x9d
MICROCODE.OP_SAHF, //0x9e
MICROCODE.OP_LAHF, //0x9f
MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, //0xa0-0xa3
MICROCODE.OP_MOVSB, //0xa4
MICROCODE.OP_MOVSW, //0xa5
MICROCODE.OP_CMPSB, //0xa6
MICROCODE.OP_CMPSW, //0xa7
MICROCODE.OP_TEST, MICROCODE.OP_TEST, //0xa8-0xa9
MICROCODE.OP_STOSB, //0xaa
MICROCODE.OP_STOSW, //0xab
MICROCODE.OP_LODSB, //0xac
MICROCODE.OP_LODSW, //0xad
MICROCODE.OP_SCASB, //0xae
MICROCODE.OP_SCASW, //0xaf
MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, //0xb0-0xbf
MICROCODE.OP_ROTATE_08, //0xc0
MICROCODE.OP_ROTATE_16_32, //0xc1
MICROCODE.OP_RET_IW, //0xc2
MICROCODE.OP_RET, //0xc3
MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, //0xc4-0xc7
MICROCODE.OP_ENTER, //0xc8
MICROCODE.OP_LEAVE, //0xc9
MICROCODE.OP_RET_FAR_IW, //0xca
MICROCODE.OP_RET_FAR, //0xcb
MICROCODE.OP_INT3, //0xcc
MICROCODE.OP_INT, //0xcd
MICROCODE.OP_INT0, //0xce
MICROCODE.OP_IRET, //0xcf
MICROCODE.OP_ROTATE_08, //0xd0
MICROCODE.OP_ROTATE_16_32, //0xd1
MICROCODE.OP_ROTATE_08, //0xd2
MICROCODE.OP_ROTATE_16_32, //0xd3
MICROCODE.OP_AAM, //0xd4
MICROCODE.OP_AAD, //0xd5
MICROCODE.OP_SALC, //0xd6
MICROCODE.OP_MOV, //0xd7
MICROCODE.OP_FLOAT_NOP, MICROCODE.OP_FLOAT_NOP, MICROCODE.OP_FLOAT_NOP, MICROCODE.OP_FLOAT_NOP, MICROCODE.OP_FLOAT_NOP, MICROCODE.OP_FLOAT_NOP, MICROCODE.OP_FLOAT_NOP, MICROCODE.OP_FLOAT_NOP, //0xd8-0xdf
MICROCODE.OP_LOOPNZ_CX, MICROCODE.OP_LOOPZ_CX, MICROCODE.OP_LOOP_CX, MICROCODE.OP_JCXZ, //0xe0-0xe3
MICROCODE.OP_IN_08, MICROCODE.OP_IN_16_32, //0xe4-0xe5
MICROCODE.OP_OUT_08, MICROCODE.OP_OUT_16_32, //0xe6-0xe7
MICROCODE.OP_CALL, //0xe8
MICROCODE.OP_JMP_16_32, //0xe9
MICROCODE.OP_JMP_FAR, //0xea
MICROCODE.OP_JMP_08, //0xeb
MICROCODE.OP_IN_08, MICROCODE.OP_IN_16_32, //0xec-0xed
MICROCODE.OP_OUT_08, MICROCODE.OP_OUT_16_32, //0xee-0xef
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xf0-0xf3
MICROCODE.OP_HALT, //0xf4
MICROCODE.OP_CMC, //0xf5
MICROCODE.OP_F6, MICROCODE.OP_F7, //0xf6-f7
MICROCODE.OP_CLC, MICROCODE.OP_STC, MICROCODE.OP_CLI, MICROCODE.OP_STI, MICROCODE.OP_CLD, MICROCODE.OP_STD, //0xf8-0xfd
MICROCODE.OP_FE, MICROCODE.OP_FF, //0xfe-0xff
MICROCODE.OP_F00, MICROCODE.OP_F01, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xf00-0xf05
MICROCODE.OP_CLTS, //0xf06
MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xf07-0xf08
MICROCODE.OP_NOP, //0xf09
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xf0a-0xf1e
MICROCODE.OP_NOP, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, //0xf1f-0xf23
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xf20-0xf2f
MICROCODE.OP_UNIMPLEMENTED, //0xf30
MICROCODE.OP_RDTSC, //0xf31
MICROCODE.OP_UNIMPLEMENTED, //0xf32
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xf33-0xf3f
MICROCODE.OP_CMOVO, MICROCODE.OP_CMOVNO, MICROCODE.OP_CMOVC, MICROCODE.OP_CMOVNC, MICROCODE.OP_CMOVZ, MICROCODE.OP_CMOVNZ, MICROCODE.OP_CMOVNA, MICROCODE.OP_CMOVA, MICROCODE.OP_CMOVS, MICROCODE.OP_CMOVNS, MICROCODE.OP_CMOVP, MICROCODE.OP_CMOVNP, MICROCODE.OP_CMOVL, MICROCODE.OP_CMOVNL, MICROCODE.OP_CMOVNG, MICROCODE.OP_CMOVG, //0xf40-0xf4f
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xf50-0xf7f
MICROCODE.OP_JO_16_32, MICROCODE.OP_JNO_16_32, MICROCODE.OP_JC_16_32, MICROCODE.OP_JNC_16_32, MICROCODE.OP_JZ_16_32, MICROCODE.OP_JNZ_16_32, MICROCODE.OP_JNA_16_32, MICROCODE.OP_JA_16_32, MICROCODE.OP_JS_16_32, MICROCODE.OP_JNS_16_32, MICROCODE.OP_JP_16_32, MICROCODE.OP_JNP_16_32, MICROCODE.OP_JL_16_32, MICROCODE.OP_JNL_16_32, MICROCODE.OP_JNG_16_32, MICROCODE.OP_JG_16_32, //0xf80-0xf8f
MICROCODE.OP_SETO, MICROCODE.OP_SETNO, MICROCODE.OP_SETC, MICROCODE.OP_SETNC, MICROCODE.OP_SETZ, MICROCODE.OP_SETNZ, MICROCODE.OP_SETNA, MICROCODE.OP_SETA, MICROCODE.OP_SETS, MICROCODE.OP_SETNS, MICROCODE.OP_SETP, MICROCODE.OP_SETNP, MICROCODE.OP_SETL, MICROCODE.OP_SETNL, MICROCODE.OP_SETNG, MICROCODE.OP_SETG, //0xf90-0xf9f
MICROCODE.OP_PUSH, //0xfa0
MICROCODE.OP_POP, //0xfa1
MICROCODE.OP_CPUID, //0xfa2
MICROCODE.OP_BT_16_32, //0xfa3
MICROCODE.OP_SHLD_16_32, MICROCODE.OP_SHLD_16_32, //0xfa4-0xfa5
MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xfa6-0xfa7
MICROCODE.OP_PUSH, //0xfa8
MICROCODE.OP_POP, //0xfa9
MICROCODE.OP_BAD, //0xfaa
MICROCODE.OP_BTS_16_32, //0xfab
MICROCODE.OP_SHRD_16_32, MICROCODE.OP_SHRD_16_32, //0xfac-0xfad
MICROCODE.OP_BAD, MICROCODE.OP_IMUL_16_32, //0xfae-0xfaf
MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, //0xfb0-0xfb1
MICROCODE.OP_MOV, //0xfb2
MICROCODE.OP_BTR_16_32, //0xfb3
MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, MICROCODE.OP_MOV, //0xfb4-0xfb7
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_UNIMPLEMENTED, //0xfb8-0xfba
MICROCODE.OP_BTC_16_32, //0xfbb
MICROCODE.OP_BSF, //0xfbc
MICROCODE.OP_BSR, //0xfbd
MICROCODE.OP_SIGN_EXTEND, //0xfbe
MICROCODE.OP_SIGN_EXTEND_16_32, //0xfbf
MICROCODE.OP_ADD, MICROCODE.OP_ADD, //0xfc0-0xfc1
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, //0xfc2-0xfc7
MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, MICROCODE.OP_UNIMPLEMENTED, //0xfc8-0xfcf
MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD, MICROCODE.OP_BAD //0xfd0-0xfff
};
}
| [
"[email protected]"
] | |
24ac17f11feea701416e2d38adb629f594ca13ad | b8e76bfc981176fd83ef415963a714c298537ed4 | /CBP/plugin/identity/fermat-cbp-plugin-identity-crypto-customer-bitdubai/src/main/java/com/bitdubai/fermat_cbp_plugin/layer/identity/crypto_customer/developer/bitdubai/version_1/database/CryptoCustomerIdentityDeveloperDatabaseFactory.java | 4fefb6b21280e99f77b6c527c2891bf01f3591c4 | [
"MIT"
] | permissive | jadzalla/fermat-unused | 827b9c8ccb805be934acb14479b28fbddf56306c | d5e9633109caac3e88e9e3109862ae40d962cd96 | refs/heads/master | 2020-03-17T00:49:29.989918 | 2015-10-06T04:51:46 | 2015-10-06T04:51:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,889 | java | package com.bitdubai.fermat_cbp_plugin.layer.identity.crypto_customer.developer.bitdubai.version_1.database;
import com.bitdubai.fermat_api.DealsWithPluginIdentity;
import com.bitdubai.fermat_api.layer.all_definition.developer.DeveloperDatabase;
import com.bitdubai.fermat_api.layer.all_definition.developer.DeveloperDatabaseTable;
import com.bitdubai.fermat_api.layer.all_definition.developer.DeveloperDatabaseTableRecord;
import com.bitdubai.fermat_api.layer.all_definition.developer.DeveloperObjectFactory;
import com.bitdubai.fermat_api.layer.osa_android.database_system.Database;
import com.bitdubai.fermat_api.layer.osa_android.database_system.DatabaseRecord;
import com.bitdubai.fermat_api.layer.osa_android.database_system.DatabaseTable;
import com.bitdubai.fermat_api.layer.osa_android.database_system.DatabaseTableRecord;
import com.bitdubai.fermat_api.layer.osa_android.database_system.DealsWithPluginDatabaseSystem;
import com.bitdubai.fermat_api.layer.osa_android.database_system.PluginDatabaseSystem;
import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantCreateDatabaseException;
import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantLoadTableToMemoryException;
import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.DatabaseNotFoundException;
import com.bitdubai.fermat_api.layer.osa_android.database_system.exceptions.CantOpenDatabaseException;
import com.bitdubai.fermat_cbp_plugin.layer.identity.crypto_customer.developer.bitdubai.version_1.exceptions.CantInitializeCryptoCustomerIdentityDatabaseException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* The Class <code>com.bitdubai.fermat_cbp_plugin.layer.identity.crypto_customer.developer.bitdubai.version_1.database.CryptoCustomerIdentityDeveloperDatabaseFactory</code> have
* contains the methods that the Developer Database Tools uses to show the information.
* <p/>
*
* Created by Jorge Gonzalez - ([email protected]) on 28/09/15.
*
* @version 1.0
* @since Java JDK 1.7
*/
public class CryptoCustomerIdentityDeveloperDatabaseFactory implements DealsWithPluginDatabaseSystem, DealsWithPluginIdentity {
/**
* DealsWithPluginDatabaseSystem Interface member variables.
*/
PluginDatabaseSystem pluginDatabaseSystem;
/**
* DealsWithPluginIdentity Interface member variables.
*/
UUID pluginId;
Database database;
/**
* Constructor
*
* @param pluginDatabaseSystem
* @param pluginId
*/
public CryptoCustomerIdentityDeveloperDatabaseFactory(PluginDatabaseSystem pluginDatabaseSystem, UUID pluginId) {
this.pluginDatabaseSystem = pluginDatabaseSystem;
this.pluginId = pluginId;
}
/**
* This method open or creates the database i'll be working with
*
* @throws CantInitializeCryptoCustomerIdentityDatabaseException
*/
public void initializeDatabase() throws CantInitializeCryptoCustomerIdentityDatabaseException {
try {
/*
* Open new database connection
*/
database = this.pluginDatabaseSystem.openDatabase(pluginId, pluginId.toString());
} catch (CantOpenDatabaseException cantOpenDatabaseException) {
/*
* The database exists but cannot be open. I can not handle this situation.
*/
throw new CantInitializeCryptoCustomerIdentityDatabaseException(cantOpenDatabaseException.getMessage());
} catch (DatabaseNotFoundException e) {
/*
* The database no exist may be the first time the plugin is running on this device,
* We need to create the new database
*/
CryptoCustomerIdentityDatabaseFactory cryptoCustomerIdentityDatabaseFactory = new CryptoCustomerIdentityDatabaseFactory(pluginDatabaseSystem);
try {
/*
* We create the new database
*/
database = cryptoCustomerIdentityDatabaseFactory.createDatabase(pluginId, pluginId.toString());
} catch (CantCreateDatabaseException cantCreateDatabaseException) {
/*
* The database cannot be created. I can not handle this situation.
*/
throw new CantInitializeCryptoCustomerIdentityDatabaseException(cantCreateDatabaseException.getMessage());
}
}
}
public List<DeveloperDatabase> getDatabaseList(DeveloperObjectFactory developerObjectFactory) {
/**
* I only have one database on my plugin. I will return its name.
*/
List<DeveloperDatabase> databases = new ArrayList<DeveloperDatabase>();
databases.add(developerObjectFactory.getNewDeveloperDatabase("Crypto Customer", this.pluginId.toString()));
return databases;
}
public List<DeveloperDatabaseTable> getDatabaseTableList(DeveloperObjectFactory developerObjectFactory) {
List<DeveloperDatabaseTable> tables = new ArrayList<DeveloperDatabaseTable>();
/**
* Table Crypto Customer columns.
*/
List<String> cryptoCustomerColumns = new ArrayList<String>();
cryptoCustomerColumns.add(CryptoCustomerIdentityDatabaseConstants.CRYPTO_CUSTOMER_CRYPTO_CUSTOMER_PUBLIC_KEY_COLUMN_NAME);
cryptoCustomerColumns.add(CryptoCustomerIdentityDatabaseConstants.CRYPTO_CUSTOMER_ALIAS_COLUMN_NAME);
cryptoCustomerColumns.add(CryptoCustomerIdentityDatabaseConstants.CRYPTO_CUSTOMER_DEVICE_USER_PUBLIC_KEY_COLUMN_NAME);
/**
* Table Crypto Customer addition.
*/
DeveloperDatabaseTable cryptoCustomerTable = developerObjectFactory.getNewDeveloperDatabaseTable(CryptoCustomerIdentityDatabaseConstants.CRYPTO_CUSTOMER_TABLE_NAME, cryptoCustomerColumns);
tables.add(cryptoCustomerTable);
return tables;
}
public List<DeveloperDatabaseTableRecord> getDatabaseTableContent(DeveloperObjectFactory developerObjectFactory, DeveloperDatabaseTable developerDatabaseTable) {
/**
* Will get the records for the given table
*/
List<DeveloperDatabaseTableRecord> returnedRecords = new ArrayList<DeveloperDatabaseTableRecord>();
/**
* I load the passed table name from the SQLite database.
*/
DatabaseTable selectedTable = database.getTable(developerDatabaseTable.getName());
try {
selectedTable.loadToMemory();
} catch (CantLoadTableToMemoryException cantLoadTableToMemory) {
/**
* if there was an error, I will returned an empty list.
*/
return returnedRecords;
}
List<DatabaseTableRecord> records = selectedTable.getRecords();
List<String> developerRow = new ArrayList<String>();
for (DatabaseTableRecord row : records) {
/**
* for each row in the table list
*/
for (DatabaseRecord field : row.getValues()) {
/**
* I get each row and save them into a List<String>
*/
developerRow.add(field.getValue().toString());
}
/**
* I create the Developer Database record
*/
returnedRecords.add(developerObjectFactory.getNewDeveloperDatabaseTableRecord(developerRow));
}
/**
* return the list of DeveloperRecords for the passed table.
*/
return returnedRecords;
}
@Override
public void setPluginDatabaseSystem(PluginDatabaseSystem pluginDatabaseSystem) {
this.pluginDatabaseSystem = pluginDatabaseSystem;
}
@Override
public void setPluginId(UUID pluginId) {
this.pluginId = pluginId;
}
} | [
"[email protected]"
] | |
42ee04580ad8b2ebf387a3eee72cac336f916372 | 35a620858338f371c42a5c78139dc94b45cf087b | /src/com/mckc/LeetCode/LeetCode1716.java | eb7b7a35009abb92064a9cebc62a690dc3a11724 | [] | no_license | XI1062-abhisheksinghal/CoreJava-Algo | ed9e7b747c83f4165ba852715bd94a444795bfb6 | 703290326e145288d13328f54265232bd15edffd | refs/heads/master | 2023-05-25T21:08:03.152354 | 2023-05-20T08:19:01 | 2023-05-20T08:19:01 | 267,253,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package com.mckc.LeetCode;
public class LeetCode1716 {
public static void main(String[] args) {
System.out.println(totalMoney(10));
}
static int sum = 0;
public static int totalMoney(int n) {
int quo = n / 7;
int start = 1;
int rem = n % 7;
while (quo >= 1) {
sum = sum + calSum(start, 7);
start = start + 1;
quo--;
}
if (rem > 0) {
sum = sum + calSum(start, rem);
}
return sum;
}
public static int calSum(int start, int nums) {
int s = 0;
for (int i = 1; i <= nums; i++) {
s = s + start;
start++;
}
return s;
}
} | [
"[email protected]"
] | |
6df7f9e6e1b36411f09109ca6bf1b96ea5f776df | 95bec9ea0a0e3b84f1722cd6bf1aa19349e6099e | /src/main/java/org/mockito/internal/creation/bytebuddy/package-info.java | 00bf82774f5a85c195d47c24b18be310bc5abe7d | [
"MIT"
] | permissive | yangfancoming/mockito | fab90dbe69faf8958fc840208ed3e4a8801d7911 | 5aa9df3d4ffab02339081d1cf1a8fe691d1be20a | refs/heads/master | 2020-06-13T21:21:25.181334 | 2019-07-02T05:39:51 | 2019-07-02T05:39:51 | 194,789,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java |
/**
* ByteBuddy related stuff.
*/
package org.mockito.internal.creation.bytebuddy;
| [
"[email protected]"
] | |
38b44b7e3d0ae10fe51716393dddfbb5db93bb4e | 88ca91ab368f504f3a5bac8f7b874c5994951bd1 | /oop/src/main/java/com/wanshare/oop/bridge/Client.java | 0189be23577597ffabba3b5bec71403e474caeb8 | [] | no_license | hgwwy/oop | 5d4d351500a7462abc8339bbf8e30235ebddd29f | 802033c8dadf6817bbed898ffba74ad283ee3ee0 | refs/heads/master | 2020-03-29T22:04:47.051100 | 2018-09-26T09:44:47 | 2018-09-26T09:44:47 | 150,402,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.wanshare.oop.bridge;
class Client {
public static void main(String args[]) {
Image image;
ImageImp imp;
image = new GIFImage();
imp = new LinuxImp();
image.setImageImp(imp);
image.parseFile("小龙女");
}
} | [
"[email protected]"
] | |
efbf02d8b33371228ef07549f56d56a9de63b9d7 | 6c83483587db7414c3e4399865d4c3cef0bc7d18 | /src/test/java/selectors/LogoutSelectors.java | 4337d831c39eb5b2acad3df9b52639c312c814a3 | [] | no_license | rak041988/automationpractice-gradle-bdd-project | 78df4c5d3d822b5d59e75768defec29059f56790 | 8fcc0de53c5c19205425b65a0c1fb5e582bd7934 | refs/heads/master | 2021-02-11T16:16:45.272745 | 2018-02-05T22:25:43 | 2018-02-05T22:25:43 | 244,509,126 | 0 | 0 | null | 2020-03-03T00:55:16 | 2020-03-03T00:55:15 | null | UTF-8 | Java | false | false | 196 | java | package selectors;
import org.openqa.selenium.By;
/**
* Created by babu on 12/07/2016.
*/
public class LogoutSelectors {
public static final By LINK_SIGNOUT = By.cssSelector(".logout");
}
| [
"[email protected]"
] | |
ed98f2023019de9b4de3241ff4d92cff99526b28 | 36eee821e6cd6d18667dcf495e74fb4e238ed9e8 | /labs/lab06-assignment-registration/src/main/java/com/iihtibm/registration/domain/MyUser.java | f04c1f7e0b454526bc014300c937283e261ec9f9 | [] | no_license | lqsavage/FSD | 3cd4bfffa2bb2ab2239202333782f27de3cfde74 | d0fd92ff0d6c21cf8f0d6aaf795a98228bb8685c | refs/heads/master | 2020-06-10T14:55:16.855871 | 2019-10-22T07:38:50 | 2019-10-22T07:38:50 | 193,659,246 | 0 | 0 | null | 2019-10-22T07:38:51 | 2019-06-25T07:40:52 | JavaScript | UTF-8 | Java | false | false | 1,062 | java | package com.iihtibm.registration.domain;
import lombok.Data;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* @author savagelee
*/
@Data
@Entity
@Table(name = "myuser")
public class MyUser implements Serializable {
private static final long serialVersionUID = 3497935890426858541L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long userId;
@NotBlank
@Size(min=2, max=20)
private String name;
@NotBlank
@Email
private String email;
@NotBlank
@Size(min=2, max=20)
private String username;
@NotBlank
@Size(min=6, max=60)
private String password;
@NotBlank
private String role;
@Transient
private boolean accountNonExpired = true;
@Transient
private boolean accountNonLocked= true;
@Transient
private boolean credentialsNonExpired= true;
@Transient
private boolean enabled= true;
}
| [
"[email protected]"
] | |
77c1dd6111f23bf48b422772b067a71adfb11ffb | 5ec2812776078eb918a4e9c7fb60b2ac847bb24e | /weaforce-web-cms/src/main/java/com/weaforce/cms/dao/impl/ContentDao.java | 4b316508fe86222fb732bc3b729aee39d36992ba | [] | no_license | liveqmock/weaforce-cms | 0d3716a1126c3e9e9192f6f228551b16e4776d83 | 87fbe6c4a480614c574a6a40e786722277723e3b | refs/heads/master | 2020-04-02T01:09:49.472756 | 2014-09-13T10:11:19 | 2014-09-13T10:11:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.weaforce.cms.dao.impl;
import org.springframework.stereotype.Repository;
import com.weaforce.cms.dao.IContentDao;
import com.weaforce.cms.entity.ArticleContent;
import com.weaforce.core.dao.impl.GenericDao;
@Repository("articleContentDao")
public class ContentDao extends GenericDao<ArticleContent, Long> implements
IContentDao {
}
| [
"[email protected]"
] | |
2a4867e133d777796e64306ca7d78a6a1be6d561 | 00abc1aec703a1d48c393bf853be907fc44280f5 | /yeb-generator/src/main/java/com/ming/service/impl/AdminServiceImpl.java | 8ee8fd03326b53c94d8610664e5dd84ac4d634a6 | [] | no_license | xiaoming-master/yeb | 81c5f96e70881c5d9cff1b521f74a27c56115d24 | 843750239e67c1f92969a7990ac304c952e33593 | refs/heads/master | 2023-06-24T09:27:42.757753 | 2021-07-24T17:30:08 | 2021-07-24T17:30:08 | 387,009,042 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 450 | java | package com.ming.service.impl;
import com.ming.pojo.Admin;
import com.ming.mapper.AdminMapper;
import com.ming.service.IAdminService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author zhanglishen
* @since 2021-07-17
*/
@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements IAdminService {
}
| [
"[email protected]"
] | |
7291616a6262291be0129e20ae170bc8a6068c70 | 5b99fae72704b9926e42e49c35dd4fe4a985d2de | /DIT011/Code Examples from Lenart/Buttons etc/ButtonDemo.java | d62466425cb49edefecf07008f2802d7b00a2158 | [] | no_license | dsignlife/gjava | db67909d509289284de5ee5953c85aae190bf558 | a199b82a47e68c228f2fdce7605b86bb563ec37b | refs/heads/master | 2020-04-07T13:59:06.428114 | 2017-09-05T14:00:35 | 2017-09-05T14:00:35 | 42,174,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,071 | java | //package chapter16;
//import chapter14.MessagePanel;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.*;
public class ButtonDemo extends JFrame {
// Create a panel for displaying message
protected MessagePanel messagePanel
= new MessagePanel("Welcome to Java");
// Declare two buttons to move the message left and right
private JButton jbtLeft = new JButton("<=");
private JButton jbtRight = new JButton("=>");
public static void main(String[] args) {
ButtonDemo frame = new ButtonDemo();
frame.setTitle("ButtonDemo");
frame.setLocationRelativeTo(null); // Center the frame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 200);
frame.setVisible(true);
}
public ButtonDemo() {
// Set the background color of messagePanel
messagePanel.setBackground(Color.white);
// Create Panel jpButtons to hold two Buttons "<=" and "right =>"
JPanel jpButtons = new JPanel();
jpButtons.setLayout(new FlowLayout());
jpButtons.add(jbtLeft);
jpButtons.add(jbtRight);
// Set keyboard mnemonics
jbtLeft.setMnemonic('L');
jbtRight.setMnemonic('R');
// Set icons and remove text
// jbtLeft.setIcon(new ImageIcon("image/left.gif"));
// jbtRight.setIcon(new ImageIcon("image/right.gif"));
// jbtLeft.setText(null);
// jbtRight.setText(null);
// Set tool tip text on the buttons
jbtLeft.setToolTipText("Move message to left");
jbtRight.setToolTipText("Move message to right");
// Place panels in the frame
setLayout(new BorderLayout());
add(messagePanel, BorderLayout.CENTER);
add(jpButtons, BorderLayout.SOUTH);
// Register listeners with the buttons
jbtLeft.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
messagePanel.moveLeft();
}
});
jbtRight.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
messagePanel.moveRight();
}
});
}
}
| [
"[email protected]"
] | |
55899568e9cd25842ee1222449edb05fdbd983c5 | a6ba7fc9f30f71a898070fdb785f34e3f0a9f44d | /Team406/src/main/java/org/firstinspires/ftc/team406/oldOpModes/Examples/PushBotTelemetry.java | 30c7bbc72adcd825f222508b0d32f69a2aafc55d | [
"BSD-3-Clause"
] | permissive | PsouthRobotics1182/FTC16-17 | cb140c75ba9bbcb066ab91da4947c0db05cee423 | 93b066954decbd20454c42099cca9571ffd108a1 | refs/heads/master | 2020-04-10T00:53:16.736907 | 2017-04-05T20:39:08 | 2017-04-05T20:39:08 | 68,239,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,728 | java | /*
package com.qualcomm.ftcrobotcontroller.opmodes;
//------------------------------------------------------------------------------
//
// PushBotTelemetry
//
*/
/**
* Provide telemetry provided by the PushBotHardware class.
*
* Insert this class between a custom op-mode and the PushBotHardware class to
* display telemetry available from the hardware class.
*
* @author SSI Robotics
* @version 2015-08-02-13-57
*
* Telemetry Keys
* 00 - Important message; sometimes used for error messages.
* 01 - The power being sent to the left drive's motor controller and the
* encoder count returned from the motor controller.
* 02 - The power being sent to the right drive's motor controller and the
* encoder count returned from the motor controller.
* 03 - The power being sent to the left arm's motor controller.
* 04 - The position being sent to the left and right hand's servo
* controller.
* 05 - The negative value of gamepad 1's left stick's y (vertical; up/down)
* value.
* 06 - The negative value of gamepad 1's right stick's y (vertical;
* up/down) value.
* 07 - The negative value of gamepad 2's left stick's y (vertical; up/down)
* value.
* 08 - The value of gamepad 2's X button (true/false).
* 09 - The value of gamepad 2's Y button (true/false).
* 10 - The value of gamepad 1's left trigger value.
* 11 - The value of gamepad 1's right trigger value.
*//*
public class PushBotTelemetry extends PushBotHardware
{
//--------------------------------------------------------------------------
//
// PushBotTelemetry
//
*/
/**
* Construct the class.
*
* The system calls this member when the class is instantiated.
*//*
public PushBotTelemetry ()
{
//
// Initialize base classes.
//
// All via self-construction.
//
// Initialize class members.
//
// All via self-construction.
} // PushBotTelemetry
//--------------------------------------------------------------------------
//
// update_telemetry
//
*/
/**
* Update the telemetry with current values from the base class.
*//*
public void update_telemetry ()
{
if (a_warning_generated ())
{
set_first_message (a_warning_message ());
}
//
// Send telemetry data to the driver station.
//
telemetry.addData
( "01"
, "Left Drive: "
+ a_left_drive_power ()
+ ", "
+ a_left_encoder_count ()
);
telemetry.addData
( "02"
, "Right Drive: "
+ a_right_drive_power ()
+ ", "
+ a_right_encoder_count ()
);
telemetry.addData
( "03"
, "Left Arm: " + a_left_arm_power ()
);
telemetry.addData
( "04"
, "Hand Position: " + a_hand_position ()
);
} // update_telemetry
//--------------------------------------------------------------------------
//
// update_gamepad_telemetry
//
*/
/**
* Update the telemetry with current gamepad readings.
*//*
public void update_gamepad_telemetry ()
{
//
// Send telemetry data concerning gamepads to the driver station.
//
telemetry.addData ("05", "GP1 Left: " + -gamepad1.left_stick_y);
telemetry.addData ("06", "GP1 Right: " + -gamepad1.right_stick_y);
telemetry.addData ("07", "GP2 Left: " + -gamepad2.left_stick_y);
telemetry.addData ("08", "GP2 X: " + gamepad2.x);
telemetry.addData ("09", "GP2 Y: " + gamepad2.y);
telemetry.addData ("10", "GP1 LT: " + gamepad1.left_trigger);
telemetry.addData ("11", "GP1 RT: " + gamepad1.right_trigger);
} // update_gamepad_telemetry
//--------------------------------------------------------------------------
//
// set_first_message
//
*/
/**
* Update the telemetry's first message with the specified message.
*//*
public void set_first_message (String p_message)
{
telemetry.addData ( "00", p_message);
} // set_first_message
//--------------------------------------------------------------------------
//
// set_error_message
//
*/
/**
* Update the telemetry's first message to indicate an error.
*//*
public void set_error_message (String p_message)
{
set_first_message ("ERROR: " + p_message);
} // set_error_message
} // PushBotTelemetry
*/
| [
"[email protected]"
] | |
0b6b7593d5b621dca88abdc75e500e37d8e0f121 | b3cc77ecfb35b2bfa6025967fb9c2491ff0e188d | /app/src/main/java/com/example/klinik_pln/activity/CekAntrianActivity.java | 0d45d73d5564d22f828087dba082826de4112858 | [] | no_license | azwarbahar/Klinik_Pln | 920e632d8928ca58a2dff9b3ee3bfb7ffe884d33 | 55d5910bf1a78435b57ca5e5188f3c0b7daf8a1b | refs/heads/master | 2023-06-26T00:26:11.804679 | 2021-07-21T13:14:32 | 2021-07-21T13:14:32 | 329,935,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,453 | java | package com.example.klinik_pln.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.klinik_pln.R;
import com.example.klinik_pln.activity.PasienActivity;
public class CekAntrianActivity extends AppCompatActivity {
//Terima data dari Branda
private String GET_KODE = "get_kode";
private String GET_PERIKSA = "get_periksa";
private String GET_TGL = "get_tgl";
private String GET_JAM = "get_jam";
private TextView no_antrian;
private TextView tv_no_periksa;
private TextView tv_jam;
private TextView tv_tgl;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cek_antrian);
no_antrian = findViewById(R.id.no_antrian);
tv_no_periksa = findViewById(R.id.tv_no_periksa);
tv_jam = findViewById(R.id.tv_jam);
tv_tgl = findViewById(R.id.tv_tgl);
DapatData();
}
private void DapatData(){
Bundle bundle = getIntent().getExtras();
assert bundle != null;
no_antrian.setText(bundle.getString(GET_KODE));
tv_no_periksa.setText(bundle.getString(GET_PERIKSA));
tv_jam.setText(bundle.getString(GET_JAM));
tv_tgl.setText(bundle.getString(GET_TGL));
}
}
| [
"[email protected]"
] | |
2591c001146540984448274c0225d1d98a44e415 | 9da91ed524c7cd13d442e82439bd661cd48d87ab | /src/DogDoor.java | 78c16fcb6d57ba8cdcf2e02716ae8108ca306f56 | [] | no_license | t00137667/DogDoor | abb4b0a9f59e7b4ec961b79ad0e968746cb71006 | 2ca0afb63e6b91ce3286a5d5207136fe402c0007 | refs/heads/master | 2020-09-05T03:23:07.665912 | 2019-11-06T10:12:05 | 2019-11-06T10:12:05 | 219,967,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | import java.util.Timer;
import java.util.TimerTask;
public class DogDoor {
private boolean open;
public DogDoor(){
this.open = false;
}
public void open(){
System.out.println("The dog door is opening");
open=true;
}
public void close(){
System.out.println("The dog door is closing");
open=false;
}
public void openTimed(){
open();
final Timer timer = new Timer();
timer.schedule(new TimerTask(){
public void run(){
close();
timer.cancel();
}
},5000);
}
//returns the state of the door
public boolean isOpen(){
return open;
}
}
| [
"[email protected]"
] | |
f51552d6a7106c7a7462abbd443d81fb8cee9e02 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-1111/u-11-111-1111-11111/u-11-111-1111-11111-f4376.java | 2c2331036dea101024308af447a758c2a5d02554 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
3070879272058 | [
"[email protected]"
] | |
bd741ab5044f96eb7e32dca16aa95cea97febe80 | 8be64239f0053da0409d1b76776c90a91e21a2f4 | /Escapa.java | 35e5cc3ca390eab9e9790110cad195b92bb29e99 | [] | no_license | josenegrete0204/Hormiga | 2ef0849d56e3ec8120e460c0068034e62cdf8742 | 6c1b9388a3a3bfc899bfbf5863dd77e1a9d36021 | refs/heads/master | 2023-03-18T08:43:57.816129 | 2021-03-12T03:14:36 | 2021-03-12T03:14:36 | 346,904,293 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | public function Escapa() :void {
velocity = new Vector3D(Game.instance.leaf.x - position.x, Game.instance.leaf.y - position.y);
if (distance(Game.instance.leaf, this) <= 12) {
brain.setState(Casa);
}
if (distance(Game.mouse, this) <= MOUSE_THREAT_RADIUS) {
brain.setState(Escapa);
}
} | [
"[email protected]"
] | |
1b2d1540837af8c45db8a1b4e338764fb033d7e4 | 52571bbc269a804c7df8f7b27ae3c41ee84f84f2 | /leetcode/src/main/java/codexe/han/leetcode/escapeplan/escape116.java | f1722b153047de56ccb98876b95142720ff14af7 | [] | no_license | codexehan/java-related | 8b684b18b2402983cfd0ab6e44a860b8c014f0e7 | a023a4f3e87a6558925af49f35de2f39bb0c1194 | refs/heads/master | 2020-05-07T06:02:43.118869 | 2019-12-30T10:40:55 | 2019-12-30T10:40:55 | 180,296,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,391 | java | package codexe.han.leetcode.escapeplan;
public class escape116 {
public Node connect(Node root) {
if(root==null) return null;
if(root.left!=null) root.left.next=root.right;
if(root.next!=null && root.right!=null) root.right.next=root.next.left;
connect(root.left);
connect(root.right);
return root;
}
public Node bft(Node node){
if(node==null) return null;
if(node.left!=null) node.left.next = node.right;
if(node.next!=null) node.right.next = node.next.left;//perfect binary tree
bft(node.left);
bft(node.right);
return node;
}
class Node {
public int val;
public Node left;
public Node right;
public Node next;
public Node() {}
public Node(int _val,Node _left,Node _right,Node _next) {
val = _val;
left = _left;
right = _right;
next = _next;
}
}
}
/**
You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:
struct Node {
int val;
Node *left;
Node *right;
Node *next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
Initially, all next pointers are set to NULL.
*/
| [
"[email protected]"
] | |
d60380766d1294b8b081c97b8658896e8c2da077 | ef5aae9cf3ccd3912bcb35c7b17a9dc7be3bdad0 | /mockserver-core/src/main/java/org/mockserver/client/serialization/model/HttpRequestDTO.java | fb2ccc5ba4f2d73c8479ab73dbdd5a84ee40a88a | [
"Apache-2.0"
] | permissive | DragosCoros/mockserver | b4ed9cfd67fd83a02be90926ac71c3c5b8d8fb5c | 593dfbc4c891eb541996580915b580b2644a7dfa | refs/heads/master | 2020-12-07T15:16:58.895353 | 2015-06-08T07:51:14 | 2015-06-08T07:51:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,246 | java | package org.mockserver.client.serialization.model;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.mockserver.model.*;
import java.util.ArrayList;
import java.util.List;
import static org.mockserver.model.NottableString.string;
/**
* @author jamesdbloom
*/
public class HttpRequestDTO extends NotDTO {
private NottableString method = string("");
private NottableString path = string("");
private List<ParameterDTO> queryStringParameters = new ArrayList<ParameterDTO>();
private BodyDTO body;
private List<CookieDTO> cookies = new ArrayList<CookieDTO>();
private List<HeaderDTO> headers = new ArrayList<HeaderDTO>();
public HttpRequestDTO(HttpRequest httpRequest) {
this(httpRequest, false);
}
public HttpRequestDTO(HttpRequest httpRequest, Boolean not) {
super(not);
if (httpRequest != null) {
method = httpRequest.getMethod();
path = httpRequest.getPath();
headers = Lists.transform(httpRequest.getHeaders(), new Function<Header, HeaderDTO>() {
public HeaderDTO apply(Header header) {
return new HeaderDTO(header, header.getNot());
}
});
cookies = Lists.transform(httpRequest.getCookies(), new Function<Cookie, CookieDTO>() {
public CookieDTO apply(Cookie cookie) {
return new CookieDTO(cookie, cookie.getNot());
}
});
queryStringParameters = Lists.transform(httpRequest.getQueryStringParameters(), new Function<Parameter, ParameterDTO>() {
public ParameterDTO apply(Parameter parameter) {
return new ParameterDTO(parameter, parameter.getNot());
}
});
body = BodyDTO.createDTO(httpRequest.getBody());
}
}
public HttpRequestDTO() {
}
public HttpRequest buildObject() {
return new HttpRequest()
.withMethod(method)
.withPath(path)
.withHeaders(Lists.transform(headers, new Function<HeaderDTO, Header>() {
public Header apply(HeaderDTO header) {
return Not.not(header.buildObject(), header.getNot());
}
}))
.withCookies(Lists.transform(cookies, new Function<CookieDTO, Cookie>() {
public Cookie apply(CookieDTO cookie) {
return Not.not(cookie.buildObject(), cookie.getNot());
}
}))
.withQueryStringParameters(Lists.transform(queryStringParameters, new Function<ParameterDTO, Parameter>() {
public Parameter apply(ParameterDTO parameter) {
return Not.not(parameter.buildObject(), parameter.getNot());
}
}))
.withBody((body != null ? Not.not(body.buildObject(), body.getNot()) : null));
}
public NottableString getMethod() {
return method;
}
public HttpRequestDTO setMethod(NottableString method) {
this.method = method;
return this;
}
public NottableString getPath() {
return path;
}
public HttpRequestDTO setPath(NottableString path) {
this.path = path;
return this;
}
public List<ParameterDTO> getQueryStringParameters() {
return queryStringParameters;
}
public HttpRequestDTO setQueryStringParameters(List<ParameterDTO> queryStringParameters) {
this.queryStringParameters = queryStringParameters;
return this;
}
public BodyDTO getBody() {
return body;
}
public HttpRequestDTO setBody(BodyDTO body) {
this.body = body;
return this;
}
public List<HeaderDTO> getHeaders() {
return headers;
}
public HttpRequestDTO setHeaders(List<HeaderDTO> headers) {
this.headers = headers;
return this;
}
public List<CookieDTO> getCookies() {
return cookies;
}
public HttpRequestDTO setCookies(List<CookieDTO> cookies) {
this.cookies = cookies;
return this;
}
}
| [
"[email protected]"
] | |
50e4c66f19acf38aec16c2dc96dd5b665abfffcb | d7bc172e7351a60af6b900aeb256a5c77d60581e | /myproject/myproject-biz/src/main/java/com/example/service/demo/impl/StudentServiceImpl.java | 8733f78ae241eefaed8dd41e36ef816b5966f422 | [] | no_license | weichunya/springBoot_learn | d95a3701fde57d5cff428a91259e32da537c12e6 | 7d0243abed4992ff6aaf10adcd6defe172492e49 | refs/heads/master | 2021-09-04T11:14:49.400111 | 2018-01-18T06:18:01 | 2018-01-18T06:18:01 | 116,772,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 710 | java | package com.example.service.demo.impl;
import com.example.dao.demo.StudentDAO;
import com.example.entity.demo.StudentDTO;
import com.example.service.demo.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by 01444966 on 2017/12/28.
*/
@Service
public class StudentServiceImpl implements StudentService {
@Autowired
private StudentDAO studentDAO;
@Override
public List<StudentDTO> getAllStudentInfo() {
return studentDAO.getAllStudentInfo();
}
@Override
public StudentDTO getStudentById(Integer id) {
return studentDAO.getStudentById(id);
}
}
| [
"[email protected]"
] | |
62f2a937a170416c6895ff9e22526b2224d4a998 | 411b412b7360c59fb298c0babf86837ddbd1d57f | /src/view/DeliveryInfoView.java | 3fa964890b01c4330e2647fdccad2988bfcf3ffc | [] | no_license | AlejandroVal99/TeslaApp | dc9f8252f8fed672d9e476f1064ec37ce41d4aeb | a1e2fa506ee9668b43cdb93424c3bff56d037f2d | refs/heads/master | 2021-03-02T10:23:14.245725 | 2020-03-11T09:32:08 | 2020-03-11T09:32:08 | 245,860,217 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,599 | java |
package view;
import controlP5.ControlP5;
import controlP5.Textfield;
import controller.DeliveryInfoController;
import controller.RegisterController;
import processing.core.PApplet;
import processing.core.PFont;
import processing.core.PImage;
public class DeliveryInfoView {
private DeliveryInfoController deliveryController;
private String country, state, address;
private PApplet app;
private PImage deliveryInfo;
private int screen = 8;
private ControlP5 cp5;
private String[] inputs;
private PFont ralewayM;
public DeliveryInfoView(PApplet app) {
deliveryInfo = app.loadImage("Imagenes/Backgrounds/DeliveryInfo.png");
this.app = app;
deliveryController = new DeliveryInfoController(app);
ralewayM = app.createFont("Tipografia/Raleway-Medium.ttf", 20);
cp5 = new ControlP5(app);
inputs = new String[3];
inputs[0] = "country";
inputs[1] = "state";
inputs[2] = "address";
cp5.addTextfield(inputs[0]).setPosition((78), 358).setSize(250, 30).setAutoClear(true)
.setColorValue(app.color(255)).setColorActive(app.color(0, 0, 0, 1))
.setColorBackground(app.color(0, 0, 0, 1)).setColorForeground(app.color(0, 0, 0, 1)).setFont(ralewayM)
.getCaptionLabel().hide();
cp5.addTextfield(inputs[1]).setPosition((78), 431).setSize(250, 30).setAutoClear(true)
.setColorValue(app.color(255)).setColorActive(app.color(0, 0, 0, 1))
.setColorBackground(app.color(0, 0, 0, 1)).setColorForeground(app.color(0, 0, 0, 1)).setFont(ralewayM)
.getCaptionLabel().hide();
cp5.addTextfield(inputs[2]).setPosition((78), 503).setSize(250, 30).setAutoClear(true)
.setColorValue(app.color(255)).setColorActive(app.color(0, 0, 0, 1))
.setColorBackground(app.color(0, 0, 0, 1)).setColorForeground(app.color(0, 0, 0, 1)).setFont(ralewayM)
.getCaptionLabel().hide();
}
public void getinfoDelivery() {
if (app.mouseX > 61 && app.mouseX < 353 && app.mouseY > 797 && app.mouseY < 828) {
country = cp5.get(Textfield.class, "country").getText();
state = cp5.get(Textfield.class, "state").getText();
address = cp5.get(Textfield.class, "address").getText();
screen = 11;
deliveryController.getInfoDeliveryCon(country, state, address);
deliveryController.crearHistorico();
}
}
public int getScreen() {
return screen;
}
public void setScreen(int screen) {
this.screen = screen;
}
public void drawScreen() {
// TODO Auto-generated method stub
app.image(deliveryInfo, 0, 0);
}
public void mostrarInputs(int screen2) {
if (screen2 != 8) {
cp5.hide();
}
if (screen2 == 8) {
cp5.show();
}
}
}
| [
"[email protected]"
] | |
49e13eb37736519b10513a96da88c993b9bef41f | b534bd5ff47d73dae63c9ecbd4df6b68ac1f3279 | /src/main/java/com/java/project/checkin/controller/EmailConfigController.java | 97761949bc79564ab0857887042d49430f4499ff | [] | no_license | Armando-Perea/CheckInControl | e41bbe5ffa3b6126cb4129fc8a84b6defb6dbfb6 | c460ad0169f9ff8a1f8cbff550be5d92a77f97ee | refs/heads/master | 2023-04-09T17:52:02.948311 | 2021-04-07T01:21:27 | 2021-04-07T01:21:27 | 310,453,916 | 0 | 0 | null | 2021-04-07T01:21:30 | 2020-11-06T00:51:22 | Java | UTF-8 | Java | false | false | 2,333 | java | package com.java.project.checkin.controller;
import java.util.List;
import java.util.Optional;
import java.util.logging.Logger;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.java.project.checkin.models.EmailConfig;
import com.java.project.checkin.repo.impl.EmailConfigRepoImpl;
@RestController
@RequestMapping("checkincontrol/system/emailConfig")
public class EmailConfigController {
private static Logger log = Logger.getLogger(EmailConfigController.class.getName());
@Autowired
EmailConfigRepoImpl emailConfigRepoImpl;
@GetMapping("/getAllEmailConfig")
public List<EmailConfig> getAllEmailConfig(){
log.info("getAllClosure Controller");
return emailConfigRepoImpl.getAllEmailConfig();
}
@GetMapping("/getEmailConfigById/{id}")
public Optional<EmailConfig> getEmailConfigById(@PathVariable Integer id){
log.info("getEmailConfigById Controller");
return emailConfigRepoImpl.getEmailConfigById(id);
}
@PostMapping("/createEmailConfig")
public EmailConfig createEmailConfig(@RequestBody EmailConfig emailConfig){
log.info("createEmailConfig Controller");
return emailConfigRepoImpl.saveEmailConfig(emailConfig);
}
@PutMapping("/updateEmailConfig")
public EmailConfig updateEmailConfig(@RequestBody EmailConfig emailConfig){
log.info("updateEmailConfig Controller");
return emailConfigRepoImpl.updateEmailConfig(emailConfig);
}
@DeleteMapping("/deleteEmailConfig/{id}")
public void deleteEmailConfig(@PathVariable Integer id){
log.info("deleteEmailConfig Controller");
emailConfigRepoImpl.deleteEmailConfig(id);
}
@Transactional
@GetMapping("/truncateEmailConfig")
public String truncateEmailConfig(){
log.info("truncateEmailConfig Controller");
emailConfigRepoImpl.truncateEmailConfig();
return "Truncated";
}
}
| [
"[email protected]"
] | |
cff95f99ff508082a853d29361797a71a72a90c6 | cac46169e597d60e9b13e3adfc2d4f534c7da56c | /target/tomcat/work/Tomcat/localhost/retail/org/apache/jsp/WEB_002dINF/pages/productList_jsp.java | 0ec15f021cd946dce8870aafbfc59886413537dd | [] | no_license | arifdermawan/retail | b3e689943e693417a5164be9ea9c957ba0432bd8 | 92429110d43501f27138a6b06b1521b739e831ad | refs/heads/master | 2020-05-27T21:19:12.334512 | 2017-03-02T09:11:25 | 2017-03-02T09:11:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,527 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.47
* Generated at: 2017-03-01 12:58:46 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.WEB_002dINF.pages;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class productList_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ffmt_005fsetLocale_0026_005fvalue_005fscope_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005ffmt_005fformatNumber_0026_005fvalue_005ftype_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fsecurity_005fauthorize_0026_005faccess;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fif_0026_005ftest;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005ffmt_005fsetLocale_0026_005fvalue_005fscope_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005ffmt_005fformatNumber_0026_005fvalue_005ftype_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fsecurity_005fauthorize_0026_005faccess = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005ffmt_005fsetLocale_0026_005fvalue_005fscope_005fnobody.release();
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.release();
_005fjspx_005ftagPool_005ffmt_005fformatNumber_0026_005fvalue_005ftype_005fnobody.release();
_005fjspx_005ftagPool_005fsecurity_005fauthorize_0026_005faccess.release();
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write(" \r\n");
out.write("\r\n");
out.write(" \r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Product List</title>\r\n");
out.write(" \r\n");
out.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("/styles.css\">\r\n");
out.write(" \r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write(" \r\n");
out.write(" ");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "_header.jsp", out, false);
out.write("\r\n");
out.write(" ");
org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "_menu.jsp", out, false);
out.write("\r\n");
out.write(" \r\n");
out.write(" ");
if (_jspx_meth_fmt_005fsetLocale_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write(" \r\n");
out.write(" <div class=\"page-title\">Product List</div>\r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" ");
if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write(" <br/>\r\n");
out.write(" \r\n");
out.write(" \r\n");
out.write(" ");
if (_jspx_meth_c_005fif_005f0(_jspx_page_context))
return;
out.write("\r\n");
out.write(" \r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_fmt_005fsetLocale_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// fmt:setLocale
org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag _jspx_th_fmt_005fsetLocale_005f0 = (org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag) _005fjspx_005ftagPool_005ffmt_005fsetLocale_0026_005fvalue_005fscope_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag.class);
_jspx_th_fmt_005fsetLocale_005f0.setPageContext(_jspx_page_context);
_jspx_th_fmt_005fsetLocale_005f0.setParent(null);
// /WEB-INF/pages/productList.jsp(20,3) name = value type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_fmt_005fsetLocale_005f0.setValue("en_US");
// /WEB-INF/pages/productList.jsp(20,3) name = scope type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_fmt_005fsetLocale_005f0.setScope("session");
int _jspx_eval_fmt_005fsetLocale_005f0 = _jspx_th_fmt_005fsetLocale_005f0.doStartTag();
if (_jspx_th_fmt_005fsetLocale_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005ffmt_005fsetLocale_0026_005fvalue_005fscope_005fnobody.reuse(_jspx_th_fmt_005fsetLocale_005f0);
return true;
}
_005fjspx_005ftagPool_005ffmt_005fsetLocale_0026_005fvalue_005fscope_005fnobody.reuse(_jspx_th_fmt_005fsetLocale_005f0);
return false;
}
private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
_jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fforEach_005f0.setParent(null);
// /WEB-INF/pages/productList.jsp(26,3) name = items type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setItems(new org.apache.jasper.el.JspValueExpression("/WEB-INF/pages/productList.jsp(26,3) '${paginationProducts.list}'",_el_expressionfactory.createValueExpression(_jspx_page_context.getELContext(),"${paginationProducts.list}",java.lang.Object.class)).getValue(_jspx_page_context.getELContext()));
// /WEB-INF/pages/productList.jsp(26,3) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f0.setVar("prodInfo");
int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 };
try {
int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag();
if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" <div class=\"product-preview-container\">\r\n");
out.write(" <ul>\r\n");
out.write(" <li><img class=\"product-image\"\r\n");
out.write(" src=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("/productImage?code=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${prodInfo.code}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\" /></li>\r\n");
out.write(" <li>Code: ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${prodInfo.code}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</li>\r\n");
out.write(" <li>Name: ");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${prodInfo.name}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</li>\r\n");
out.write(" <li>Price: ");
if (_jspx_meth_fmt_005fformatNumber_005f0(_jspx_th_c_005fforEach_005f0, _jspx_page_context, _jspx_push_body_count_c_005fforEach_005f0))
return true;
out.write("</li>\r\n");
out.write(" <li><a\r\n");
out.write(" href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("/buyProduct?code=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${prodInfo.code}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\">\r\n");
out.write(" Buy Now</a></li>\r\n");
out.write(" <!-- For Manager edit Product -->\r\n");
out.write(" ");
if (_jspx_meth_security_005fauthorize_005f0(_jspx_th_c_005fforEach_005f0, _jspx_page_context, _jspx_push_body_count_c_005fforEach_005f0))
return true;
out.write("\r\n");
out.write(" </ul>\r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (java.lang.Throwable _jspx_exception) {
while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_c_005fforEach_005f0.doFinally();
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0);
}
return false;
}
private boolean _jspx_meth_fmt_005fformatNumber_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fforEach_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_c_005fforEach_005f0)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// fmt:formatNumber
org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag _jspx_th_fmt_005fformatNumber_005f0 = (org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag) _005fjspx_005ftagPool_005ffmt_005fformatNumber_0026_005fvalue_005ftype_005fnobody.get(org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag.class);
_jspx_th_fmt_005fformatNumber_005f0.setPageContext(_jspx_page_context);
_jspx_th_fmt_005fformatNumber_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fforEach_005f0);
// /WEB-INF/pages/productList.jsp(33,26) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_fmt_005fformatNumber_005f0.setValue((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${prodInfo.price}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
// /WEB-INF/pages/productList.jsp(33,26) name = type type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_fmt_005fformatNumber_005f0.setType("currency");
int _jspx_eval_fmt_005fformatNumber_005f0 = _jspx_th_fmt_005fformatNumber_005f0.doStartTag();
if (_jspx_th_fmt_005fformatNumber_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005ffmt_005fformatNumber_0026_005fvalue_005ftype_005fnobody.reuse(_jspx_th_fmt_005fformatNumber_005f0);
return true;
}
_005fjspx_005ftagPool_005ffmt_005fformatNumber_0026_005fvalue_005ftype_005fnobody.reuse(_jspx_th_fmt_005fformatNumber_005f0);
return false;
}
private boolean _jspx_meth_security_005fauthorize_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fforEach_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_c_005fforEach_005f0)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// security:authorize
org.springframework.security.taglibs.authz.JspAuthorizeTag _jspx_th_security_005fauthorize_005f0 = (org.springframework.security.taglibs.authz.JspAuthorizeTag) _005fjspx_005ftagPool_005fsecurity_005fauthorize_0026_005faccess.get(org.springframework.security.taglibs.authz.JspAuthorizeTag.class);
_jspx_th_security_005fauthorize_005f0.setPageContext(_jspx_page_context);
_jspx_th_security_005fauthorize_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fforEach_005f0);
// /WEB-INF/pages/productList.jsp(38,15) name = access type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_security_005fauthorize_005f0.setAccess("hasRole('ROLE_MANAGER')");
int _jspx_eval_security_005fauthorize_005f0 = _jspx_th_security_005fauthorize_005f0.doStartTag();
if (_jspx_eval_security_005fauthorize_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
out.write("\r\n");
out.write(" <li><a style=\"color:red;\"\r\n");
out.write(" href=\"");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${pageContext.request.contextPath}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("/product?code=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${prodInfo.code}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\">\r\n");
out.write(" Edit Product</a></li>\r\n");
out.write(" ");
}
if (_jspx_th_security_005fauthorize_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fsecurity_005fauthorize_0026_005faccess.reuse(_jspx_th_security_005fauthorize_005f0);
return true;
}
_005fjspx_005ftagPool_005fsecurity_005fauthorize_0026_005faccess.reuse(_jspx_th_security_005fauthorize_005f0);
return false;
}
private boolean _jspx_meth_c_005fif_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:if
org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
_jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context);
_jspx_th_c_005fif_005f0.setParent(null);
// /WEB-INF/pages/productList.jsp(50,3) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fif_005f0.setTest(((java.lang.Boolean) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${paginationProducts.totalPages > 1}", java.lang.Boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)).booleanValue());
int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag();
if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" <div class=\"page-navigator\">\r\n");
out.write(" ");
if (_jspx_meth_c_005fforEach_005f1(_jspx_th_c_005fif_005f0, _jspx_page_context))
return true;
out.write("\r\n");
out.write(" \r\n");
out.write(" </div>\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
return true;
}
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
return false;
}
private boolean _jspx_meth_c_005fforEach_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:forEach
org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f1 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class);
_jspx_th_c_005fforEach_005f1.setPageContext(_jspx_page_context);
_jspx_th_c_005fforEach_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f0);
// /WEB-INF/pages/productList.jsp(52,10) name = items type = javax.el.ValueExpression reqTime = true required = false fragment = false deferredValue = true expectedTypeName = java.lang.Object deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f1.setItems(new org.apache.jasper.el.JspValueExpression("/WEB-INF/pages/productList.jsp(52,10) '${paginationProducts.navigationPages}'",_el_expressionfactory.createValueExpression(_jspx_page_context.getELContext(),"${paginationProducts.navigationPages}",java.lang.Object.class)).getValue(_jspx_page_context.getELContext()));
// /WEB-INF/pages/productList.jsp(52,10) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fforEach_005f1.setVar("page");
int[] _jspx_push_body_count_c_005fforEach_005f1 = new int[] { 0 };
try {
int _jspx_eval_c_005fforEach_005f1 = _jspx_th_c_005fforEach_005f1.doStartTag();
if (_jspx_eval_c_005fforEach_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" ");
if (_jspx_meth_c_005fif_005f1(_jspx_th_c_005fforEach_005f1, _jspx_page_context, _jspx_push_body_count_c_005fforEach_005f1))
return true;
out.write("\r\n");
out.write(" ");
if (_jspx_meth_c_005fif_005f2(_jspx_th_c_005fforEach_005f1, _jspx_page_context, _jspx_push_body_count_c_005fforEach_005f1))
return true;
out.write("\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_c_005fforEach_005f1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fforEach_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (java.lang.Throwable _jspx_exception) {
while (_jspx_push_body_count_c_005fforEach_005f1[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_c_005fforEach_005f1.doCatch(_jspx_exception);
} finally {
_jspx_th_c_005fforEach_005f1.doFinally();
_005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f1);
}
return false;
}
private boolean _jspx_meth_c_005fif_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fforEach_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_c_005fforEach_005f1)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:if
org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f1 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
_jspx_th_c_005fif_005f1.setPageContext(_jspx_page_context);
_jspx_th_c_005fif_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fforEach_005f1);
// /WEB-INF/pages/productList.jsp(53,14) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fif_005f1.setTest(((java.lang.Boolean) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${page != -1 }", java.lang.Boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)).booleanValue());
int _jspx_eval_c_005fif_005f1 = _jspx_th_c_005fif_005f1.doStartTag();
if (_jspx_eval_c_005fif_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" <a href=\"productList?page=");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${page}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("\" class=\"nav-item\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${page}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
out.write("</a>\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_c_005fif_005f1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fif_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1);
return true;
}
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1);
return false;
}
private boolean _jspx_meth_c_005fif_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_c_005fforEach_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_c_005fforEach_005f1)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// c:if
org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f2 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
_jspx_th_c_005fif_005f2.setPageContext(_jspx_page_context);
_jspx_th_c_005fif_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fforEach_005f1);
// /WEB-INF/pages/productList.jsp(56,14) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_c_005fif_005f2.setTest(((java.lang.Boolean) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${page == -1 }", java.lang.Boolean.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false)).booleanValue());
int _jspx_eval_c_005fif_005f2 = _jspx_th_c_005fif_005f2.doStartTag();
if (_jspx_eval_c_005fif_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write(" <span class=\"nav-item\"> ... </span>\r\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_c_005fif_005f2.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_c_005fif_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f2);
return true;
}
_005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f2);
return false;
}
}
| [
"[email protected]"
] | |
707da917b16c14c5d516ace9425f39c089dbc387 | b55222a71d1275387d538fb9c0cf03116a611922 | /jOOQ/src/main/java/org/jooq/util/ase/ASEFactory.java | 139a74c696a9a2dd10797522674c8aca8b207da7 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | monolithic/jOOQ | e05625873b5a9d46010554064294d5aa199865b2 | 300c4b8693fdaa31adf15d6e9b7e153ef2c5ffeb | refs/heads/master | 2021-01-18T10:26:27.727927 | 2013-02-20T16:54:58 | 2013-02-20T16:54:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,870 | java | /**
* Copyright (c) 2009-2013, Lukas Eder, [email protected]
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name of the "jOOQ" nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.jooq.util.ase;
import org.jooq.SQLDialect;
import org.jooq.impl.Factory;
/**
* A {@link SQLDialect#ASE} specific factory
*
* @author Lukas Eder
*/
public class ASEFactory extends Factory {
/**
* No instances
*/
private ASEFactory() {
}
}
| [
"[email protected]"
] | |
401dea9658caef4a2570ecd26aabfef3b7cfee4b | 9c83397528e9e425670a4288f99a7e9c4746e23f | /src/main/java/pkg/FloatToIntBitsConverter.java | 2438a9dbc8e445e5ff1a90d142d350b18516e5e7 | [] | no_license | awizisieakat/float-to-int-test | babdc506ba2290a33284b0f8770e7aab3c03b661 | cf32da25131af5a304c7bdaa28d07c020ae9e2bb | refs/heads/master | 2021-01-19T23:42:35.149515 | 2017-04-21T18:43:01 | 2017-04-21T18:43:01 | 89,013,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | package pkg;
public interface FloatToIntBitsConverter {
int convert(float value);
}
| [
"[email protected]"
] | |
9c0200636b060825956137bc1709b55362b3c3d6 | e47930aae2a24e64f1a918d2b41d939e8e12c244 | /Primera Entrega/src/domini/Game.java | 4823fb742f98aa88f077d9ac2033ed5464305832 | [
"Apache-2.0"
] | permissive | trenete97/Mastermind-PROP | a36a3fab6de4f078ad4b25dff3dc953dc0738c0a | 55ab8b299cc734597bbeefe0a0781a77c2460b19 | refs/heads/master | 2021-03-19T17:29:19.205543 | 2018-01-25T16:37:09 | 2018-01-25T16:37:09 | 118,937,946 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,691 | java | package domini;
import domini.AI;
import domini.BallCombination;
public class Game {
private int height = 0;
private final int f;
private final int n;
private final int nColors;
private boolean finished;
private boolean victory;
private BallCombination[] board;
private PairInt[] matches;
private BallCombination answer;
private BallCombination solution;
private boolean humanPlaying;
private AI ai;
public Game(int n, int f, int nColors, boolean humanPlaying) {
this.n = n;
this.f = f;
this.nColors = nColors;
this.humanPlaying = humanPlaying;
ai = new AI(n,nColors);
initializeBoard();
initializeMatches();
solution = new BallCombination(n,nColors);
answer = new BallCombination(n,nColors);
}
public void setIASolution(){
solution = ai.getSolution();
}
public void setHumanComb(String comb){
this.solution.setCombination(comb);
}
public void insertComb(){
board[height] = solution;
height++;
}
public String AIPlay(){
answer = ai.play();
return answer.getCombValue();
}
public void humanPlay(String comb){
answer.setCombination(comb);
}
private void initializeBoard(){
board = new BallCombination[f];
for(int i = 0; i<f;i++){
board[i] = new BallCombination(n,nColors);
}
}
private void initializeMatches(){
matches = new PairInt[f];
for(int i = 0; i<f;i++){
matches[i] = new PairInt();
}
}
public void compareComb(){
int colorOk = 0;
int posOk = 0;
boolean found[] = new boolean[n];
for(int i = 0; i<n;i++){
if(solution.getBallColor(i) == answer.getBallColor(i)){
posOk++;
if(found[i] == true)colorOk--; //Ex 3231 // 4231 (el 3 el troba primer per color i despres per posicio)
found[i] = true;
}
else{
boolean trobat=false;
for (int j = 0;j<n;++j){
if(solution.getBallColor(i) == answer.getBallColor(j) && !found[j]){trobat = true; colorOk++; found[j] = true;}
if(trobat)break;
}
}
}
if(posOk == n){victory = true;finished = true;}
else if(height+1 == f)finished = true;
matches[height].b = colorOk;
matches[height].a = posOk;
ai.answer = matches[height];
System.out.println("Blanques: " + getPosAnswer(height) + " Negres:" + getColorAnswer(height));
}
private int getColorAnswer(int n){
return matches[n].b;
}
private int getPosAnswer(int n){
return matches[n].a;
}
public int getHeight(){
return height;
}
public boolean isFinished(){
return finished;
}
public boolean isVictorious(){
return victory;
}
} | [
"[email protected]"
] | |
555ac25829eaea0fde6ad7a4785735200073a369 | 5703a9261a544d72fa184bde35b600e5312e87ea | /src/main/java/com/bonuspoint/rest/service/TransferService.java | 6a60252b2661f53e9fb36ea58faac4f3a5688567 | [] | no_license | sankiGod/Biggbonuspoints | 08a59e01e3c74294ff25318a99e309e64ba1b30a | 5100d6f941e5d0d750640483dcbbb85e28cea78d | refs/heads/master | 2022-07-07T20:02:25.527039 | 2019-07-15T12:16:55 | 2019-07-15T12:16:55 | 196,989,902 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,251 | java | package com.bonuspoint.rest.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonuspoint.model.CustomerMerchantBPAccount;
import com.bonuspoint.repository.BonusPointMapRepository;
import com.bonuspoint.repository.CustomerMerchantBPAccountRepository;
import com.bonuspoint.repository.MerchantRepository;
import com.bonuspoint.repository.ProjectRepository;
@Service
public class TransferService {
@Autowired
CustomerMerchantBPAccountRepository repository;
@Autowired
BonusPointMapRepository brepository;
@Autowired
MerchantRepository merchantRepository;
@Autowired
ProjectRepository projectRepository;
public List<CustomerMerchantBPAccount> transferCustom(String customerID, String fromMerchantID, String toMerchantID,
int bonusPoint) {
// TODO Auto-generated method stub
return null;
/*
* Merchant merchant = merchantRepository.findByMerchantID(fromMerchantID);
* String projectID = merchant.getProjectID(); Project project =
* projectRepository.findByProjectID(projectID);
*
* if (!project.getProjectType().equalsIgnoreCase("MULTIPLE")) { throw new
* CustomErrorException("Merchant",
* ErrorCodes.CANNOT_TRANSFER_FUNDS.getDescription(),
* ErrorCodes.CANNOT_TRANSFER_FUNDS.getCode()); }
*
* if (repository.findByCustomerIDAndMerchantProjectID(customerID,
* fromMerchantID) == null) { throw new
* ResourceNotFoundException("CustomerMerchantBPAccount",
* "customerID and fromMerchantID", customerID + fromMerchantID); } else if
* (repository.findByCustomerIDAndMerchantProjectID(customerID, toMerchantID) ==
* null) {
*
* fromMerchant { BP = 50; BA = 150; APBP = 3; } toMerchant{ BP = 0; BA = 0;
* APBP = 7; } Transferring 20 points fromMer to toMer.
*
* CustomerMerchantBPAccount acc1 =
* repository.findByCustomerIDAndMerchantProjectID(customerID, fromMerchantID);
* CustomerMerchantBPAccount acc2 = new CustomerMerchantBPAccount();
* acc2.setCustomerID(customerID); acc2.setMerchantProjectID(toMerchantID);
* acc2.set BonusPointMap toMerchant =
* brepository.findByMerchantID(toMerchantID); BonusPointMap fromMerchant =
* brepository.findByMerchantID(fromMerchantID);
*
* BigDecimal bonusAmount = fromMerchant.getAmountPerBP().multiply(new
* BigDecimal(bonusPoint));
*
*
* bonusAmount = 20 * 3= 60;
*
*
* int fromBonusPoints = acc1.getBonusPoints();// 50 BigDecimal fromBonusAmount
* = acc1.getBonusPointAmount();// 150
*
* if (bonusAmount.compareTo(fromBonusAmount) > 0) { throw new
* CustomErrorException("CustomerMerchantBPAccount",
* ErrorCodes.INSUFFICIENT_FUNDS.getDescription(),
* ErrorCodes.INSUFFICIENT_FUNDS.getCode()); } double tempUBP =
* bonusAmount.divide(toMerchant.getAmountPerBP()).doubleValue(); int
* updatedToBonusPoint = (int) (Math.round(tempUBP)); BigDecimal
* updatedToBonusAmount = toMerchant.getAmountPerBP().multiply(new
* BigDecimal(updatedToBonusPoint));
*
* updatedToBP = (int) 60/7 = 8.5 = 8; updatedToBA = 8 * 7 = 56 ;
*
*
* int updatedFromBonusPoints = fromBonusPoints - bonusPoint; BigDecimal
* updatedFromBonusAmount = fromBonusAmount.subtract(bonusAmount);
*
* updatedFromBP = 50 - 20 = 30; updatedFromBA = 150 - 56 = 94;
*
*
* acc1.setBonusPoints(updatedFromBonusPoints);
* acc1.setBonusPointAmount(updatedFromBonusAmount);
*
* acc2.setBonusPoints(updatedToBonusPoint);
* acc2.setBonusPointAmount(updatedToBonusAmount);
*
* repository.save(acc1); repository.save(acc2);
*
* } else { CustomerMerchantBPAccount acc1 =
* repository.findByCustomerIDAndMerchantProjectID(customerID, fromMerchantID);
* CustomerMerchantBPAccount acc2 =
* repository.findByCustomerIDAndMerchantProjectID(customerID, toMerchantID);
*
* BonusPointMap toMerchant = brepository.findByMerchantID(toMerchantID);
* BonusPointMap fromMerchant = brepository.findByMerchantID(fromMerchantID);
*
* BigDecimal bonusAmount = fromMerchant.getAmountPerBP().multiply(new
* BigDecimal(bonusPoint));
*
* int fromBonusPoints = acc1.getBonusPoints(); BigDecimal fromBonusAmount =
* acc1.getBonusPointAmount();
*
* int toBonusPoints = acc2.getBonusPoints(); BigDecimal toBonusAmount =
* acc2.getBonusPointAmount();
*
* if (bonusAmount.compareTo(fromBonusAmount) > 0) { throw new
* CustomErrorException("CustomerMerchantBPAccount",
* ErrorCodes.INSUFFICIENT_FUNDS.getDescription(),
* ErrorCodes.INSUFFICIENT_FUNDS.getCode()); } double tempNBP =
* bonusAmount.divide((toMerchant.getAmountPerBP())).doubleValue(); int
* newBonusPoint = (int) Math.round(tempNBP); int updatedToBonusPoint =
* toBonusPoints + newBonusPoint;
*
* BigDecimal newBonusAmount = toMerchant.getAmountPerBP().multiply(new
* BigDecimal(newBonusPoint)); BigDecimal updatedToBonusAmount =
* toBonusAmount.add(newBonusAmount);
*
* int updatedFromBonusPoints = fromBonusPoints - bonusPoint; BigDecimal
* updatedFromBonusAmount = fromBonusAmount.subtract(newBonusAmount);
*
* acc1.setBonusPoints(updatedFromBonusPoints);
* acc1.setBonusPointAmount(updatedFromBonusAmount);
*
* acc2.setBonusPoints(updatedToBonusPoint);
* acc2.setBonusPointAmount(updatedToBonusAmount);
*
* repository.save(acc1); repository.save(acc2);
*
* } return repository.findByCustomerID(customerID);
*/
}
public List<CustomerMerchantBPAccount> transferAll(String customerID, String fromMerchantID, String toMerchantID) {
// TODO Auto-generated method stub
return null;
/*
* Merchant merchant = merchantRepository.findByMerchantID(fromMerchantID);
* String projectID = merchant.getProjectID(); Project project =
* projectRepository.findByProjectID(projectID);
*
* if (!project.getProjectType().equalsIgnoreCase("MULTIPLE")) { throw new
* CustomErrorException("Merchant",
* ErrorCodes.CANNOT_TRANSFER_FUNDS.getDescription(),
* ErrorCodes.CANNOT_TRANSFER_FUNDS.getCode()); }
*
* if (repository.findByCustomerIDAndMerchantProjectID(customerID,
* fromMerchantID) == null) { throw new
* ResourceNotFoundException("CustomerMerchantBPAccount",
* "customerID and fromMerchantID", customerID + fromMerchantID); } else if
* (repository.findByCustomerIDAndMerchantProjectID(customerID, toMerchantID) ==
* null) { CustomerMerchantBPAccount acc1 =
* repository.findByCustomerIDAndMerchantProjectID(customerID, fromMerchantID);
* CustomerMerchantBPAccount acc2 = new CustomerMerchantBPAccount();
*
* int fromBonusPoints = acc1.getBonusPoints(); BigDecimal fromBonusAmount =
* acc1.getBonusPointAmount();
*
* if (fromBonusAmount.equals(new BigDecimal(0)) || fromBonusPoints == 0) {
* throw new CustomErrorException("CustomerMerchantBPAccount",
* ErrorCodes.INSUFFICIENT_FUNDS.getDescription(),
* ErrorCodes.INSUFFICIENT_FUNDS.getCode()); }
*
* BonusPointMap toMerchant = brepository.findByMerchantID(toMerchantID);
*
* int updatedFromBonusPoint = fromBonusPoints - fromBonusPoints; BigDecimal
* updatedFromBonusAmount = fromBonusAmount.subtract(fromBonusAmount);
*
* double tempTBP =
* fromBonusAmount.divide(toMerchant.getAmountPerBP()).doubleValue(); int
* toBonusPoint = (int) (Math.round(tempTBP)); BigDecimal toBonusAmount =
* fromBonusAmount;
*
* acc1.setBonusPoints(updatedFromBonusPoint);
* acc1.setBonusPointAmount(updatedFromBonusAmount);
*
* acc2.setBonusPoints(toBonusPoint); acc2.setBonusPointAmount(toBonusAmount);
*
* repository.save(acc1); repository.save(acc2);
*
* } else { CustomerMerchantBPAccount acc1 =
* repository.findByCustomerIDAndMerchantProjectID(customerID, fromMerchantID);
* CustomerMerchantBPAccount acc2 =
* repository.findByCustomerIDAndMerchantProjectID(customerID, toMerchantID);
*
* int fromBonusPoints = acc1.getBonusPoints(); int toBonusPoints =
* acc2.getBonusPoints();
*
* BigDecimal fromBonusAmount = acc1.getBonusPointAmount(); BigDecimal
* toBonusAmount = acc2.getBonusPointAmount();
*
* if (fromBonusAmount.equals(new BigDecimal(0)) || fromBonusPoints == 0) {
* throw new CustomErrorException("CustomerMerchantBPAccount",
* ErrorCodes.INSUFFICIENT_FUNDS.getDescription(),
* ErrorCodes.INSUFFICIENT_FUNDS.getCode()); }
*
* BonusPointMap toMerchant = brepository.findByMerchantID(toMerchantID);
*
* int updatedFromBonusPoint = fromBonusPoints - fromBonusPoints; BigDecimal
* updatedFromBonusAmount = fromBonusAmount.subtract(fromBonusAmount);
*
* double tempUBP =
* fromBonusAmount.divide(toMerchant.getAmountPerBP()).doubleValue(); int
* updatedToBonusPoint = (int) (toBonusPoints + Math.round(tempUBP)); BigDecimal
* updatedToBonusAmount = toBonusAmount.add(fromBonusAmount);
*
* acc1.setBonusPoints(updatedFromBonusPoint);
* acc1.setBonusPointAmount(updatedFromBonusAmount);
*
* acc2.setBonusPoints(updatedToBonusPoint);
* acc2.setBonusPointAmount(updatedToBonusAmount);
*
* repository.save(acc1); repository.save(acc2);
*
* } return repository.findByCustomerID(customerID);
*/
}
/*
* Merchant fromMerchant = merchantRepository.findByMerchantID(fromMerchantID);
Merchant toMerchant = merchantRepository.findByMerchantID(toMerchantID);
String fromProjectID = fromMerchant.getProjectID();
String toProjectID = toMerchant.getProjectID();
if(!fromProjectID.equals(toProjectID)) {
throw new CustomErrorException("Points Transfer", "Cannot Transfer Funds To Merchant Of Different Project", ErrorCodes.NOT_ALLOWED.getCode());
}
Project project = projectRepository.findByProjectID(toProjectID);
if (!project.getProjectType().equalsIgnoreCase("MULTIPLE")) {
throw new CustomErrorException("Merchant", "Funds Transfer Facility Not Applicable",ErrorCodes.NOT_ALLOWED.getCode());
}
*
*
*
*
* public TransferValues getTransferValues(String customerID, String
* fromMerchantID, String toMerchantID, int toBonusPoint) {
*
* Merchant merchant = merchantRepository.findByMerchantID(fromMerchantID);
* String projectID = merchant.getProjectID(); Project project =
* projectRepository.findByProjectID(projectID);
*
* if (!project.getProjectType().equalsIgnoreCase("MULTIPLE")) { throw new
* CustomErrorException("Merchant", "Funds Transfer Facility Not Applicable",
* 108); }
*
* if (repository.findByCustomerIDAndMerchantProjectID(customerID,
* fromMerchantID) == null) { throw new
* ResourceNotFoundException("CustomerMerchantBPAccount",
* "customerID and fromMerchantID", customerID + fromMerchantID); } else {
*
* }
*
* BonusPointMap toMerchant = brepository.findByMerchantID(toMerchantID);
* BonusPointMap fromMerchant = brepository.findByMerchantID(fromMerchantID);
*
* BigDecimal bonusAmount = toBonusPoint * fromMerchant.getAmountPerBP();
*
* int newToBonusPoint = (int) (Math.round((bonusAmount) /
* (toMerchant.getAmountPerBP()))); BigDecimal newToBonusAmount =
* newToBonusPoint * toMerchant.getAmountPerBP();
*
*
*
* }
*/
}
| [
"[email protected]"
] | |
8b2b94798b88e6ead11e730e6a7346a9eef5afeb | bfb1247eae836d88d1abd8b032eb53fcacded3c5 | /server/src/main/java/io/github/hulang1024/chinesechess/user/activity/UserActivityMessageListener.java | e531d28965d3f11a45360fa4029de5f6ddc9c268 | [] | no_license | xiangping10/chinese-chess | 1cb66835b2c80c864c8a9fedadf784f8f74f35fa | ae6687919ff231ae2ce01709f9757d35c0a4491f | refs/heads/master | 2023-02-14T14:07:35.229609 | 2020-12-31T16:35:13 | 2020-12-31T16:35:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,550 | java | package io.github.hulang1024.chinesechess.user.activity;
import io.github.hulang1024.chinesechess.user.UserSessionManager;
import io.github.hulang1024.chinesechess.user.ws.OnlineStatServerMsg;
import io.github.hulang1024.chinesechess.user.ws.UserEnterActivityMsg;
import io.github.hulang1024.chinesechess.user.ws.UserExitActivityMsg;
import io.github.hulang1024.chinesechess.ws.AbstractMessageListener;
import io.github.hulang1024.chinesechess.ws.WSMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UserActivityMessageListener extends AbstractMessageListener {
@Autowired
private UserActivityService userActivityService;
@Autowired
private WSMessageService wsMessageService;
@Override
public void init() {
addMessageHandler(UserEnterActivityMsg.class, (msg) -> {
UserActivity userActivity = UserActivity.from(msg.getCode());
userActivityService.enter(msg.getUser(), userActivity);
if (userActivity == UserActivity.VIEW_ONLINE_USER) {
wsMessageService.send(
new OnlineStatServerMsg(
UserSessionManager.onlineUserCount,
UserSessionManager.guestCount),
msg.getUser());
}
});
addMessageHandler(UserExitActivityMsg.class, (msg) -> {
userActivityService.exit(msg.getUser(), UserActivity.from(msg.getCode()));
});
}
}
| [
"[email protected]"
] | |
a9b2def97b51977682bf78e604febd5b8dca0369 | a744882fb7cf18944bd6719408e5a9f2f0d6c0dd | /sourcecode7/src/sun/net/dns/ResolverConfiguration.java | a490de4ea293ad914314dbaa99a27719efb277fc | [
"Apache-2.0"
] | permissive | hanekawasann/learn | a39b8d17fd50fa8438baaa5b41fdbe8bd299ab33 | eef678f1b8e14b7aab966e79a8b5a777cfc7ab14 | refs/heads/master | 2022-09-13T02:18:07.127489 | 2020-04-26T07:58:35 | 2020-04-26T07:58:35 | 176,686,231 | 0 | 0 | Apache-2.0 | 2022-09-01T23:21:38 | 2019-03-20T08:16:05 | Java | UTF-8 | Java | false | false | 3,964 | java | /*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.net.dns;
import java.util.List;
/**
* The configuration of the client resolver.
*
* <p>A ResolverConfiguration is a singleton that represents the
* configuration of the client resolver. The ResolverConfiguration
* is opened by invoking the {@link #open() open} method.
*
* @since 1.4
*/
public abstract class ResolverConfiguration {
private static final Object lock = new Object();
private static ResolverConfiguration provider;
protected ResolverConfiguration() { }
/**
* Opens the resolver configuration.
*
* @return the resolver configuration
*/
public static ResolverConfiguration open() {
synchronized (lock) {
if (provider == null) {
provider = new sun.net.dns.ResolverConfigurationImpl();
}
return provider;
}
}
/**
* Returns a list corresponding to the domain search path. The
* list is ordered by the search order used for host name lookup.
* Each element in the list returns a {@link java.lang.String}
* containing a domain name or suffix.
*
* @return list of domain names
*/
public abstract List<String> searchlist();
/**
* Returns a list of name servers used for host name lookup.
* Each element in the list returns a {@link java.lang.String}
* containing the textual representation of the IP address of
* the name server.
*
* @return list of the name servers
*/
public abstract List<String> nameservers();
/**
* Options representing certain resolver variables of
* a {@link ResolverConfiguration}.
*/
public static abstract class Options {
/**
* Returns the maximum number of attempts the resolver
* will connect to each name server before giving up
* and returning an error.
*
* @return the resolver attempts value or -1 is unknown
*/
public int attempts() {
return -1;
}
/**
* Returns the basic retransmit timeout, in milliseconds,
* used by the resolver. The resolver will typically use
* an exponential backoff algorithm where the timeout is
* doubled for every retransmit attempt. The basic
* retransmit timeout, returned here, is the initial
* timeout for the exponential backoff algorithm.
*
* @return the basic retransmit timeout value or -1
* if unknown
*/
public int retrans() {
return -1;
}
}
/**
* Returns the {@link #Options} for the resolver.
*
* @return options for the resolver
*/
public abstract Options options();
}
| [
"[email protected]"
] | |
b9deda56f86a2bfa5fc34772db07643c925ec585 | e4881a2bf83dabeda807ed306428dea48a53b5d2 | /src/primitiveWorld/interfaces/Enginable.java | f301079aaf2b4cf5649769ec3252d544daae3d20 | [] | no_license | SofiaShybaieva/PrimitiveWorld | afbb47319ffe34eaeb5e2510c65536fd5505a225 | 0a84223572677b90d014e0f521e2f28985284738 | refs/heads/master | 2020-05-24T15:02:42.727260 | 2014-12-09T20:23:45 | 2014-12-09T20:23:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package primitiveWorld.interfaces;
import java.awt.Point;
import java.io.File;
import javax.swing.JPanel;
public interface Enginable {
void setPanel(JPanel panel);
void loadLocation(File file);
String nextStep();
void redraw();
void mousePress(Point coord);
void mouseMove(Point coord);
}
| [
"slavick@thinkpad.(none)"
] | slavick@thinkpad.(none) |
513a3a523a05472148ee1f9f1f5d5e408e9f7817 | 5d7eceb50fcc79fa09ca9f34d665ec8223cbbc09 | /JxSmartHome/src/com/jinxin/datan/net/protocol/DefaultResponseJosn.java | 30fa93552f16939ba3eb6556d58c3dfcbbedf66b | [] | no_license | WonderFannn/WFJxSmartHome | 253abbae09bf84d63db55ba7f6b0df41ea806286 | 7d1168741b626da9e9ca128694d622f86e725a99 | refs/heads/master | 2021-01-01T18:40:37.713436 | 2018-02-02T02:33:55 | 2018-02-02T02:33:55 | 98,402,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,227 | java | package com.jinxin.datan.net.protocol;
import java.io.InputStream;
import org.json.JSONException;
import org.json.JSONObject;
import com.jinxin.datan.net.module.RemoteJsonResultInfo;
import com.jinxin.datan.net.protocol.ResponseJson;
import com.jinxin.datan.toolkit.task.Task;
import com.jinxin.jxsmarthome.constant.ControlDefine;
import com.jinxin.jxsmarthome.util.CommUtil;
import com.jinxin.record.SharedDB;
public class DefaultResponseJosn extends ResponseJson {
private Task task = null;
private byte[] requestBytes;
public DefaultResponseJosn(Task task, byte[] requestBytes) {
this.task = task;
this.requestBytes = requestBytes;
}
@Override
public void response(InputStream in) throws Exception {
if (in != null) {
boolean isSuccess = false;
RemoteJsonResultInfo _resultInfo = null;
String result = "";
try {
JSONObject jsonObject = this.getJsonObjectFromIn(in);
_resultInfo = this.readResultInfo(jsonObject);
if (_resultInfo.validResultCode.equals(ControlDefine.CONNECTION_SUCCESS)) {
// 具体的解析工作在这里实现
// 提示:任务中途检测任务是否被中止,同时可以直接返回任务取消数据(如有必要)
if (this.task.ismTryCancel()) {
return;
}
//////////////////////具体解析区////////////////////////
result = jsonObject.getString("serviceContent");
String _processTime = this.getJsonString(jsonObject,
"processTime");
String _account = CommUtil.getCurrentLoginAccount();
//////////////////////具体解析完成////////////////////////
isSuccess = true;
SharedDB.saveStrDB(_account,
ControlDefine.KEY_CUSTOMER_AREA, _processTime);
}
} catch (JSONException e) {
e.printStackTrace();
isSuccess = false;
} catch (Exception e) {
e.printStackTrace();
isSuccess = false;
} finally {
if (isSuccess) {
this.task.callback(result);
} else {
this.task.onError(_resultInfo.validResultInfo);
}
this.closeInputStream(in);
}
}
}
@Override
public byte[] toOutputBytes() {
return this.requestBytes;
}
}
| [
"[email protected]"
] | |
f2682a30d8a7b0e111d0566bfcda29c30bd720bf | e56f9768a96892f70eeb02ef41af587fc81316b9 | /src/main/java/au/net/electronichealth/ns/cdapackage/xsd/esignature/_2012/ApproverType.java | 11e34af9fa576ee35041754a798487c8fd424382 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | AuDigitalHealth/esignature-java | bfae3c8fc2030e8be24d2aaaaa143b012d7dfe01 | 282e27ccc67590fa693df4f8c1685d8daa2417c5 | refs/heads/master | 2023-03-01T04:07:26.333609 | 2021-02-10T03:16:49 | 2021-02-10T03:16:49 | 337,603,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,601 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.02.28 at 12:13:11 PM EST
//
package au.net.electronichealth.ns.cdapackage.xsd.esignature._2012;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ApproverType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ApproverType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="personId" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
* <element name="personName" type="{http://ns.electronichealth.net.au/cdaPackage/xsd/eSignature/2012}PersonNameType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ApproverType", propOrder = {
"personId",
"personName"
})
public class ApproverType {
@XmlElement(required = true)
@XmlSchemaType(name = "anyURI")
protected String personId;
@XmlElement(required = true)
protected PersonNameType personName;
/**
* Gets the value of the personId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPersonId() {
return personId;
}
/**
* Sets the value of the personId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPersonId(String value) {
this.personId = value;
}
/**
* Gets the value of the personName property.
*
* @return
* possible object is
* {@link PersonNameType }
*
*/
public PersonNameType getPersonName() {
return personName;
}
/**
* Sets the value of the personName property.
*
* @param value
* allowed object is
* {@link PersonNameType }
*
*/
public void setPersonName(PersonNameType value) {
this.personName = value;
}
}
| [
"[email protected]"
] | |
79df389ec6f6d49e9b6a8c5c9f99231448537335 | 3e17ae6a61e5e2d12847331907df6cdd05f84dfc | /guiClient/BackgammonGUI/src/cs347/backgammon/core/game/board/CellOwner.java | 3098f6a2631de894f1e35082192dea4c945c97a3 | [] | no_license | cansukockopru/cs347backgammon | c3f26eb123a0af156644c34073985a7182b658ac | 8f7011e7c89d3bc4274124083b36c8d561d45c2f | refs/heads/master | 2016-09-06T11:29:44.371468 | 2010-04-08T17:57:57 | 2010-04-08T17:57:57 | 39,853,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package cs347.backgammon.core.game.board;
/**
* Enumeration describing which player, if any, has checkers on a board cell.
*/
public enum CellOwner
{
/**
* The board cell is controlled by player 1.
*/
Player1,
/**
* The board cell is controlled by player 2.
*/
Player2,
/**
* The board cell is empty.
*/
Empty;
}
| [
"tullock42@b64e8d1a-19a9-11df-a214-3711e6809fde"
] | tullock42@b64e8d1a-19a9-11df-a214-3711e6809fde |
00c80d983a49fc7c8e8c3c264b5ca98e888666f3 | 66fef10c7222f92a0e1adf1d04f4047b21d75368 | /module-1/12_Polymorphism/student-lecture/java/src/main/java/com/techelevator/farm/Sellable.java | eace4060c1a91fb675a6147f1d8959c4a5c3718d | [] | no_license | Lawrence-Amurao/Exercises | 312e965068c04504a009e1d32f00266bccc76972 | 8bb9bb85756abc38295d7a532eae5f0e54e1aa3f | refs/heads/main | 2023-08-13T16:04:13.790928 | 2021-09-15T20:29:54 | 2021-09-15T20:29:54 | 406,964,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 120 | java | package com.techelevator.farm;
import java.math.BigDecimal;
public interface Sellable {
BigDecimal getPrice();
}
| [
"[email protected]"
] | |
ff4ca463760acf36613cf6fa1cab9fed4b4bc123 | c86c63e04aaa37b9a9f9f68fdf1dbbd74baa98d4 | /profilers/testSrc/com/android/tools/profilers/memory/adapters/instancefilters/ProjectClassesInstanceFilterTest.java | 08072b54a1355fbf18c8ba3af3d8735f912a4a0e | [
"Apache-2.0"
] | permissive | yang0range/android-1 | 8ea4bd40c0f2fb0f270309818267a5a3cd3b9b42 | 3b1eec683e9bc318d734c60f085f00e6d19343e7 | refs/heads/master | 2023-01-19T09:54:52.233899 | 2020-11-18T10:44:07 | 2020-11-18T19:35:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,648 | java | /*
* Copyright (C) 2019 The Android Open Source Project
*
* 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.android.tools.profilers.memory.adapters.instancefilters;
import static com.google.common.truth.Truth.assertThat;
import com.android.tools.profilers.FakeIdeProfilerServices;
import com.android.tools.profilers.memory.adapters.FakeCaptureObject;
import com.android.tools.profilers.memory.adapters.FakeInstanceObject;
import com.android.tools.profilers.memory.adapters.InstanceObject;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
import org.junit.Test;
public class ProjectClassesInstanceFilterTest {
@Test
public void testFilter() {
FakeIdeProfilerServices ideServices = new FakeIdeProfilerServices();
ideServices.addProjectClasses("my.foo.bar", "your.bar.foo");
String matchedClass = "my.foo.bar";
String matchedInnerClass = "your.bar.foo$1";
String mismatchedClass = "my.bar";
String mismatchedInnerClass = "your.foo$1";
FakeCaptureObject capture = new FakeCaptureObject.Builder().build();
FakeInstanceObject matchedClassInstance = new FakeInstanceObject.Builder(capture, 1, matchedClass).build();
FakeInstanceObject matchedInnerClassInstance = new FakeInstanceObject.Builder(capture, 2, matchedInnerClass).build();
FakeInstanceObject mismatchedClassInstance = new FakeInstanceObject.Builder(capture, 3, mismatchedClass).build();
FakeInstanceObject mismatchedInnerClassInstance = new FakeInstanceObject.Builder(capture, 4, mismatchedInnerClass).build();
Set<InstanceObject> instances = ImmutableSet.of(matchedClassInstance,
matchedInnerClassInstance,
mismatchedClassInstance,
mismatchedInnerClassInstance);
ProjectClassesInstanceFilter filter = new ProjectClassesInstanceFilter(ideServices);
Set<InstanceObject> result = filter.filter(instances, capture.getClassDatabase());
assertThat(result).containsExactly(matchedClassInstance, matchedInnerClassInstance);
}
}
| [
"[email protected]"
] | |
bb3e7263a85cab4e8cb8aab3d62f482114489088 | 6c263be39d0228b887e87efa14a1cbeecefedbfb | /ly-item/ly-item-interface/src/main/java/com/leyou/item/pojo/Stock.java | 456c197f6a2c21607ecc5a4277869f1cb3986abe | [] | no_license | Sherwoodzhou/leyou_java | 33de94ba3577f3a9a989e5e9f7e6505883cf87d1 | 289371a6bb3e7d54a6c870ed58aaa64da260f1ef | refs/heads/master | 2020-05-25T01:54:54.492642 | 2019-05-20T04:25:23 | 2019-05-20T04:25:23 | 187,567,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 85 | java | package com.leyou.item.pojo;
import lombok.Data;
@Data
public class Stock {
}
| [
"[email protected]"
] | |
3fddec79f4f31c3e887d933f5469296927010dca | 8c9a3c6551699e5fc6329f27f0334c3f26fe39cc | /Curso/src/entidades/Trabalhador.java | 8962176370ae8f1871a5323f7af9293f2d37199b | [] | no_license | Artur-Pastana/Teste2.github | d00dcb64ac5cd779e95a4e3cedc452798e1a3668 | e929ee184f58792bba5f61426653658bd12d4295 | refs/heads/master | 2023-01-02T18:33:12.888594 | 2020-10-20T20:42:32 | 2020-10-20T20:42:32 | 305,740,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,970 | java | package entidades;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import entidades.enums.NivelTrabalhador;
public class Trabalhador {
private String nome;
private NivelTrabalhador nivel;
private Double baseSalario;
private Departamento departamento;
private List<ContratoHora> contratos = new ArrayList<>();
public Trabalhador() {
// TODO Auto-generated constructor stub
}
public Trabalhador(String nome, NivelTrabalhador nivel, Double baseSalario, Departamento departamento) {
super();
this.nome = nome;
this.nivel = nivel;
this.baseSalario = baseSalario;
this.departamento = departamento;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public NivelTrabalhador getNivel() {
return nivel;
}
public void setNivel(NivelTrabalhador nivel) {
this.nivel = nivel;
}
public Double getBaseSalario() {
return baseSalario;
}
public void setBaseSalario(Double baseSalario) {
this.baseSalario = baseSalario;
}
public Departamento getDepartamento() {
return departamento;
}
public void setDepartamento(Departamento departamento) {
this.departamento = departamento;
}
public List<ContratoHora> getContratos() {
return contratos;
}
public void addContrato(ContratoHora contrato) {
this.contratos.add(contrato);
}
public void removerContratos(ContratoHora contrato) {
this.contratos.remove(contrato);
}
public double income(int ano, int mes) {
double soma = this.getBaseSalario();
Calendar cal = Calendar.getInstance();
for (ContratoHora c : contratos) {
cal.setTime(c.getDate());
int cAno = cal.get(Calendar.YEAR);//pegando o ano e armazenando na variavel cAno, usando Calendar
int cMes = 1 + cal.get(Calendar.MONTH);//pegando o mes e armazenando na variavel cmes
//verificando ano e mes
if (ano == cAno && mes == cMes) {
soma += c.totalValor();
}
}
return soma;
}
}
| [
"[email protected]"
] | |
65e3b35af6553ebb93ff68baea639f212b240c71 | bda1eaa3bf6f1116056bd9ddda70726569f9e904 | /axboot-admin/src/main/java/net/bigers/funeralsystem/crem0000/crem5000/CREM5010Controller.java | c729b494b5593817b77c7715a6b64c5590fa090d | [] | no_license | KwakKyoungUk/BigersChangone | 347b0cb260eb5cab4b4878b3cf772860000f85a5 | 317df5e1306ed659a0f18adc177aa0228048aa29 | refs/heads/main | 2023-07-17T06:56:50.321954 | 2021-09-09T02:55:37 | 2021-09-09T02:55:37 | 404,554,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,491 | java | package net.bigers.funeralsystem.crem0000.crem5000;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.axisj.axboot.admin.controllers.BaseController;
import com.axisj.axboot.admin.parameter.CommonListResponseParams;
import com.axisj.axboot.core.util.DateUtils;
import net.bigers.funeralsystem.crem0000.DisplayConstants;
import net.bigers.funeralsystem.crem0000.domain.hwaBrazier.HwaBrazier;
import net.bigers.funeralsystem.crem0000.domain.hwaBrazier.HwaBrazierService;
import net.bigers.funeralsystem.crem0000.domain.machine.Machine;
import net.bigers.funeralsystem.crem0000.domain.machine.MachineService;
import net.bigers.funeralsystem.crem0000.domain.msgset.Msgset;
import net.bigers.funeralsystem.crem0000.domain.msgset.MsgsetService;
import net.bigers.funeralsystem.crem0000.vto.HwaBrazierVTO;
import net.bigers.funeralsystem.crem0000.vto.MsgsetVTO;
import net.bigers.websocket.SessionManager;
/**
*
* 업무분류 : 전체 현황판
* 기능분류 : 현황판 출력을 위한 컨트롤러
* 프로그램명 : BORD1010
* 설 명 : 전체 현황판을 출력하기 위한 뷰 연결 및 데이를 얻기 위한 서비스 연결
* 강릉 eXria로 제작된 프로그램을 axboot로 변경
* ------------------------------------------
*
* 이력사항 2016. 2. 29. 이승호 최초작성 <BR/>
*/
@Controller
@SessionAttributes("displayPagable")
public class CREM5010Controller extends BaseController{
@Autowired
private HwaBrazierService hwaBrazierService;
@Autowired
private MsgsetService msgsetService;
@Autowired
private MachineService machineService;
@Autowired
@Qualifier("textSessionManager")
private SessionManager sessionManager;
private Pageable pageRequest = new PageRequest(0, 5);
/**
*
*
* 메소드 명칭 : bord1010
* 메소드 설명 : WebSocket 으로 접속한 현황판 기기로 데이터 전송
* ----------------------------------------------------------
*
*
* 이력사항
* 2016. 5. 18. SH 최초작성
*/
// @Scheduled(fixedDelay=DisplayConfigConstants.WEBSOCKET_SCHEDULE_FIXED_DELAY)
public void bord1010(){
if(sessionManager.isEmpty()){
log.trace("접속한 웹소켓 클라이언트가 없습니다.");
return;
}
List<Machine> machines = machineService.findByMclass(DisplayConstants.MACHINE_KIND_BURN_BOARD);
Page<HwaBrazier> hwaBrazierPages = hwaBrazierService.findDisplayHwaBrazier(pageRequest);
if(hwaBrazierPages.hasNext()){
this.pageRequest = this.pageRequest.next();
}else{
this.pageRequest = this.pageRequest.first();
}
Msgset msgset = msgsetService.findFirstByTtsTargetOrderByOrdernoAsc(DisplayConstants.MACHINE_KIND_BURN_BOARD);
Map<String, Object> result = new HashMap<>();
result.put("hwaBrazierVTO", HwaBrazierVTO.of(hwaBrazierPages.getContent()));
result.put("msgsetVTO", MsgsetVTO.of(msgset));
result.put("currentDate", DateUtils.formatToDateString("yyyy.MM.dd (E) a hh:mm"));
machines.forEach(machine->{
sessionManager.sendTextMessageByIp(machine.getIpaddress(), "display", result);
});
}
/**
*
*
* 메소드 명칭 : displayPagable
* 메소드 설명 : 페이지 전환 시 보여줄 페이지
* ----------------------------------------------------------
*
* @param displayPagable
* @return
*
* 이력사항
* 2016. 4. 27. SH 최초작성
*/
@ModelAttribute("displayPagable")
public Pageable displayPagable(Pageable displayPagable){
if(displayPagable == null || displayPagable.getPageSize() != 5){
return new PageRequest(0, 5);
}
return displayPagable;
}
/**
*
*
* 메소드 명칭 : findHwaBrazier
* 메소드 설명 : 현재 화장 데이터
* ----------------------------------------------------------
*
* @param model
* @param displayPagable
* @return
* @throws Exception
*
* 이력사항
* 2016. 4. 27. SH 최초작성
*/
@RequestMapping(value="/findHwaBrazier", method=RequestMethod.GET, produces=APPLICATION_JSON)
public CommonListResponseParams.MapResponse findHwaBrazier(
Model model
, @ModelAttribute("displayPagable") Pageable displayPagable
) throws Exception{
Page<HwaBrazier> hwaBrazierPages = hwaBrazierService.findDisplayHwaBrazier(displayPagable);
if(hwaBrazierPages.hasNext()){
model.addAttribute("displayPagable", displayPagable.next());
}else{
model.addAttribute("displayPagable", displayPagable.first());
}
Msgset msgset = msgsetService.findFirstByTtsTargetOrderByOrdernoAsc(DisplayConstants.MACHINE_KIND_BURN_BOARD);
Map<String, Object> result = new HashMap<>();
result.put("hwaBrazierVTO", HwaBrazierVTO.of(hwaBrazierPages.getContent()));
result.put("msgsetVTO", MsgsetVTO.of(msgset));
result.put("currentDate", DateUtils.formatToDateString("yyyy.MM.dd (E) a hh:mm"));
return CommonListResponseParams.MapResponse.of(result);
}
}
| [
"[email protected]"
] | |
57a5de89f86f43975d66e2b333a8de36955419fc | 9562f4f287c36eca1394f694c2c98c754e7c6105 | /my-app/src/test/java/com/uni/convert/tests/AppTest.java | 5dc6629182c41d0ff5464ce4d9ca386ab997f644 | [] | no_license | rimlester/IndustryProject-2 | 0c5f019af757eacc1b364bf0146385d0a44d0b12 | 788264e9e6e3eea09f9747858c386686eb956db6 | refs/heads/master | 2020-04-06T06:46:27.099010 | 2015-05-11T06:07:27 | 2015-05-11T06:07:27 | 35,029,434 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.uni.convert.tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"[email protected]"
] | |
90d12d40bad2c64c480b46302bde69f0776d39ce | 07cbd95d480efb7c14e0d1a7b54f5eeb315cebb1 | /layout/src/test/java/com/cs/layout/ExampleUnitTest.java | 3340c8881b3b78de08235231a55eba9aab70a594 | [] | no_license | CsKhris/Android190618 | da5495ab64a237af37e01fd1daa23d34c4030cde | bd3530db554b4be5d1d4935b30ffc1cd88939566 | refs/heads/master | 2020-06-05T19:20:57.657881 | 2019-06-18T11:06:22 | 2019-06-18T11:06:22 | 192,523,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package com.cs.layout;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
58935ec5ee3c256a786dc3ea49e6f38a113b07db | 9ba25fa57c64ab4f1b549c5d3b8d364b1ecce7f4 | /hrm_management_parent/hrm_sysmanage_interface/src/main/java/com/gzy/hrm/client/SystemdictionaryitemClient.java | 75bd11499da9c5660014deba83126435c2e01453 | [] | no_license | codeguo123/hrm_parent | b6bfdea48ed4c36a7cc8072b499d52644f8a662d | 869610dcbff6138cd21baff61e3ed43393fbd912 | refs/heads/master | 2021-06-19T10:47:41.022973 | 2021-04-29T06:56:27 | 2021-04-29T06:56:27 | 205,498,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,668 | java | package com.gzy.hrm.client;
import com.gzy.hrm.domain.Systemdictionaryitem;
import com.gzy.hrm.query.SystemdictionaryitemQuery;
import com.gzy.hrm.util.AjaxResult;
import com.gzy.hrm.util.PageList;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(value = "ZUUL-GATEWAY",configuration = FeignClientsConfiguration.class,
fallbackFactory = SystemdictionaryitemClientHystrixFallbackFactory.class)
@RequestMapping("/user/systemdictionaryitem")
public interface SystemdictionaryitemClient {
/**
* 保存和修改公用的
* @param systemdictionaryitem 传递的实体
* @return Ajaxresult转换结果
*/
@RequestMapping(value="/save",method= RequestMethod.POST)
AjaxResult save(Systemdictionaryitem systemdictionaryitem);
/**
* 删除对象信息
* @param id
* @return
*/
@RequestMapping(value="/delete/{id}",method=RequestMethod.DELETE)
AjaxResult delete(@PathVariable("id") Integer id);
//获取用户
@RequestMapping("/{id}")
Systemdictionaryitem get(@RequestParam(value="id",required=true) Long id);
/**
* 查看所有的员工信息
* @return
*/
@RequestMapping("/list")
public List<Systemdictionaryitem> list();
/**
* 分页查询数据
*
* @param query 查询对象
* @return PageList 分页对象
*/
@RequestMapping(value = "/json",method = RequestMethod.POST)
PageList<Systemdictionaryitem> json(@RequestBody SystemdictionaryitemQuery query);
}
| [
"gzy@com"
] | gzy@com |
5c1bbc793c72846781655edef8a42f5b892e2c9a | 1e61aec6f7e2542b02be966cff350b9132a8164a | /02 Servlet/14servletcontextattributeapp/src/com/cluster/SecondServlet.java | 9d7cbf152afac0e68e176539d6ea9b06a10825ea | [] | no_license | mithunrajur987/BasicJavaExamples | 743bc1a4b4cdb4dcb8b9f548d7906a8ab0f06f75 | fb70dc21e9cc16c7beb7919a1e7f501d3f316ed8 | refs/heads/master | 2020-04-18T23:24:33.535690 | 2019-01-27T15:26:32 | 2019-01-27T15:26:32 | 167,820,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,192 | java | package com.cluster;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Cluster Software Solutions.
* (Mob:98451-31637/39
* www.clusterindia.com)
*/
public class SecondServlet extends HttpServlet{
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter pw = res.getWriter();
ServletContext ctx = getServletContext();
// getting context attributes
Object e = ctx.getAttribute("company");
String strCompName = e.toString();
// getting context parameters
String strCountry = ctx.getInitParameter("country");
pw.println("<html>");
pw.println("<body bgcolor='wheat'>");
pw.println("<h1>Displaying both context attribute value and parameter value </h1>");
pw.println("Context attribute value is " + strCompName + "<br>");
pw.println("Context parameter value is " + strCountry);
pw.println("</body>");
pw.println("</html>");
}
}
| [
"[email protected]"
] | |
48f584424ffea7ccbd0f7ad5c38af9ffd6404d8c | bdbde999e483ff1612f958c67ca76f13ac103e08 | /br.com.searchmed.core/src/main/java/br/com/searchmed/MedicoEspecialidadeServiceImpl.java | 377a652a702f5bea60504f855e2a023bf4e7b419 | [] | no_license | lermen-andrefabiano/searchmedws | b8608f38a6b59293cc38fc6b4107da3adc622606 | 13484344b91a3812634d76bdc0128fb214c64498 | refs/heads/master | 2020-04-12T08:49:37.695209 | 2016-09-14T21:58:08 | 2016-09-14T21:58:08 | 63,030,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,119 | java | package br.com.searchmed;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import br.com.searchmed.core.entidades.Especialidade;
import br.com.searchmed.core.entidades.Medico;
import br.com.searchmed.core.entidades.MedicoEspecialidade;
import br.com.searchmed.core.entidades.Usuario;
/**
*
* @author andre.lermen
*
*/
@Named
public class MedicoEspecialidadeServiceImpl implements
MedicoEspecialidadeService {
@Inject
private MedicoEspecialidadeRepository medicoEspecialidadeRep;
@Inject
private UsuarioRepository usuarioRep;
@Inject
private EspecialidadeService especialidadeService;
@Override
public List<Medico> getMedicoEspecialidades(String convenio, Long especialidadeId) {
try {
List<Medico> medicos = this.medicoEspecialidadeRep.getMedicoEspecialidades(convenio, especialidadeId);
for(Medico m : medicos){
m.setHorarios(medicoEspecialidadeRep.getHorarioMedico(m.getId()));
}
return medicos;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public List<MedicoEspecialidade> getEspecialidaMedico(Long medicoId) {
return this.medicoEspecialidadeRep.getEspecialidaMedico(medicoId);
}
@Override
public void excluir(Long usuarioId, Long especialidadeId) {
Usuario u = this.usuarioRep.obterPorId(usuarioId);
if(u!=null&&u.getMedico()!=null){
MedicoEspecialidade medicoEspecialidade = this.medicoEspecialidadeRep.obterPorMedico(u.getMedico().getId(), especialidadeId);
this.medicoEspecialidadeRep.excluir(medicoEspecialidade);
}
}
@Override
public void incluir(Long usuarioId, Long especialidadeId) {
Usuario u = this.usuarioRep.obterPorId(usuarioId);
if(u!=null&&u.getMedico()!=null){
if(u.getMedico().getEspecialidades()!=null){
u.getMedico().setEspecialidades(new ArrayList<MedicoEspecialidade>());
}
Especialidade e = this.especialidadeService.obterPorId(especialidadeId);
u.getMedico().getEspecialidades().add(new MedicoEspecialidade(0L, e, u.getMedico()));
this.usuarioRep.salvar(u);
}
}
} | [
"[email protected]"
] | |
8538f041a47174b80fab198936dfddcadecb9307 | 557ae2b37a1ffb63364bd186aaf6a2cee7964768 | /src/Critters/Giant.java | d7e6df685a4ce4378ed3a8b2439cdb7fc01f4e0a | [] | no_license | BrianLoveGa/TalentPathJava | e602824ef006f049ce3801f27f5ad7c61e8316e2 | fe5bb9f5c0e5a18bc710f8457487e46b9ace7da3 | refs/heads/master | 2022-07-25T10:58:17.765619 | 2020-05-12T19:38:48 | 2020-05-12T19:38:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 963 | java | package Critters;
import java.awt.*;
import java.util.Random;
public class Giant extends Critter {
private Color color = Color.GRAY;
private String[] images = {"fee", "fie", "foe", "fum"};
private int moveCount = 0;
public Giant() {
super();
}
public Action getMove(CritterInfo info) {
Action action;
if (info.frontThreat()) {
action = Action.INFECT;
} else if (info.getFront() == Neighbor.EMPTY) {
action = Action.HOP;
} else {
action = Action.RIGHT;
}
moveCount++;
return action;
}
// This method should be overriden (default color is black)
public Color getColor() {
return this.color;
}
// This method should be overriden (default display is "?")
public String toString() {
int img = (moveCount / 6) % images.length;
return images[img];
}
} | [
"[email protected]"
] | |
b17d046765430a6c82cbc4a4ce1d56de25405d1b | 12838ade9621940042a47104be07b9f782beef46 | /InventoryControlSystem/src/main/java/com/capstone/ics/controller/JRViewerFxController.java | da0cc5b51e9bc91dc7ebe46824d077ed10b47242 | [] | no_license | comauguste/CSC521-Capstone | ad2a08ebb13ba6b02936e2e0584e4c775e5f52cb | 0012e015ad3c834c61c1c17a8ba48b9272dfadc9 | refs/heads/master | 2021-01-22T11:48:11.733028 | 2016-06-27T14:07:07 | 2016-06-27T14:07:07 | 51,221,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,361 | java | /*
* 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 com.capstone.ics.controller;
import java.awt.image.BufferedImage;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.embed.swing.SwingFXUtils;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.Slider;
import javafx.scene.image.ImageView;
import javafx.scene.image.WritableImage;
import javafx.stage.Popup;
import javafx.stage.Stage;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
/**
*
* @author Auguste C
*/
public class JRViewerFxController implements Initializable {
private JRViewerFxMode printMode;
private String reportFilename;
private JRDataSource reportDataset;
@SuppressWarnings("rawtypes")
private Map reportParameters;
private ChangeListener<Number> zoomListener;
private JasperPrint jasperPrint;
@FXML
private ImageView imageView;
@FXML
ComboBox<Integer> pageList;
@FXML
Slider zoomLevel;
@FXML
protected Node view;
private Stage parentStage;
private Double zoomFactor;
private double imageHeight;
private double imageWidth;
private List<Integer> pages;
private Popup popup;
private Label errorLabel;
boolean showingToast;
public void show() {
if (reportParameters == null) {
reportParameters = new HashMap();
}
if (printMode == null || printMode == JRViewerFxMode.REPORT_VIEW) {
popup = new Popup();
errorLabel = new Label("Error");
errorLabel.setWrapText(true);
errorLabel.setMaxHeight(200);
errorLabel.setMinSize(100, 100);
errorLabel.setMaxWidth(100);
errorLabel.setAlignment(Pos.TOP_LEFT);
errorLabel.getStyleClass().add("errorToastLabel");
popup.getContent().add(errorLabel);
errorLabel.opacityProperty().bind(popup.opacityProperty());
zoomFactor = 1d;
zoomLevel.setValue(100d);
imageView.setX(0);
imageView.setY(0);
imageHeight = jasperPrint.getPageHeight();
imageWidth = jasperPrint.getPageWidth();
if (zoomListener != null) {
zoomLevel.valueProperty().removeListener(zoomListener);
}
zoomListener = (ObservableValue<? extends Number> observable, Number oldValue, Number newValue) -> {
zoomFactor = newValue.doubleValue() / 100;
imageView.setFitHeight(imageHeight * zoomFactor);
imageView.setFitWidth(imageWidth * zoomFactor);
};
zoomLevel.valueProperty().addListener(zoomListener);
if (jasperPrint.getPages().size() > 0) {
viewPage(0);
pages = new ArrayList<>();
for (int i = 0; i < jasperPrint.getPages().size(); i++) {
pages.add(i + 1);
}
}
pageList.setItems(FXCollections.observableArrayList(pages));
pageList.getSelectionModel().select(0);
} else if (printMode == JRViewerFxMode.REPORT_PRINT) {
print();
}
}
private WritableImage getImage(int pageNumber) {
BufferedImage image = null;
try {
image = (BufferedImage) JasperPrintManager.printPageToImage(jasperPrint, pageNumber, 2);
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
WritableImage fxImage = new WritableImage(jasperPrint.getPageWidth(), jasperPrint.getPageHeight());
return SwingFXUtils.toFXImage(image, fxImage);
}
private void viewPage(int pageNumber) {
imageView.setFitHeight(imageHeight * zoomFactor);
imageView.setFitWidth(imageWidth * zoomFactor);
imageView.setImage(getImage(pageNumber));
}
public void clear() {
// TODO Auto-generated method stub
}
@FXML
private void print() {
try {
JasperPrintManager.printReport(jasperPrint, true);
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@FXML
private void pageListSelected(final ActionEvent event) {
System.out.println(pageList.getSelectionModel().getSelectedItem() - 1);
viewPage(pageList.getSelectionModel().getSelectedItem() - 1);
}
public JRViewerFxMode getPrintMode() {
return printMode;
}
public void setPrintMode(JRViewerFxMode printMode) {
this.printMode = printMode;
}
public String getReportFilename() {
return reportFilename;
}
public void setReportFilename(String reportFilename) {
this.reportFilename = reportFilename;
}
public JRDataSource getReportDataset() {
return reportDataset;
}
public void setReportDataset(JRDataSource reportDataset) {
this.reportDataset = reportDataset;
}
public Map getReportParameters() {
return reportParameters;
}
public void setReportParameters(Map reportParameters) {
this.reportParameters = reportParameters;
}
public Node getView() {
return view;
}
public void setView(Node view) {
this.view = view;
}
public void close() {
parentStage.close();
}
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
}
public JasperPrint getJasperPrint() {
return jasperPrint;
}
public void setJasperPrint(JasperPrint jasperPrint) {
this.jasperPrint = jasperPrint;
}
}
| [
"[email protected]"
] | |
f1174276e155444446de6e37ea04b8b2548a1296 | 321292912806ad645dfc796b16491ffeb2886e0f | /core11/src/furda/inc/entities/EntityType.java | 4cf19304ef9be90971f3d64eefc4bc2c5d906171 | [] | no_license | FurdaInc/BacteriaProjectFurda | 2a9a4a8dd758e757f2b68736788629a74ce941c8 | aa5e91a10faf062c644d24a5e396c40deb8c6c19 | refs/heads/master | 2023-03-03T03:48:02.457319 | 2021-02-14T14:08:47 | 2021-02-14T14:08:47 | 254,529,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,120 | java | package furda.inc.entities;
public enum EntityType {
//id name, width (here 14 as bricks are 16 wide, being 14 the player can slip through)
//Height - player is 2 bricks high
//The weight is going to be an assigned value for gravity. This affects fall speed
BACTERIABLUE("bacteriaBlue", 56, 64, 40),
BACTERIARED("bacteriaRed", 56,64,40),
BLUESPORE("bluespore", 16,16,40),
REDSPORE("redspore", 16,16,40),
GARLIC("garlic", 16,16,40),
ANTIBIOTIC("antibiotic",16,16,40),
WBC("WBC",32,32,40),
SPAWNBUTTON("spawnButton",32,16,40);
private String id;
private int width, height;
private float weight;
public String getId() {
return id;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public float getWeight() {
return weight;
}
EntityType(String id, int width, int height, float weight) {
this.id = id;
this.width = width;
this.height = height;
this.weight = weight;
}
}
| [
"[email protected]"
] | |
07548ec152e2c2d228ec4e0465cf2344e27ae1e3 | faa11c94e615bb311db047c6783289817de4f42d | /src/main/java/com/jetbrains/jetpad/vclang/module/caching/PersistenceProvider.java | 3354edcba29a23dca6ed12f5cd51a55677cbf2b9 | [] | no_license | edgarzhavoronkov/vclang | d7dce32110aeb13a6febcde879b51892dd1da4da | b98a49c8aa8cc0cfbb004eb33d7aae8a2c3e0977 | refs/heads/master | 2021-08-26T08:39:22.402650 | 2017-11-16T07:46:44 | 2017-11-16T07:46:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package com.jetbrains.jetpad.vclang.module.caching;
import com.jetbrains.jetpad.vclang.module.source.SourceId;
import com.jetbrains.jetpad.vclang.term.Abstract;
import java.net.URI;
public interface PersistenceProvider<SourceIdT extends SourceId> {
URI getUri(SourceIdT sourceId);
SourceIdT getModuleId(URI sourceUrl);
String getIdFor(Abstract.Definition definition);
Abstract.Definition getFromId(SourceIdT sourceId, String id);
}
| [
"[email protected]"
] | |
21760f99cec70828689bfe3dfa2025f045bcdda3 | a73b214c02383ee96ac96cc21b20a5c823c05e4e | /cue/src/test/java/com/cucumber/cue/AppTest.java | 91e031c6b3a912508591dc82baef2a56fe3c756f | [] | no_license | motiour/CUE_Retailer | c1d7d027203255d09b81c37b8f295bb44c931420 | 3914d3687acb1621298f4f710deb777436037a6e | refs/heads/master | 2021-01-20T17:40:39.382123 | 2016-12-26T01:55:44 | 2016-12-26T01:55:44 | 60,392,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 644 | java | package com.cucumber.cue;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| [
"[email protected]"
] | |
5b3bd730e8c33ec5f7a63d3b9d30c91f3ed07eef | 37dcfb1aba501e6ace49fc123bfd3a67a4e5dcd9 | /api/tapestry-resteasy/src/main/java/dev/openshift/tapestry/angular2/data/bookcat/Book.java | 614fda35978ba41e525a3dd0dc4842b1432562db | [] | no_license | ffacon/Test-Angular2-Cli | c7a6e7f0eb00ba3c3cbe904927dd0c1cd0c8eae2 | 497a62ad387391079b474f8b1e7996cf500afe09 | refs/heads/master | 2021-01-11T19:18:18.535649 | 2017-10-14T20:36:35 | 2017-10-14T20:36:35 | 79,350,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,534 | java | package dev.openshift.tapestry.angular2.data.bookcat;
import org.apache.tapestry5.json.JSONArray;
import org.apache.tapestry5.json.JSONObject;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.ObjectWriter;
import java.io.IOException;
public class Book {
private String id;
private String name;
private String author;
private Float price;
private String description;
private String category;
private boolean isNew;
private BookComment[] comments;
public Book() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public void setIsNew(boolean isNew) {
this.isNew = isNew;
}
public boolean getIsNew() {
return isNew;
}
public BookComment[] getComments() {
return comments;
}
public void setComments(BookComment[] comments) {
this.comments = comments;
}
/*public JSONObject getJSONObject() {
String json="";
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
JSONObject ret = new JSONObject();
ret.put("id",this.id);
ret.put("author",this.author);
ret.put("name",this.name);
ret.put("description",this.description);
ret.put("category",this.category);
ret.put("price",this.price);
ret.put("isNew",this.isNew);
try {
json = ow.writeValueAsString(this.comments);
ret.put("comments",new JSONArray(json));
} catch (IOException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
return ret;
}*/
}
| [
"[email protected]"
] | |
bcd779f652d81c64672e454edba4c8d037d0e072 | bdafcc421d9dea8c7bbc3a88cfdfe507d952aa60 | /src/Presentacion/Doctor/GUIDoctor.java | 35c770a3e6be3bfb052b549ea7994da552ae3919 | [] | no_license | david10923/FarmaciaUpgraded | 43d3272e0e368d18d03ab02e2ccb5494d1037289 | 6cc78333bdadf3604aa72883b8f7efceb551ea20 | refs/heads/master | 2023-02-10T20:20:14.112466 | 2021-01-06T12:08:42 | 2021-01-06T12:08:42 | 325,841,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,751 | java | package Presentacion.Doctor;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import Presentacion.Producto.MostrarTodosProductos;
import Presentacion.Vista.GUIFarmaciaImp;
import Presentacion.Vista.IGUI;
import Presentacion.Vista.MostrarTodos;
import Presentacion.Vista.MostrarUno;
import Presentacion.Vista.OperationsPanel;
public class GUIDoctor extends JPanel implements IGUI {
private OperationsPanel OperationsPanel;
private MostrarTodos mostrarTodos;
private MostrarUno mostrarUno;
public GUIDoctor() {
this.setVisible(true);
OperationsPanel = new OperationsPanel(GUIFarmaciaImp.TAB_PRODUCTO);
mostrarTodos = new MostrarTodosProductos(GUIFarmaciaImp.TAB_PRODUCTO, null);
mostrarUno = new MostrarUno(GUIFarmaciaImp.TAB_PRODUCTO);
OperationsPanel.getToolBar().addSeparator();
this.add(mostrarTodos, BorderLayout.NORTH);
this.add(OperationsPanel, BorderLayout.EAST);
this.add(mostrarUno,BorderLayout.WEST);
OperationsPanel.getAltaBoton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new VentanaCrearDoctor();
}
});
OperationsPanel.getBajaBoton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new VentanaBajaDoctor();
}
});
OperationsPanel.getModificarBoton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new VentanaModificarDoctor();
}
});
this.setVisible(true);
}
@Override
public void actualizar(Object data, Integer evento) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
e34800f664182de3bfd1bbf206aeb50ee9080694 | d8c114229b315f291318da284f8151a1d3f645e0 | /House.java | f6a4edd6dc2e90980aa45fd49c586a9c1c11bb5a | [] | no_license | josh-ross/AT-CS-Shapes_House | f1af405eb54f02194160c04fac4f524a6555405c | 0d9db63cb2e5bec612d1f7356c1a67bcd07c2afe | refs/heads/master | 2021-01-01T20:42:27.228999 | 2014-11-24T22:44:29 | 2014-11-24T22:44:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,707 | java | /**
* Draws a house
*
* @author (Josh Ross)
* @version (2014-10-10)
*/
public class House
{
public House()
{
Square back = new Square();
back.changeColor("black");
back.moveVertical(-50);
back.moveHorizontal(-100);
back.changeSize(10000);
back.makeVisible();
Square main_house = new Square();
main_house.changeColor("blue");
main_house.moveHorizontal(50);
main_house.moveVertical(65);
main_house.changeSize(100);
main_house.makeVisible();
Triangle roof = new Triangle();
roof.moveHorizontal(110);
roof.moveVertical(50);
roof.changeColor("red");
roof.changeSize(50,100);
roof.makeVisible();
Square door = new Square();
door.changeColor("magenta");
door.moveHorizontal(80);
door.moveVertical(130);
door.changeSize(35);
door.makeVisible();
Circle knob = new Circle();
knob.changeColor("black");
knob.moveHorizontal(123);
knob.moveVertical(133);
knob.changeSize(9);
knob.makeVisible();
Square pane = new Square();
pane.changeColor("green");
pane.moveHorizontal(60);
pane.moveVertical(80);
pane.makeVisible();
Square window_tl = new Square();
window_tl.changeColor("black");
window_tl.moveHorizontal(60);
window_tl.moveVertical(80);
window_tl.changeSize(11);
window_tl.makeVisible();
Square window_tr = new Square();
window_tr.changeColor("black");
window_tr.moveHorizontal(79);
window_tr.moveVertical(80);
window_tr.changeSize(11);
window_tr.makeVisible();
Square window_bl = new Square();
window_bl.changeColor("black");
window_bl.moveHorizontal(60);
window_bl.moveVertical(99);
window_bl.changeSize(11);
window_bl.makeVisible();
Square window_br = new Square();
window_br.changeColor("black");
window_br.moveHorizontal(79);
window_br.moveVertical(99);
window_br.changeSize(11);
window_br.makeVisible();
Circle sun = new Circle();
sun.changeColor("yellow");
sun.moveVertical(-40);
sun.makeVisible();
Circle moon = new Circle();
moon.changeColor("white");
moon.moveVertical(-40);
moon.moveHorizontal(50);
moon.makeVisible();
Circle moon_cover = new Circle();
moon_cover.changeColor("black");
moon_cover.moveVertical(-40);
moon_cover.moveHorizontal(57);
moon_cover.makeVisible();
}
}
| [
"[email protected]"
] | |
4224d95d587bb1020e51fbaaf0a49ab487b57c61 | b216dd68bbccc4ec2a5e1a221a340a8f8d2ad100 | /cmkpmoney-api/src/main/java/com/cmkpmoney/api/service/exception/PessoaInexistenteOuInativaException.java | 9ffe173e0bdd31c732ea9b5235535f6f177875e2 | [] | no_license | LucasCapSilva/CMKP-MoneyApi_Auth-OAuth2-JWT | 68387a1232366ae4558a2b64dd94e023bd5b9fb2 | 377842ed08a0926cdb503a0721f1e06ae44fe955 | refs/heads/master | 2021-01-04T13:47:46.885030 | 2020-02-14T19:23:01 | 2020-02-14T19:23:01 | 240,581,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package com.cmkpmoney.api.service.exception;
//dispara o erro apenas para pessoa existete
public class PessoaInexistenteOuInativaException extends RuntimeException {
private static final long serialVersionUID = 1L;
}
| [
"[email protected]"
] | |
42dc06ec655f1b63e10d8f4c555a9205a4f4763e | fcda29de2a7c8fca029f10a38c2f409ffcaa118b | /myssi/src/main/java/org/amu/demo/myssi/entity/Department.java | ead8e25fa33eb5a3e33f99a0ae2640d36719b9fd | [] | no_license | yuzhu310/myssi | 11b06746bbf41944cabd706859bbd1af22725761 | d7fcfc8982ed66c95deeaca1feaf3e1c00ec0f07 | refs/heads/master | 2020-04-03T03:24:34.257833 | 2013-09-22T05:14:26 | 2013-09-22T05:14:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package org.amu.demo.myssi.entity;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Table;
import com.google.common.collect.Lists;
/**
* 部门.
*
* @author amu
*/
@Table(name = "acct_department")
public class Department extends IdEntity {
private String name;
private User manager;
private List<User> userList = Lists.newArrayList();
@Column
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public User getManager() {
return manager;
}
public void setManager(User manager) {
this.manager = manager;
}
public List<User> getUserList() {
return userList;
}
public void setUserList(List<User> userList) {
this.userList = userList;
}
}
| [
"[email protected]"
] | |
cfc12e64ce7938a7762e4a55bcca0e1f39d250bb | 4e7c97cf0c04015ab6120c34362c804a4f52a944 | /ProjetoAlimentosSuadaveis/src/com/vidasaudavel/service/AlimentoServiceImpl.java | f292c36a8cd07823b4e66fa471383b0bd11193f6 | [] | no_license | jessicaplm/projetoFinalVS | 9060f24fbf27ad1adff1738bba957502b18af369 | a0e33e4ae4753e427533cc80a1294983c0c4d983 | refs/heads/master | 2021-01-11T00:16:39.182237 | 2016-10-01T18:31:25 | 2016-10-01T18:31:25 | 69,176,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,295 | java | package com.vidasaudavel.service;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.vidasaudavel.dao.AlimentoDAO;
import com.vidasaudavel.model.Alimento;
@Service
@Transactional(readOnly = true)
public class AlimentoServiceImpl implements AlimentoService {
private AlimentoDAO alimentoDAO;
public void setAlimentoDAO(AlimentoDAO alimentoDAO) {
this.alimentoDAO = alimentoDAO;
}
@Override
@Transactional(readOnly = false)
public void addAlimento(Alimento a) {
// TODO Auto-generated method stub
this.alimentoDAO.addAlimento(a);
}
@Override
public List<Alimento> listAlimento() {
// TODO Auto-generated method stub
return this.alimentoDAO.listAlimento();
}
@Override
@Transactional(readOnly = false)
public void updateAlimento(Alimento a) {
// TODO Auto-generated method stub
this.alimentoDAO.updateAlimento(a);
}
@Override
@Transactional(readOnly = false)
public void removeAlimentoById(int id) {
// TODO Auto-generated method stub
this.alimentoDAO.removeAlimentoById(id);
}
@Override
public List<Alimento> listByNameAlimento(String n) {
return this.alimentoDAO.listByNameAlimento(n);
}
}
| [
"[email protected]"
] | |
b812e14ce398e1b53e6e0d4af6ad080274a275da | 8b57efdbcc3e9d8181e4d46cf34420ddb325cf79 | /SIPRE/src/java/net/codejava/spring/model/SipreTmpBonificacion.java | 085587c21e82bb2951e588db2285cd35e84678f2 | [] | no_license | dickmafy/proyectos2015 | befed30a370aad2aca18a8bf978ec54387052508 | 1d2ff45b5ed7153827205d8915304e2b3ade1793 | refs/heads/master | 2021-01-10T12:05:05.608351 | 2015-10-16T05:21:03 | 2015-10-16T05:21:03 | 43,626,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,116 | java | /*
* 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 net.codejava.spring.model;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author DIEGO
*/
@Entity
@Table(name = "SIPRE_TMP_BONIFICACION")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "SipreTmpBonificacion.findAll", query = "SELECT s FROM SipreTmpBonificacion s")})
public class SipreTmpBonificacion implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
protected SipreTmpBonificacionPK sipreTmpBonificacionPK;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "NTB_MONTO")
private BigDecimal ntbMonto;
@Column(name = "VTB_APE_NOM")
private String vtbApeNom;
@Column(name = "CTB_IND_SITUACION")
private Character ctbIndSituacion;
@Column(name = "MES_REINTEGRO")
private String mesReintegro;
@JoinColumn(name = "CTP_CODIGO", referencedColumnName = "CTP_CODIGO")
@ManyToOne(optional = false)
private SipreTipoPlanilla ctpCodigo;
public SipreTmpBonificacion() {
}
public SipreTmpBonificacion(SipreTmpBonificacionPK sipreTmpBonificacionPK) {
this.sipreTmpBonificacionPK = sipreTmpBonificacionPK;
}
public SipreTmpBonificacion(String cpersonaNroAdm, String cciCodigo, String ctbMesBonificacion, String mesProceso) {
this.sipreTmpBonificacionPK = new SipreTmpBonificacionPK(cpersonaNroAdm, cciCodigo, ctbMesBonificacion, mesProceso);
}
public SipreTmpBonificacionPK getSipreTmpBonificacionPK() {
return sipreTmpBonificacionPK;
}
public void setSipreTmpBonificacionPK(SipreTmpBonificacionPK sipreTmpBonificacionPK) {
this.sipreTmpBonificacionPK = sipreTmpBonificacionPK;
}
public BigDecimal getNtbMonto() {
return ntbMonto;
}
public void setNtbMonto(BigDecimal ntbMonto) {
this.ntbMonto = ntbMonto;
}
public String getVtbApeNom() {
return vtbApeNom;
}
public void setVtbApeNom(String vtbApeNom) {
this.vtbApeNom = vtbApeNom;
}
public Character getCtbIndSituacion() {
return ctbIndSituacion;
}
public void setCtbIndSituacion(Character ctbIndSituacion) {
this.ctbIndSituacion = ctbIndSituacion;
}
public String getMesReintegro() {
return mesReintegro;
}
public void setMesReintegro(String mesReintegro) {
this.mesReintegro = mesReintegro;
}
public SipreTipoPlanilla getCtpCodigo() {
return ctpCodigo;
}
public void setCtpCodigo(SipreTipoPlanilla ctpCodigo) {
this.ctpCodigo = ctpCodigo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (sipreTmpBonificacionPK != null ? sipreTmpBonificacionPK.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SipreTmpBonificacion)) {
return false;
}
SipreTmpBonificacion other = (SipreTmpBonificacion) object;
if ((this.sipreTmpBonificacionPK == null && other.sipreTmpBonificacionPK != null) || (this.sipreTmpBonificacionPK != null && !this.sipreTmpBonificacionPK.equals(other.sipreTmpBonificacionPK))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.codejava.spring.model.SipreTmpBonificacion[ sipreTmpBonificacionPK=" + sipreTmpBonificacionPK + " ]";
}
}
| [
"[email protected]"
] | |
328a63e418f23dfd2f558da5b81771674e5c0cc5 | 85eadf2c61a9771b9ad94825373d9a9d89e07dc2 | /PowerUp_v1.2__2_24_2018/src/org/usfirst/frc/team2377/robot/commands/CenterSwitch.java | 7a414221c1390cd83f277a53fa089fb2a174d8d0 | [] | no_license | team2377/2018_PowerUp | 9d933b4f3c1f8177d2edcf8fc4d7ed6e33789d35 | 993c031c3316b72ce7d22ad2885681533e90e31e | refs/heads/master | 2021-05-10T14:46:45.113563 | 2018-03-27T23:30:46 | 2018-03-27T23:30:46 | 118,532,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,869 | java | package org.usfirst.frc.team2377.robot.commands;
import org.usfirst.frc.team2377.robot.Robot;
import org.usfirst.frc.team2377.robot.subsystems.FmsSubSystem;
import edu.wpi.first.wpilibj.command.CommandGroup;
public class CenterSwitch extends CommandGroup {
private double elevator_speed = .8;
private double drive_speed = .7;
private double turn_speed = .5;
// private Logging logger;
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATION
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
public CenterSwitch() {
// logger.init("CenterSwitch");
System.out
.println("Entering center switch code, " + FmsSubSystem.getRightSwitchActive(Robot.switchScaleLayout));
if (FmsSubSystem.getRightSwitchActive(Robot.switchScaleLayout)) {
// addSequential(new SwitchOElGearO(true));
// logger.info("The robot is going to the right switch", LocalDateTime.now());
addSequential(new AutoOpenCloseGripper(true));// close
// addSequential(new AutoRotateArmOut());// out
// addParallel(new AutoMoveElevator(Robot.RaiseElevatorSw, .7, 1));
// addSequential(new AutoMoveElevator(Robot.RaiseElevatorSw, .7, 1));
addSequential(new DriveForward(Robot.autonLine, drive_speed));
addParallel(new DriveForward(10, drive_speed));
// addSequential(new DriveForward(20, drive_speed));
// addSequential(new AutoOpenCloseGripper(false));// open
addSequential(new AutoOutputDriveShooterWheels());
addSequential(new DriveBackward(10, -drive_speed));
} else {
// logger.info("The robot is going to the left switch", LocalDateTime.now());
// addSequential(new SwitchOElGearO(true));
addSequential(new AutoOpenCloseGripper(true));// close
// addSequential(new AutoRotateArmOut());// out
addSequential(new DriveForward(Robot.C2LSw_Leg_1, drive_speed));
addSequential(new AutoRotateLeft(Robot.RotateLeft, turn_speed));
addSequential(new DriveForward(Robot.C2LSw_Leg_2, drive_speed));
// addParallel(new AutoMoveElevator(Robot.RaiseElevatorSw, .7, 1));
// addSequential(new AutoMoveElevator(Robot.RaiseElevatorSw, .7, 1));
addSequential(new AutoRotateRight(Robot.RotateRight, turn_speed));
// addParallel(new AutoMoveElevator(Robot.RaiseElevatorSw, .70, 1));
addSequential(new DriveForward(Robot.C2LSw_Leg_3, drive_speed));
// addSequential(new AutoOpenCloseGripper(false));// open
addSequential(new AutoOutputDriveShooterWheels());
}
// logger.close();
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
}
}
| [
"[email protected]"
] | |
c43a3b02776d16d9e35bd2e62d738168a747022d | 5f27877aa878944a8b550a62bc0990ec76557d7b | /DSD-Trafego/src/estrada/EstradaCaminhoAdicionaReservaVisitor.java | 066b9a3a4c14cd8244eb50c2660aa53bbb68f23f | [] | no_license | BrunoZSgrott/TrafficSim | 6d37c60f3b03b543bd0b785f1eeafde0577a8bc4 | 66f9f931a7d962ccd6d1481581571add0e1c2f14 | refs/heads/master | 2022-11-27T23:25:17.273112 | 2020-08-03T21:29:37 | 2020-08-03T21:29:37 | 277,672,668 | 0 | 0 | null | 2020-08-03T00:36:34 | 2020-07-06T23:51:08 | Java | UTF-8 | Java | false | false | 1,075 | java | package estrada;
import estrada.visitor.IVisitor;
/**
*
* @author Bruno Zilli Sgrott
*/
class EstradaCaminhoAdicionaReservaVisitor implements IVisitor {
private boolean reservado;
private EstradaCaminho caminho;
EstradaCaminhoAdicionaReservaVisitor(EstradaCaminho caminho) {
this.caminho = caminho;
}
@Override
public void visitEstradaNormal(EstradaNormal estrada) throws Exception {
if (!estrada.possuiReserva()) {
estrada.setReserva(caminho);
}
reservado = estrada.getReserva() == caminho;
}
@Override
public void visitCruzamento(EstradaCruzamento estrada) throws Exception {
if (!estrada.possuiReserva()) {
estrada.setReserva(caminho);
}
reservado = estrada.getReserva() == caminho;
}
@Override
public void visitEstradaVazia(EstradaEmpty estrada) throws Exception {
}
@Override
public void visitEstradaCaminho(EstradaCaminho estrada) throws Exception {
}
boolean reservado() {
return reservado;
}
}
| [
"[email protected]"
] | |
1faded16653f3a81011bd4ad38e4b242fb439cec | 65e8ef0ffdccdd7c791c8527a9aa816e5af742fd | /football-teams/src/test/java/br/com/football/teams/SuccessBase.java | 033ded7a59073f9d7b951391603795b29840a6a5 | [] | no_license | alvesfc/football | 6bbb6cb576a1589c7bce57299122df1fb3702584 | 275b59e2082799dd5ba4e2e3b0ca741161356e27 | refs/heads/master | 2020-04-08T14:03:39.162427 | 2019-10-01T02:20:37 | 2019-10-01T02:20:37 | 159,420,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,128 | java | package br.com.football.teams;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
import de.flapdoodle.embed.mongo.MongodStarter;
import de.flapdoodle.embed.mongo.config.IMongodConfig;
import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.process.runtime.Network;
import org.junit.BeforeClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.restdocs.payload.FieldDescriptor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class SuccessBase extends BaseTests {
@Autowired
protected MongoTemplate mongoTemplate;
private static MongodProcess mongodProcess;
@BeforeClass
public static void setupMongo() throws Exception {
if (mongodProcess == null || !mongodProcess.isProcessRunning()) {
IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.V3_6)
.net(new Net("localhost", 27019, Network.localhostIsIPv6()))
.build();
MongodStarter starter = MongodStarter.getDefaultInstance();
MongodExecutable mongodExecutable = starter.prepare(mongodConfig);
mongodProcess = mongodExecutable.start();
}
}
public SuccessBase() {
super(SuccessBase.shouldCreatePlayerFields());
}
public SuccessBase(Map<String, List<FieldDescriptor>> fieldDescriptors) {
super(fieldDescriptors);
}
private static Map<String, List<FieldDescriptor>> shouldCreatePlayerFields() {
Map<String, List<FieldDescriptor>> values = new HashMap<>();
values.put("request_validate_shouldCreateTeam", TeamCreateDescriptors.builder()
.withName()
.withFullname()
.withAcronym()
.withCountry()
.build());
values.put("response_validate_shouldCreateTeam", TeamCreateDescriptors.builder()
.withCode()
.build());
return values;
}
}
| [
"[email protected]"
] | |
f7c6ef9ce103ea6af81861888e8a0057f2a673b9 | 58edc01fb7c5498611716b49367a3e7af21331d0 | /src/day09_scanner_practice/AddNumbers.java | 63227b81d11fe045636d404e4ba8abff176da905 | [] | no_license | bashir-hasanov/java-programming | bcda4e2ad7a0306acea899684b177f4b3db94b04 | ce33e2a539d782138f961613fbeda7c880790306 | refs/heads/master | 2023-06-18T14:06:15.802288 | 2021-07-18T21:08:35 | 2021-07-18T21:08:35 | 371,984,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package day09_scanner_practice;
import java.util.Scanner;
public class AddNumbers {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter 2 numbers");
int num1 = scan.nextInt();
int num2 = scan.nextInt();
int result = num1 + num2;
System.out.println("Result: " + result);
}
}
| [
"[email protected]"
] | |
5245562a703c01dbd1ec6721c9b17b9cf5ee97f9 | 3ef55e152decb43bdd90e3de821ffea1a2ec8f75 | /large/module0323_public/tests/more/src/java/module0323_public_tests_more/a/Foo1.java | c971a0999299a388d65f1b48136489eab534f9cb | [
"BSD-3-Clause"
] | permissive | salesforce/bazel-ls-demo-project | 5cc6ef749d65d6626080f3a94239b6a509ef145a | 948ed278f87338edd7e40af68b8690ae4f73ebf0 | refs/heads/master | 2023-06-24T08:06:06.084651 | 2023-03-14T11:54:29 | 2023-03-14T11:54:29 | 241,489,944 | 0 | 5 | BSD-3-Clause | 2023-03-27T11:28:14 | 2020-02-18T23:30:47 | Java | UTF-8 | Java | false | false | 1,635 | java | package module0323_public_tests_more.a;
import java.util.zip.*;
import javax.annotation.processing.*;
import javax.lang.model.*;
/**
* Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
* labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
* Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
*
* @see java.awt.datatransfer.DataFlavor
* @see java.beans.beancontext.BeanContext
* @see java.io.File
*/
@SuppressWarnings("all")
public abstract class Foo1<T> extends module0323_public_tests_more.a.Foo0<T> implements module0323_public_tests_more.a.IFoo1<T> {
java.rmi.Remote f0 = null;
java.nio.file.FileStore f1 = null;
java.sql.Array f2 = null;
public T element;
public static Foo1 instance;
public static Foo1 getInstance() {
return instance;
}
public static <T> T create(java.util.List<T> input) {
return module0323_public_tests_more.a.Foo0.create(input);
}
public String getName() {
return module0323_public_tests_more.a.Foo0.getInstance().getName();
}
public void setName(String string) {
module0323_public_tests_more.a.Foo0.getInstance().setName(getName());
return;
}
public T get() {
return (T)module0323_public_tests_more.a.Foo0.getInstance().get();
}
public void set(Object element) {
this.element = (T)element;
module0323_public_tests_more.a.Foo0.getInstance().set(this.element);
}
public T call() throws Exception {
return (T)module0323_public_tests_more.a.Foo0.getInstance().call();
}
}
| [
"[email protected]"
] | |
69b0233d0c674efdcbb6bbece78f1841ea925a1a | 708eab871f9c08479f5956f1c88f1a733a036884 | /pixate-freestyle/src/com/pixate/freestyle/util/IOUtil.java | ca48d26ab628557fb71a86f00e5e40e0e304de8d | [
"LicenseRef-scancode-other-permissive",
"Apache-2.0"
] | permissive | timesong/pixate-freestyle-android | 3e24fac85d0980255fb3c4ee06cda726525dd9aa | 7d4d25a55fa63be3e4e5f73d501cc9e85b75d6cc | refs/heads/master | 2021-01-15T11:20:38.960388 | 2014-03-20T21:07:36 | 2014-03-20T21:07:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,234 | java | /*******************************************************************************
* Copyright 2012-present Pixate, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.pixate.freestyle.util;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class IOUtil {
private static final String UTF8 = "UTF-8";
public static final String UTF8_BOM = "\uFEFF";
public static String read(String filePath) throws IOException {
return read(filePath, UTF8);
}
public static String read(String filePath, String charsetName) throws IOException {
return read(new FileInputStream(filePath), charsetName);
}
public static String read(InputStream inputStream) throws IOException {
return read(inputStream, UTF8);
}
public static String read(InputStream inputStream, String charsetName) throws IOException {
char[] readBuffer = new char[1024];
InputStreamReader reader = null;
try {
reader = new InputStreamReader(inputStream, charsetName);
StringBuilder builder = new StringBuilder();
int read = -1;
while ((read = reader.read(readBuffer)) != -1) {
builder.append(readBuffer, 0, read);
}
String s = builder.toString();
if (s.startsWith(UTF8_BOM)) {
s = s.substring(1);
}
return s;
} finally {
if (reader != null) {
reader.close();
}
}
}
}
| [
"[email protected]"
] | |
3eb06dbb7692923dee09fedbc67b6dd2c9e71a5c | f5bdd97532b1f4eafc6126e62946f9c516a637b0 | /app/src/test/java/com/example/jrb/udemyapp41/ExampleUnitTest.java | cb17c99b3622ee9e26d13b76e874998c4a161fa8 | [] | no_license | jatinrajbhatia/Radio-Checkbox-Seekbar-App | 8850313434d4b05a1e75a65b573a811096771bb4 | c001ce292e658e0cfdc9737c5cc1404ee65933b0 | refs/heads/master | 2020-03-19T03:15:26.497372 | 2018-06-01T11:39:08 | 2018-06-01T11:39:08 | 135,710,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.example.jrb.udemyapp41;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
8f76eb2623d73a715aa7b7a1aa392b3e30842031 | a8f959a4acfef9c079da0de6568a27b7a5272016 | /trunk/src/test/java/org/guzz/orm/sql/impl/TestInnerSQLBuilder.java | 476a0862dd15edc113294c760d5536823e242be3 | [] | no_license | fchunbo/guzz | a3c80d1abbdcf0a59e9268ab82ee0e529f15f64a | 137ec72238ca6239c0d37676f524b3b5d2c1a2fb | refs/heads/master | 2021-01-13T09:34:05.279698 | 2016-11-01T09:00:21 | 2016-11-01T09:00:21 | 72,519,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,988 | java | /*
* Copyright 2008-2009 the original author or authors.
*
* 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 org.guzz.orm.sql.impl;
import java.util.Arrays;
import org.guzz.GuzzContextImpl;
import org.guzz.io.FileResource;
import org.guzz.orm.Business;
import org.guzz.orm.mapping.POJOBasedObjectMapping;
import org.guzz.orm.sql.CompiledSQL;
import org.guzz.test.GuzzTestCase;
/**
*
*
*
* @author liukaixuan([email protected])
*/
public class TestInnerSQLBuilder extends GuzzTestCase {
public void testTranslateSQLMark() throws Exception{
POJOBasedObjectMapping map = (POJOBasedObjectMapping) gf.getObjectMappingManager().getStaticObjectMapping("user") ;
CompiledSQLManagerImpl csm = new CompiledSQLManagerImpl(((GuzzContextImpl) gf).getCompiledSQLBuilder()) ;
//test insert
CompiledSQL cs = csm.buildNormalInsertSQLWithPK(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "insert into TB_USER(pk, userName, MyPSW, VIP_USER, FAV_COUNT, createdTime) values(?, ?, ?, ?, ?, ?)") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 6) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[id, userName, password, vip, favCount, createdTime]") ;
cs = csm.buildNormalInsertSQLWithoutPK(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "insert into TB_USER(userName, MyPSW, VIP_USER, FAV_COUNT, createdTime) values(?, ?, ?, ?, ?)") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 5) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[userName, password, vip, favCount, createdTime]") ;
//update
cs = csm.buildNormalUpdateSQL(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "update TB_USER set userName=?, MyPSW=?, VIP_USER=?, FAV_COUNT=?, createdTime=? where pk=?") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 6) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[userName, password, vip, favCount, createdTime, id]") ;
//delete
cs = csm.buildNormalDeleteSQL(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "delete from TB_USER where pk=?") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 1) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[id]") ;
//select
cs = csm.buildNormalSelectSQL(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "select pk, userName, MyPSW, VIP_USER, FAV_COUNT, createdTime from TB_USER where pk=?") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 1) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[id]") ;
}
public void testInsertUpdateIgnoreParam() throws Exception{
Business ga = gf.instanceNewGhost("articleCount", null, null, null) ;
gf.addHbmConfigFile(ga, FileResource.CLASS_PATH_PREFIX + "org/guzz/test/ArticleCount.hbm.xml") ;
POJOBasedObjectMapping map = (POJOBasedObjectMapping) gf.getObjectMappingManager().getStaticObjectMapping("articleCount") ;
CompiledSQLManagerImpl csm = new CompiledSQLManagerImpl(((GuzzContextImpl) gf).getCompiledSQLBuilder()) ;
//test insert
CompiledSQL cs = csm.buildNormalInsertSQLWithPK(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "insert into TB_ARTICLE_COUNT(ARTICLE_ID, readCount, createdTime) values(?, ?, ?)") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 3) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[articleId, readCount, createdTime]") ;
cs = csm.buildNormalInsertSQLWithoutPK(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "insert into TB_ARTICLE_COUNT(readCount, createdTime) values(?, ?)") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 2) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[readCount, createdTime]") ;
//update
cs = csm.buildNormalUpdateSQL(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "update TB_ARTICLE_COUNT set supportCount=?, opposeCount=?, createdTime=? where ARTICLE_ID=?") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 4) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[supportCount, opposeCount, createdTime, articleId]") ;
//delete
cs = csm.buildNormalDeleteSQL(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "delete from TB_ARTICLE_COUNT where ARTICLE_ID=?") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 1) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[articleId]") ;
//select
cs = csm.buildNormalSelectSQL(map) ;
assertEquals(cs.bindNoParams().getSQLToRun(), "select ARTICLE_ID, readCount, supportCount, opposeCount, createdTime from TB_ARTICLE_COUNT where ARTICLE_ID=?") ;
assertEquals(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams().length, 1) ;
assertEquals(Arrays.asList(cs.bindNoParams().getCompiledSQLToRun().getOrderedParams()).toString(), "[articleId]") ;
}
protected void setUp() throws Exception {
super.buildGF() ;
}
}
| [
"[email protected]"
] | |
705e1d7648bfcedab2c1bf4a1dc1fde339b08c2a | dd590f7bf803948880058bdd2610bcf14eb69bac | /mymeishinew/src/main/java/commeishi/shanjing/mymeishi/utils/HtmlText.java | fc814488b1c54ecf44afe310138982e090c1037b | [] | no_license | cuiwenju2017/jtlife-food | f3b9784469f321c88fddd773ffb58849df73d901 | c148eb6760727f9741e591ac049065a4178e7bb3 | refs/heads/master | 2020-08-26T15:50:01.775544 | 2019-10-23T13:16:26 | 2019-10-23T13:16:26 | 217,061,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,162 | java | package commeishi.shanjing.mymeishi.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 过滤掉html标签的工具类
*/
public class HtmlText {
public static String delHTMLTag(String htmlStr) {
String regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>"; //定义script的正则表达式
String regEx_style = "<style[^>]*?>[\\s\\S]*?<\\/style>"; //定义style的正则表达式
String regEx_html = "<[^>]+>"; //定义HTML标签的正则表达式
Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
Matcher m_script = p_script.matcher(htmlStr);
htmlStr = m_script.replaceAll(""); //过滤script标签
Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
Matcher m_style = p_style.matcher(htmlStr);
htmlStr = m_style.replaceAll(""); //过滤style标签
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll(""); //过滤html标签
return htmlStr.trim(); //返回文本字符串
}
}
| [
"[email protected]"
] | |
aceee79b4c5a18c20a6e282af7bcbe5f769ed984 | cf0f34937b476ecde5ebcca7e2119bcbb27cfbf2 | /src/com/sdses/struts/pos/action/T30500Action.java | bd41e159bb767c0920b35dedb93cf92f07b764b5 | [] | no_license | Deron84/xxxTest | b5f38cc2dfe3fe28b01634b58b1236b7ec5b4854 | 302b807f394e31ac7350c5c006cb8dc334fc967f | refs/heads/master | 2022-02-01T03:32:54.689996 | 2019-07-23T11:04:09 | 2019-07-23T11:04:09 | 198,212,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,384 | java | package com.sdses.struts.pos.action;
import java.util.ArrayList;
import java.util.List;
import com.huateng.common.Constants;
import com.huateng.common.ErrorCode;
import com.huateng.struts.system.action.BaseAction;
import com.huateng.system.util.BeanUtils;
import com.huateng.system.util.ContextUtil;
import com.sdses.bo.pos.T30500BO;
import com.sdses.po.TblVegeCodeInfo;
/**
* Title:机构维护
*
* Description:
*
* Copyright: Copyright (c) 2010-6-7
*
* Company: Shanghai Huateng Software Systems Co., Ltd.
*
* @author
*
* @version 1.0
*/
public class T30500Action extends BaseAction {
private static final long serialVersionUID = 1L;
//
//
//菜品编码表BO
private T30500BO t30500BO = (T30500BO) ContextUtil.getBean("T30500BO");
//菜品编码
private String vegCode;
//菜品名称
private String vegName;
// 菜品列表
private String vegDataList;
@Override
protected String subExecute() {
try {
if ("add".equals(getMethod())) {
rspCode = add();
} else if ("delete".equals(getMethod())) {
rspCode = delete();
} else if ("update".equals(getMethod())) {
rspCode = update();
}
} catch (Exception e) {
log("操作员编号:" + operator.getOprId() + ",对机构的维护操作" + getMethod() + "失败,失败原因为:" + e.getMessage());
}
return rspCode;
}
/**
* 添加机构信息
* @throws Exception
*/
private String add() throws Exception {
TblVegeCodeInfo vegeCodeInfo = new TblVegeCodeInfo();
vegeCodeInfo.setVegCode(vegCode);
vegeCodeInfo.setVegName(vegName);
// 判断菜品编码是否存在
if (t30500BO.get(getVegCode()) != null) {
return ErrorCode.T30500_01;
}
// 判断菜品名称是否存在
List<Object[]> lists = t30500BO.findListByName(vegName);
if (lists != null && lists.size() > 0) {
return ErrorCode.T30500_02;
}
t30500BO.add(vegeCodeInfo);
return Constants.SUCCESS_CODE;
}
/**
*
* //TODO 删除所选的条目信息
*
* @return
* @throws Exception
* @author hanyongqing
*/
@SuppressWarnings("unchecked")
private String delete() throws Exception {
String sql2 = " select * from VEGE_CODE_FOR_MCHT t where t.Vege_Code = '" + getVegCode() + "'";
List<Object[]> dataList2 = commQueryDAO.findBySQLQuery(sql2);
//是否存在此条记录
if (dataList2.size() > 0) {
return ErrorCode.T30500_04;
}
String sql = "select VEGE_CODE,VEGE_NAME from vege_code_base where VEGE_CODE = '" + getVegCode() + "' ";
List<Object[]> dataList = commQueryDAO.findBySQLQuery(sql);
//是否存在此条记录
if (dataList.size() <= 0) {
return ErrorCode.T30500_03;
}
TblVegeCodeInfo vegeCodeInfo = new TblVegeCodeInfo();
for (Object[] obj : dataList) {
vegeCodeInfo.setVegCode(obj[0].toString());
vegeCodeInfo.setVegName(obj[1].toString());
}
//删除机构信息
t30500BO.delete(vegeCodeInfo);
// reloadOprBrhInfo();
return Constants.SUCCESS_CODE;
}
/**
*
* //TODO 更新菜品信息
*
* @return
* @throws Exception
*/
private String update() throws Exception {
jsonBean.parseJSONArrayData(getVegDataList());
int len = jsonBean.getArray().size();
List<TblVegeCodeInfo> vegeInfoList = new ArrayList<TblVegeCodeInfo>();
for (int i = 0; i < len; i++) {
jsonBean.setObject(jsonBean.getJSONDataAt(i));
TblVegeCodeInfo vegeInfo = new TblVegeCodeInfo();
BeanUtils.setObjectWithPropertiesValue(vegeInfo, jsonBean, true);
String sql2 = " select * from VEGE_CODE_FOR_MCHT t where t.Vege_Code = '" + vegeInfo.getVegCode() + "'";
List<Object[]> dataList2 = commQueryDAO.findBySQLQuery(sql2);
//是否存在此条记录
if (dataList2.size() > 0) {
return "该菜品已经使用,无法修改";
}
//判断机构名称是否存在
List<Object[]> lists = t30500BO.findListByName(vegeInfo.getVegName());
if (lists != null && lists.size() > 0) {
return ErrorCode.T30500_02;
}
vegeInfoList.add(vegeInfo);
}
t30500BO.update(vegeInfoList);
return Constants.SUCCESS_CODE;
}
public String getVegCode() {
return vegCode;
}
public void setVegCode(String vegCode) {
this.vegCode = vegCode;
}
public String getVegName() {
return vegName;
}
public void setVegName(String vegName) {
this.vegName = vegName;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public T30500BO getT30500BO() {
return t30500BO;
}
public void setT30500BO(T30500BO t30500bo) {
t30500BO = t30500bo;
}
public String getVegDataList() {
return vegDataList;
}
public void setVegDataList(String vegDataList) {
this.vegDataList = vegDataList;
}
}
| [
"[email protected]"
] | |
42a9804ae3f1a546955cd89362b1dc468cf5f461 | f1303f0264cbbfcecb98fbf8fb61f271aad38711 | /MiKandi-Developer-Tools-v0_01/src/com/mikandi/mikandidevelopertools/MainActivity.java | b3bea16aa42d34c953cfc17c856cb755dace35ed | [] | no_license | djcarlinwa/mikandi_developer_tools | b4126ae4313730d8d3ae362685f9f0a31889a123 | 1ed6f309e8220f3376cef4936744f678777ea710 | refs/heads/master | 2020-04-13T14:02:04.606116 | 2014-03-27T21:52:54 | 2014-03-27T21:52:54 | 18,217,695 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,022 | java | package com.mikandi.mikandidevelopertools;
import android.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// new DefaultJSONAsyncTask<PricePoint>(PricePoint.class, this, this, GetDeviceAndUserInfo.getDefaultArgs(this)).execute();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
return rootView;
}
}
}
| [
"[email protected]"
] | |
d9db88c814d4ee471fb55d5514687ba78a2156ea | e0a3fbb221d16f391991095e842c8c4b09b332f6 | /plugins/com.zeligsoft.base.ui/src/com/zeligsoft/base/ui/providers/ZDLIconProvider.java | 94b5de9dc3ad8863a12854fe1cadaea90be78ce6 | [
"Apache-2.0"
] | permissive | ZeligsoftDev/DomainDevKit | e95ac78159730eb2ab938893f8dba67f07218d4a | 8eb7d8b87ab2f904588e191aee49dca8083fe9db | refs/heads/master | 2022-07-28T17:13:16.140038 | 2021-10-07T20:44:45 | 2021-10-07T20:44:45 | 269,425,565 | 3 | 1 | Apache-2.0 | 2020-06-09T14:40:58 | 2020-06-04T17:42:21 | Java | UTF-8 | Java | false | false | 2,274 | java | /*******************************************************************************
* Copyright (c) 2020 Northrop Grumman Systems Corporation.
*
* 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.zeligsoft.base.ui.providers;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.common.ui.services.icon.IIconOperation;
import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
import org.eclipse.swt.graphics.Image;
import com.zeligsoft.base.ui.utils.ZDLImageRegistry;
/**
* An icon provider that gets icons for model elements according to their
* defining ZDL concept.
*
* @author Christian W. Damus (cdamus)
*/
public class ZDLIconProvider
extends AbstractProvider
implements IIconProvider {
/**
* Initializes me.
*/
public ZDLIconProvider() {
super();
}
@Override
public Image getIcon(IAdaptable hint, int flags) {
Image result = null;
EObject modelElement = (hint == null)
? null
: (EObject) hint.getAdapter(EObject.class);
if (modelElement != null) {
result = ZDLImageRegistry.getInstance().getZDLIcon(modelElement);
}
return result;
}
@Override
public boolean provides(IOperation operation) {
boolean result = false;
if (operation instanceof IIconOperation) {
IIconOperation iconOp = (IIconOperation) operation;
IAdaptable hint = iconOp.getHint();
result = (hint != null) && (getIcon(hint, 0) != null);
}
return result;
}
}
| [
"[email protected]"
] | |
40fdb6d44b03445548a2adf5f77785a8068ddea8 | 4249c1fedbc8b5c1cb64944c6215a8afab53191b | /spring-boot-project/spring-boot-docker-compose/src/main/java/org/springframework/boot/docker/compose/core/ImageName.java | 931ce4d2272cae40c24045220195e9acb6218f30 | [
"Apache-2.0"
] | permissive | spring-projects/spring-boot | f4c00f6ebe9ea402e774bec820a327811c93f352 | b1547d0139050ae1517ec6fc37b098d437332022 | refs/heads/main | 2023-09-01T08:03:41.170713 | 2023-09-01T05:38:29 | 2023-09-01T05:38:29 | 6,296,790 | 77,684 | 47,977 | Apache-2.0 | 2023-09-14T17:44:37 | 2012-10-19T15:02:57 | Java | UTF-8 | Java | false | false | 3,401 | java | /*
* Copyright 2012-2023 the original author or authors.
*
* 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
*
* https://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.springframework.boot.docker.compose.core;
import org.springframework.util.Assert;
/**
* A Docker image name of the form {@literal "docker.io/library/ubuntu"}.
*
* @author Phillip Webb
* @author Scott Frederick
*/
class ImageName {
private static final String DEFAULT_DOMAIN = "docker.io";
private static final String OFFICIAL_REPOSITORY_NAME = "library";
private static final String LEGACY_DOMAIN = "index.docker.io";
private final String domain;
private final String name;
private final String string;
ImageName(String domain, String path) {
Assert.hasText(path, "Path must not be empty");
this.domain = getDomainOrDefault(domain);
this.name = getNameWithDefaultPath(this.domain, path);
this.string = this.domain + "/" + this.name;
}
/**
* Return the domain for this image name.
* @return the domain
*/
String getDomain() {
return this.domain;
}
/**
* Return the name of this image.
* @return the image name
*/
String getName() {
return this.name;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ImageName other = (ImageName) obj;
boolean result = true;
result = result && this.domain.equals(other.domain);
result = result && this.name.equals(other.name);
return result;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + this.domain.hashCode();
result = prime * result + this.name.hashCode();
return result;
}
@Override
public String toString() {
return this.string;
}
private String getDomainOrDefault(String domain) {
if (domain == null || LEGACY_DOMAIN.equals(domain)) {
return DEFAULT_DOMAIN;
}
return domain;
}
private String getNameWithDefaultPath(String domain, String name) {
if (DEFAULT_DOMAIN.equals(domain) && !name.contains("/")) {
return OFFICIAL_REPOSITORY_NAME + "/" + name;
}
return name;
}
static String parseDomain(String value) {
int firstSlash = value.indexOf('/');
String candidate = (firstSlash != -1) ? value.substring(0, firstSlash) : null;
if (candidate != null && Regex.DOMAIN.matcher(candidate).matches()) {
return candidate;
}
return null;
}
static ImageName of(String value) {
Assert.hasText(value, "Value must not be empty");
String domain = parseDomain(value);
String path = (domain != null) ? value.substring(domain.length() + 1) : value;
Assert.isTrue(Regex.PATH.matcher(path).matches(),
() -> "Unable to parse name \"" + value + "\". "
+ "Image name must be in the form '[domainHost:port/][path/]name', "
+ "with 'path' and 'name' containing only [a-z0-9][.][_][-]");
return new ImageName(domain, path);
}
}
| [
"[email protected]"
] | |
6d57029a84ad0edc8034e2aef40a990e276be4ed | 8ad79f1da587b676c44279da8bf4da7d31081dac | /backend/src/main/java/org/ludus/backend/datastructures/tuple/ImmutableQuadruple.java | 7469a423c6d911c0fb81f18576e3f1c8045bc3d0 | [
"MIT"
] | permissive | bvdsanden/ludus | 529975945c74671a5c2f302bdc8042486a594ca3 | 665312b861cdc4afd285321f0bf26b95ba4f3571 | refs/heads/master | 2021-09-09T11:10:37.165871 | 2018-03-15T13:04:33 | 2018-03-15T13:04:33 | 113,227,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,568 | java | package org.ludus.backend.datastructures.tuple;
import java.util.Objects;
/**
* @author Bram van der Sanden
*/
public final class ImmutableQuadruple<L, ML, MR, R> extends Quadruple<L, ML, MR, R> {
/**
* Serialization version
*/
private static final long serialVersionUID = 1L;
/**
* Left object
*/
public final L left;
/**
* Middle object
*/
public final ML middleLeft;
public final MR middleRight;
/**
* Right object
*/
public final R right;
/**
* <p>Obtains an immutable triple of from three objects inferring the generic types.</p>
* <p>
* <p>This factory allows the triple to be created using inference to
* obtain the generic types.</p>
*
* @param <L> the left element type
* @param <ML> the middle left element type
* @param <MR> the middle right element type
* @param <R> the right element type
* @param left the left element, may be null
* @param middleLeft the middle left element, may be null
* @param middleRight the middle right element, may be null
* @param right the right element, may be null
* @return a triple formed from the three parameters, not null
*/
public static <L, ML, MR, R> ImmutableQuadruple<L, ML, MR, R> of(final L left, final ML middleLeft, final MR middleRight, final R right) {
return new ImmutableQuadruple<>(left, middleLeft, middleRight, right);
}
/**
* Create a new triple instance.
*
* @param left the left value, may be null
* @param middleLeft the middle left element, may be null
* @param middleRight the middle right element, may be null
* @param right the right value, may be null
*/
public ImmutableQuadruple(final L left, final ML middleLeft, final MR middleRight, final R right) {
super();
this.left = left;
this.middleLeft = middleLeft;
this.middleRight = middleRight;
this.right = right;
}
//-----------------------------------------------------------------------
/**
* {@inheritDoc}
*/
@Override
public L getLeft() {
return left;
}
/**
* {@inheritDoc}
*/
@Override
public ML getMiddleLeft() {
return middleLeft;
}
/**
* {@inheritDoc}
*/
@Override
public MR getMiddleRight() {
return middleRight;
}
/**
* {@inheritDoc}
*/
@Override
public R getRight() {
return right;
}
@Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + Objects.hashCode(this.left);
hash = 97 * hash + Objects.hashCode(this.middleLeft);
hash = 97 * hash + Objects.hashCode(this.middleRight);
hash = 97 * hash + Objects.hashCode(this.right);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ImmutableQuadruple<?, ?, ?, ?> other = (ImmutableQuadruple<?, ?, ?, ?>) obj;
if (!Objects.equals(this.left, other.left)) {
return false;
}
if (!Objects.equals(this.middleLeft, other.middleLeft)) {
return false;
}
if (!Objects.equals(this.middleRight, other.middleRight)) {
return false;
}
return Objects.equals(this.right, other.right);
}
}
| [
"[email protected]"
] | |
04762371dec1ec58ecc6c029ce9ae96bb7c21c61 | fea683c0ec66ff872b001f39fba4bd0f5a772176 | /jpuppeteer-cdp/src/main/java/jpuppeteer/cdp/cdp/entity/page/PrintToPDFResponse.java | 73d9145920e12b6fdce195c819a382a80fee40ef | [] | no_license | affjerry/jpuppeteer | c343f64636eabdf5c3da52b6c0d660054d837894 | 5dbd900862035b4403b975f91f1b18938b19f08b | refs/heads/master | 2023-08-15T23:45:39.292666 | 2020-05-27T01:48:41 | 2020-05-27T01:48:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package jpuppeteer.cdp.cdp.entity.page;
/**
*/
@lombok.Setter
@lombok.Getter
@lombok.ToString
public class PrintToPDFResponse {
/**
* Base64-encoded pdf data. Empty if |returnAsStream| is specified.
*/
private String data;
/**
* A handle of the stream that holds resulting PDF data.
*/
private String stream;
} | [
"[email protected]"
] | |
a78eb9ba77bf59b0f84d00ec144b12bc0e2462bc | 8afd3df6ebd50466687db6d44641b74181aece1a | /src/com/badlogic/gdx/input/RemoteInput.java | 70479fcfd58628edcc627c053f3865786fd6f281 | [] | no_license | GabrielJadderson/Nightplanet-Game | c69cdaf4d6c664f4ed392d3f9fc5b53b102167a6 | d5d05fa5d91f394b1067c1dc6cb148ce27fb19b3 | refs/heads/master | 2022-06-22T10:35:33.550747 | 2022-06-18T22:04:55 | 2022-06-18T22:04:55 | 105,397,174 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,315 | java | /*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* 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.badlogic.gdx.input;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Input.TextInputListener;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.IntSet;
/** <p>
* An {@link Input} implementation that receives touch, key, accelerometer and compass events from a remote Android device. Just
* instantiate it and specify the port it should listen on for incoming connections (default 8190). Then store the new RemoteInput
* instance in Gdx.input. That's it.
* </p>
*
* <p>
* On your Android device you can use the gdx-remote application available on the Google Code page as an APK or in SVN
* (extensions/gdx-remote). Open it, specify the IP address and the port of the PC your libgdx app is running on and then tap
* away.
* </p>
*
* <p>
* The touch coordinates will be translated to the desktop window's coordinate system, no matter the orientation of the device
* </p>
*
* @author mzechner */
public class RemoteInput implements Runnable, Input {
public interface RemoteInputListener {
void onConnected ();
void onDisconnected ();
}
class KeyEvent {
static final int KEY_DOWN = 0;
static final int KEY_UP = 1;
static final int KEY_TYPED = 2;
long timeStamp;
int type;
int keyCode;
char keyChar;
}
class TouchEvent {
static final int TOUCH_DOWN = 0;
static final int TOUCH_UP = 1;
static final int TOUCH_DRAGGED = 2;
long timeStamp;
int type;
int x;
int y;
int pointer;
}
class EventTrigger implements Runnable {
TouchEvent touchEvent;
KeyEvent keyEvent;
public EventTrigger (TouchEvent touchEvent, KeyEvent keyEvent) {
this.touchEvent = touchEvent;
this.keyEvent = keyEvent;
}
@Override
public void run () {
justTouched = false;
if (keyJustPressed) {
keyJustPressed = false;
for (int i = 0; i < justPressedKeys.length; i++) {
justPressedKeys[i] = false;
}
}
if (processor != null) {
if (touchEvent != null) {
touchX[touchEvent.pointer] = touchEvent.x;
touchY[touchEvent.pointer] = touchEvent.y;
switch (touchEvent.type) {
case TouchEvent.TOUCH_DOWN:
processor.touchDown(touchEvent.x, touchEvent.y, touchEvent.pointer, Input.Buttons.LEFT);
isTouched[touchEvent.pointer] = true;
justTouched = true;
break;
case TouchEvent.TOUCH_UP:
processor.touchUp(touchEvent.x, touchEvent.y, touchEvent.pointer, Input.Buttons.LEFT);
isTouched[touchEvent.pointer] = false;
break;
case TouchEvent.TOUCH_DRAGGED:
processor.touchDragged(touchEvent.x, touchEvent.y, touchEvent.pointer);
break;
}
}
if (keyEvent != null) {
switch (keyEvent.type) {
case KeyEvent.KEY_DOWN:
processor.keyDown(keyEvent.keyCode);
if (!keys[keyEvent.keyCode]) {
keyCount++;
keys[keyEvent.keyCode] = true;
}
keyJustPressed = true;
justPressedKeys[keyEvent.keyCode] = true;
break;
case KeyEvent.KEY_UP:
processor.keyUp(keyEvent.keyCode);
if (keys[keyEvent.keyCode]) {
keyCount--;
keys[keyEvent.keyCode] = false;
}
break;
case KeyEvent.KEY_TYPED:
processor.keyTyped(keyEvent.keyChar);
break;
}
}
} else {
if (touchEvent != null) {
touchX[touchEvent.pointer] = touchEvent.x;
touchY[touchEvent.pointer] = touchEvent.y;
if (touchEvent.type == TouchEvent.TOUCH_DOWN) {
isTouched[touchEvent.pointer] = true;
justTouched = true;
}
if (touchEvent.type == TouchEvent.TOUCH_UP) {
isTouched[touchEvent.pointer] = false;
}
}
if (keyEvent != null) {
if (keyEvent.type == KeyEvent.KEY_DOWN) {
if (!keys[keyEvent.keyCode]) {
keyCount++;
keys[keyEvent.keyCode] = true;
}
keyJustPressed = true;
justPressedKeys[keyEvent.keyCode] = true;
}
if (keyEvent.type == KeyEvent.KEY_UP) {
if (keys[keyEvent.keyCode]) {
keyCount--;
keys[keyEvent.keyCode] = false;
}
}
}
}
}
}
public static int DEFAULT_PORT = 8190;
private ServerSocket serverSocket;
private float[] accel = new float[3];
private float[] gyrate = new float[3];
private float[] compass = new float[3];
private boolean multiTouch = false;
private float remoteWidth = 0;
private float remoteHeight = 0;
private boolean connected = false;
private RemoteInputListener listener;
int keyCount = 0;
boolean[] keys = new boolean[256];
boolean keyJustPressed = false;
boolean[] justPressedKeys = new boolean[256];
int[] touchX = new int[20];
int[] touchY = new int[20];
boolean isTouched[] = new boolean[20];
boolean justTouched = false;
InputProcessor processor = null;
private final int port;
public final String[] ips;
public RemoteInput () {
this(DEFAULT_PORT);
}
public RemoteInput (RemoteInputListener listener) {
this(DEFAULT_PORT, listener);
}
public RemoteInput (int port) {
this(port, null);
}
public RemoteInput (int port, RemoteInputListener listener) {
this.listener = listener;
try {
this.port = port;
serverSocket = new ServerSocket(port);
Thread thread = new Thread(this);
thread.setDaemon(true);
thread.start();
InetAddress[] allByName = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
ips = new String[allByName.length];
for (int i = 0; i < allByName.length; i++) {
ips[i] = allByName[i].getHostAddress();
}
} catch (Exception e) {
throw new GdxRuntimeException("Couldn't open listening socket at port '" + port + "'", e);
}
}
@Override
public void run () {
while (true) {
try {
connected = false;
if (listener != null) listener.onDisconnected();
System.out.println("listening, port " + port);
Socket socket = null;
socket = serverSocket.accept();
socket.setTcpNoDelay(true);
socket.setSoTimeout(3000);
connected = true;
if (listener != null) listener.onConnected();
DataInputStream in = new DataInputStream(socket.getInputStream());
multiTouch = in.readBoolean();
while (true) {
int event = in.readInt();
KeyEvent keyEvent = null;
TouchEvent touchEvent = null;
switch (event) {
case RemoteSender.ACCEL:
accel[0] = in.readFloat();
accel[1] = in.readFloat();
accel[2] = in.readFloat();
break;
case RemoteSender.COMPASS:
compass[0] = in.readFloat();
compass[1] = in.readFloat();
compass[2] = in.readFloat();
break;
case RemoteSender.SIZE:
remoteWidth = in.readFloat();
remoteHeight = in.readFloat();
break;
case RemoteSender.GYRO:
gyrate[0] = in.readFloat();
gyrate[1] = in.readFloat();
gyrate[2] = in.readFloat();
break;
case RemoteSender.KEY_DOWN:
keyEvent = new KeyEvent();
keyEvent.keyCode = in.readInt();
keyEvent.type = KeyEvent.KEY_DOWN;
break;
case RemoteSender.KEY_UP:
keyEvent = new KeyEvent();
keyEvent.keyCode = in.readInt();
keyEvent.type = KeyEvent.KEY_UP;
break;
case RemoteSender.KEY_TYPED:
keyEvent = new KeyEvent();
keyEvent.keyChar = in.readChar();
keyEvent.type = KeyEvent.KEY_TYPED;
break;
case RemoteSender.TOUCH_DOWN:
touchEvent = new TouchEvent();
touchEvent.x = (int)((in.readInt() / remoteWidth) * Gdx.graphics.getWidth());
touchEvent.y = (int)((in.readInt() / remoteHeight) * Gdx.graphics.getHeight());
touchEvent.pointer = in.readInt();
touchEvent.type = TouchEvent.TOUCH_DOWN;
break;
case RemoteSender.TOUCH_UP:
touchEvent = new TouchEvent();
touchEvent.x = (int)((in.readInt() / remoteWidth) * Gdx.graphics.getWidth());
touchEvent.y = (int)((in.readInt() / remoteHeight) * Gdx.graphics.getHeight());
touchEvent.pointer = in.readInt();
touchEvent.type = TouchEvent.TOUCH_UP;
break;
case RemoteSender.TOUCH_DRAGGED:
touchEvent = new TouchEvent();
touchEvent.x = (int)((in.readInt() / remoteWidth) * Gdx.graphics.getWidth());
touchEvent.y = (int)((in.readInt() / remoteHeight) * Gdx.graphics.getHeight());
touchEvent.pointer = in.readInt();
touchEvent.type = TouchEvent.TOUCH_DRAGGED;
break;
}
Gdx.app.postRunnable(new EventTrigger(touchEvent, keyEvent));
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public boolean isConnected () {
return connected;
}
@Override
public float getAccelerometerX () {
return accel[0];
}
@Override
public float getAccelerometerY () {
return accel[1];
}
@Override
public float getAccelerometerZ () {
return accel[2];
}
@Override
public float getGyroscopeX () {
return gyrate[0];
}
@Override
public float getGyroscopeY () {
return gyrate[1];
}
@Override
public float getGyroscopeZ () {
return gyrate[2];
}
@Override
public int getX () {
return touchX[0];
}
@Override
public int getX (int pointer) {
return touchX[pointer];
}
@Override
public int getY () {
return touchY[0];
}
@Override
public int getY (int pointer) {
return touchY[pointer];
}
@Override
public boolean isTouched () {
return isTouched[0];
}
@Override
public boolean justTouched () {
return justTouched;
}
@Override
public boolean isTouched (int pointer) {
return isTouched[pointer];
}
@Override
public boolean isButtonPressed (int button) {
if (button != Buttons.LEFT) return false;
for (int i = 0; i < isTouched.length; i++)
if (isTouched[i]) return true;
return false;
}
@Override
public boolean isKeyPressed (int key) {
if (key == Input.Keys.ANY_KEY) {
return keyCount > 0;
}
if (key < 0 || key > 255) {
return false;
}
return keys[key];
}
@Override
public boolean isKeyJustPressed (int key) {
if (key == Input.Keys.ANY_KEY) {
return keyJustPressed;
}
if (key < 0 || key > 255) {
return false;
}
return justPressedKeys[key];
}
@Override
public void getTextInput (TextInputListener listener, String title, String text, String hint) {
Gdx.app.getInput().getTextInput(listener, title, text, hint);
}
@Override
public void setOnscreenKeyboardVisible (boolean visible) {
}
@Override
public void vibrate (int milliseconds) {
}
@Override
public void vibrate (long[] pattern, int repeat) {
}
@Override
public void cancelVibrate () {
}
@Override
public float getAzimuth () {
return compass[0];
}
@Override
public float getPitch () {
return compass[1];
}
@Override
public float getRoll () {
return compass[2];
}
@Override
public void setCatchBackKey (boolean catchBack) {
}
@Override
public boolean isCatchBackKey() {
return false;
}
@Override
public void setCatchMenuKey (boolean catchMenu) {
}
@Override
public boolean isCatchMenuKey () {
return false;
}
@Override
public void setInputProcessor (InputProcessor processor) {
this.processor = processor;
}
@Override
public InputProcessor getInputProcessor () {
return this.processor;
}
/** @return the IP addresses {@link RemoteSender} or gdx-remote should connect to. Most likely the LAN addresses if behind a NAT. */
public String[] getIPs () {
return ips;
}
@Override
public boolean isPeripheralAvailable (Peripheral peripheral) {
if (peripheral == Peripheral.Accelerometer) return true;
if (peripheral == Peripheral.Compass) return true;
if (peripheral == Peripheral.MultitouchScreen) return multiTouch;
return false;
}
@Override
public int getRotation () {
return 0;
}
@Override
public Orientation getNativeOrientation () {
return Orientation.Landscape;
}
@Override
public void setCursorCatched (boolean catched) {
}
@Override
public boolean isCursorCatched () {
return false;
}
@Override
public int getDeltaX () {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getDeltaX (int pointer) {
return 0;
}
@Override
public int getDeltaY () {
return 0;
}
@Override
public int getDeltaY (int pointer) {
return 0;
}
@Override
public void setCursorPosition (int x, int y) {
}
@Override
public long getCurrentEventTime () {
// TODO Auto-generated method stub
return 0;
}
@Override
public void getRotationMatrix (float[] matrix) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
198a139b43894acb1a35820efee90c72bb4a87a0 | 3f622e1e59c04dedf28634b6c32e7f8bfea02b86 | /Module 1/01 Core Java/01 editplusprograms/29-superclasstosubclass/SubclassObjectDemo.java | 9bbc0cb80619607633845f92d8e47e7b92495314 | [] | no_license | bijumedayil/Examples | 60abac3f25d82677666031ad4a0efb469f0b7e2c | ac06e421a75963288f01311902109c381c3ba103 | refs/heads/master | 2021-07-25T07:06:02.145734 | 2017-11-05T08:34:18 | 2017-11-05T08:34:18 | 109,561,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | class A
{
static
{
System.out.println("Inside A static block");
}
{
System.out.println("Inside A instance block");
}
A()
{
System.out.println("Inside A constructor");
}
void m1()
{
System.out.println("Inside A m1()");
}
};
class B extends A
{
static
{
System.out.println("Inside B static block");
}
{
System.out.println("Inside B instance block");
}
B()
{
System.out.println("Inside B constructor");
}
void m2()
{
System.out.println("Inside B m2()");
}
};
class SubclassObjectDemo
{
public static void main(String[] args)
{
System.out.println("Hello World!");
A a = new A();
a.m1();
B b = new B();
b.m1();
}
}
| [
"[email protected]"
] | |
cd85961b6d151f50579e194d5423e93ac88ade75 | 2bed82468de470e2708abaa4cb977c69889edc03 | /konf-core/src/test/java/com/uchuhimo/konf/AnonymousConfigSpec.java | 350cc78e808f90972e35a6b31b4199cea291c58d | [
"Apache-2.0"
] | permissive | untra/konf | c40bb1f6f0159be62c287bb4ba46ae0bb5de4076 | 71342f69fb6f363e717b4aaa61e048664fed1820 | refs/heads/master | 2022-12-28T06:51:51.252490 | 2020-10-13T08:06:44 | 2020-10-13T08:06:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | /*
* Copyright 2017-2020 the original author or authors.
*
* 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.uchuhimo.konf;
public class AnonymousConfigSpec {
public static Spec spec = new ConfigSpec() {};
}
| [
"[email protected]"
] | |
a998b72de8393ec4b8c0773ffad2a335c74a2e4c | 65f39c8d277d9ef41f3f03fd6f142c4bcfb4bf02 | /src/main/java/org/webseer/web/ajax/AddData.java | d7d031c85427c3e5752bf77abd253cf988a3c4ce | [] | no_license | rrlevering/webseer | 5e1a2783ca84f8aa82118a64f2fbb3b7120cfdae | 568e7a1ddbfc16b9edf855cd71115b88de9def11 | refs/heads/master | 2020-05-30T14:28:33.747493 | 2013-08-18T01:35:39 | 2013-08-18T01:35:39 | 34,219,163 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,339 | java | package org.webseer.web.ajax;
import java.io.IOException;
import java.io.Writer;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.webseer.bucket.BucketFactory;
import org.webseer.bucket.FileBucket;
import org.webseer.java.JavaTypeTranslator;
import org.webseer.model.meta.Bucket;
import org.webseer.transformation.OutputWriter;
import org.webseer.web.SeerServlet;
import com.google.gson.JsonObject;
public class AddData extends SeerServlet {
private static final long serialVersionUID = 1L;
@Override
protected void transactionalizedService(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
String data = getRequiredParameter(req, "newData");
String bucketPath = (String) getRequiredAttribute(req, "bucketPath");
BucketFactory factory = BucketFactory.getBucketFactory(getNeoService());
Bucket bucket = factory.getBucket(bucketPath);
if (bucket == null) {
bucket = new FileBucket(getNeoService(), bucketPath);
}
OutputWriter bucketWriter = bucket.getBucketWriter();
bucketWriter.writeData(JavaTypeTranslator.convertObject(data));
JsonObject response = new JsonObject();
Writer writer = resp.getWriter();
writer.write(response.toString());
writer.close();
}
}
| [
"[email protected]"
] | |
e597c8ee06143a709f458c78cfba3140344515a2 | 8792e62dc5b98b6d9857bd85250234297fdc4206 | /src/Util/DBUtil.java | 115f15bbba655ef6b1d9a7a9a330a925bac033d6 | [] | no_license | lspzwh/Task03 | 733b918e7bb3d0c64c6104568f8a08aad25972d8 | eef1069f69e1d1becc36d90f0da49d02aafcc58e | refs/heads/main | 2023-06-28T09:38:22.119990 | 2021-08-08T13:26:05 | 2021-08-08T13:26:05 | 393,968,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 866 | java | package Util;
import java.sql.*;
public class DBUtil {
static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost:3306/test1?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC";
private static final String username = "root";
private static final String password = "123456";
public static Connection open(){
try{
Class.forName(JDBC_DRIVER);
return DriverManager.getConnection(DB_URL,username,password);
}catch (Exception e){
e.printStackTrace();
}
return null;
}
public static void close(Connection connection){
if(connection!=null){
try {
connection.close();
}catch (SQLException e){
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
6519283f4f494cfa2773be2302960733521c0468 | 4c3d2c35e525dc25513d127d0c9bf58d3a6b6101 | /michailapostolou/src/com/mike/SAF/com/mike/SAF/Behavior.java | 1419f6858eea6e1f2fe81d3f175479b7e055936b | [] | no_license | tvdstorm/sea-of-saf | 13e01b744b3f883c8020d33d78edb2e827447ba2 | 6e6bb3ae8c7014b0b8c2cc5fea5391126ed9b2f1 | refs/heads/master | 2021-01-10T19:16:15.261630 | 2014-05-06T11:30:14 | 2014-05-06T11:30:14 | 33,249,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,619 | java | package com.mike.SAF;
import java.util.ArrayList;
import java.util.Vector;
import org.antlr.runtime.tree.Tree;
public class Behavior {
private ArrayList<String> conditions = new ArrayList<String>();
private ArrayList<String> moves = new ArrayList<String>();
private ArrayList<String> fight_moves = new ArrayList<String>();
public Behavior(ArrayList<String> conditions, ArrayList<String> moves, ArrayList<String> fight_moves){
this.conditions = conditions;
this.moves = moves;
this.fight_moves = fight_moves;
}
public Behavior(){
}
public Behavior(ArrayList<String> conditions){
this.conditions = conditions;
}
public void setConditions(ArrayList<String> conditions) {
this.conditions = conditions;
}
public void setMoves(ArrayList<String> moves) {
this.moves = moves;
}
public void setFight_moves(ArrayList<String> fightMoves) {
fight_moves = fightMoves;
}
public void addCondition(String condtion){
this.conditions.add(condtion);
}
public void addMove(String move){
this.moves.add(move);
}
public void addFight_move( String fight_move){
this.fight_moves.add(fight_move);
}
public void addCondition(ArrayList<String> condtion){
this.conditions.addAll(condtion);
}
public void addMove(ArrayList<String> move){
this.moves.addAll(move);
}
public void addFight_move(ArrayList<String> fight_move){
this.fight_moves.addAll(fight_move);
}
public ArrayList<String> getConditions() {
return conditions;
}
public ArrayList<String> getMoves() {
return moves;
}
public ArrayList<String> getFight_moves() {
return fight_moves;
}
} | [
"[email protected]@e25deb68-5119-325c-d63b-03bbf1c8524c"
] | [email protected]@e25deb68-5119-325c-d63b-03bbf1c8524c |
3630318a4095adcd8e34c3c42b3a410b1bbc256a | eb85a388e0125c6edbd20ee09616305d3eeb11c5 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/auxilary/dsls/autoauto/model/values/VariableReference.java | 2692cd8b49b3d4e68da0cd170ea1078207f428bb | [
"BSD-3-Clause"
] | permissive | TechSupportAgent/Robotics_2021_2022 | 1350fb89eebd8de7f80cc1961939a4f0aa30fabe | fa2caaeb03045b23443c07457fa02e1f2bf0b230 | refs/heads/master | 2023-08-28T21:27:45.858820 | 2021-10-12T23:07:36 | 2021-10-12T23:07:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,049 | java | package org.firstinspires.ftc.teamcode.auxilary.dsls.autoauto.model.values;
import org.firstinspires.ftc.teamcode.auxilary.dsls.autoauto.model.AutoautoProgram;
import org.firstinspires.ftc.teamcode.auxilary.dsls.autoauto.model.Location;
import org.firstinspires.ftc.teamcode.auxilary.dsls.autoauto.runtime.AutoautoRuntimeVariableScope;
import org.firstinspires.ftc.teamcode.auxilary.dsls.autoauto.runtime.errors.AutoautoNameException;
import org.jetbrains.annotations.NotNull;
public class VariableReference extends AutoautoValue {
String name;
public AutoautoPrimitive resolvedValue;
private Location location;
private AutoautoRuntimeVariableScope scope;
public static VariableReference H (String n) {
return new VariableReference(n);
}
public VariableReference(String n) {
this.name = n;
}
public String getName() {
return name;
}
public void loop() {
this.resolvedValue = scope.get(this.name);
if(this.resolvedValue == null) throw new AutoautoNameException("Unknown variable name " + this.name + AutoautoProgram.formatStack(location));
}
@NotNull
public AutoautoPrimitive getResolvedValue() {
return resolvedValue;
}
@Override
public String getString() {
return resolvedValue.getString();
}
@Override
public VariableReference clone() {
VariableReference c = new VariableReference(name);
c.setLocation(location);
return c;
}
public String toString() {
return "var<" + this.name + ">";
}
@Override
public AutoautoRuntimeVariableScope getScope() {
return scope;
}
@Override
public void setScope(AutoautoRuntimeVariableScope scope) {
this.scope = scope;
}
@Override
public Location getLocation() {
return location;
}
@Override
public void setLocation(Location location) {
this.location = location;
}
}
| [
"[email protected]"
] | |
3b8327c8631cf0b8c834cb9d2f336d3ea2346cd7 | f52f297c837c1e100971039b8a9be0612055fe22 | /app/src/androidTest/java/cheongs/washington/edu/bluetooth/ApplicationTest.java | 38ec0ae28a79ec396b7f29220f532a591a2caa80 | [] | no_license | seanhcheong/bluetooth | 2b7ba72670a11c0c23a043a4e2a9246448422303 | 52d3c01a8bb50bca4c41ae2dbe5096d5ea7a17d5 | refs/heads/master | 2021-01-10T04:55:02.331578 | 2015-06-01T19:49:34 | 2015-06-01T19:49:34 | 36,638,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package cheongs.washington.edu.bluetooth;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
] | |
0685cf229bb0709df360d90f1de1ef9754db0b95 | 523b1f8646c15cb02cca7668ababd9dc54308b22 | /Padrões de Projeto - Use a cabeça/Strategy/DuckProject/src/main/FlyNoWay.java | 46dc2c7f36668f3d49e3060328280a050c104e62 | [
"MIT"
] | permissive | joaopedronardari/COO-EACHUSP | 13d274d5893647c62dd358a6a059bd4661a2b02a | ea243117598003ba5e46e532e6ccc6bcf99a49db | refs/heads/master | 2021-01-20T05:52:25.926718 | 2014-07-28T04:12:51 | 2014-07-28T04:12:51 | 20,363,811 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package main;
public class FlyNoWay implements FlyBehavior {
@Override
public void fly() {
System.out.println("I can't fly!");
}
}
| [
"[email protected]"
] | |
9d1e4eeabc7b16b9f738e673212bcea16bbff825 | f20004687b953f2ab62452a12844485ad21d601c | /src/ville/servlet/AfficheMeteo.java | 67db3de788c762bb56ed16769773030a678b2c62 | [] | no_license | barkalma/API_REST_CLIENT | dd1a7c8cc41514222ff270d6f4f440567ab603f6 | 542a52f9e03ebcc2ae19e686412ad812ea5ff2ac | refs/heads/master | 2020-05-12T18:15:57.475959 | 2019-04-29T18:09:28 | 2019-04-29T18:09:28 | 181,540,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,831 | java | package ville.servlet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import javax.net.ssl.HttpsURLConnection;
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 javax.servlet.http.HttpSession;
import ville.bean.VilleMeteo;
/**
* Servlet implementation class AfficheMeteo
*/
@WebServlet("/AfficheMeteo")
public class AfficheMeteo extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AfficheMeteo() {
super();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String ville = request.getParameter("ville");
URL url = new URL("http://localhost:8181/villeFranceFind?value=" + URLEncoder.encode(ville, "UTF-8"));
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuilder response1 = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response1.append(inputLine);
}
in.close();
ville = response1.toString();
VilleMeteo villeMeteo = this.toVilleMeteo(ville);
URL urlMeteo = new URL("http://api.openweathermap.org/data/2.5/weather?" + "lat=" + villeMeteo.getLattitude().split("\"")[1] + "&lon="
+ villeMeteo.getLongitude().split("\"")[1] + "&APPID=06560519526bae616c17bb73cae22647");
HttpURLConnection conMeteo = (HttpURLConnection) urlMeteo.openConnection();
conMeteo.setRequestMethod("GET");
BufferedReader inMeteo = new BufferedReader(new InputStreamReader(conMeteo.getInputStream()));
String inputLineMeteo;
StringBuilder responseMeteo = new StringBuilder();
while ((inputLineMeteo = inMeteo.readLine()) != null) {
responseMeteo.append(inputLineMeteo);
}
inMeteo.close();
int debutTemps = responseMeteo.indexOf("weather");
int finTemps = responseMeteo.indexOf(",\"description\"");
int debutTemperature = responseMeteo.indexOf("temp\":");
int finTemperature = responseMeteo.indexOf(",\"pressure");
int debutIcone = responseMeteo.indexOf("\"weather\":[{");
int finIcone = responseMeteo.indexOf("],\"base\"");
String temps = responseMeteo.substring(debutTemps + 7, finTemps);
temps = temps.substring(temps.indexOf("main\":") + 7, temps.length() - 1);
String temperature = responseMeteo.substring(debutTemperature + 6, finTemperature);
String temperatureCelcius = kelvinToCelcius(temperature);
String icone = responseMeteo.substring(debutIcone + 12, finIcone);
String cheminIcone = "http://openweathermap.org/img/w/"
+ icone.substring(icone.indexOf("icon") + 7, icone.indexOf("}") - 1) + ".png";
String population = "Inconnu";
try {
URL urlPop = new URL("https://geo.api.gouv.fr/communes?codePostal="+ villeMeteo.getCodePostal().split("\"")[1] +"&fields=population");
HttpsURLConnection conPop = (HttpsURLConnection) urlPop.openConnection();
conPop.setRequestMethod("GET");
BufferedReader inPop = new BufferedReader(new InputStreamReader(conPop.getInputStream()));
String inputLinePop;
StringBuilder responsePop = new StringBuilder();
while ((inputLinePop = inPop.readLine()) != null) {
responsePop.append(inputLinePop);
}
inPop.close();
if (!("Not Found").equals(responsePop.toString())) {
population = responsePop.substring(responsePop.indexOf("population") + 12,
responsePop.indexOf(",\"nom\""));
} else {
population = "Inconnu";
}
} catch (Exception e) {
throw e;
}
HttpSession session = request.getSession();
villeMeteo.setTemperature(temperatureCelcius);
villeMeteo.setTemps(temps);
villeMeteo.setIdTemps(cheminIcone);
villeMeteo.setPop(population);
session.setAttribute("villeMeteo", villeMeteo);
this.getServletContext().getRequestDispatcher("/resultatMeteo.jsp").forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
private static String kelvinToCelcius(String temperature) {
Double celcius = Double.parseDouble(temperature) - 273.15;
DecimalFormat f = new DecimalFormat();
f.setMaximumFractionDigits(2);
return f.format(celcius);
}
public VilleMeteo toVilleMeteo(String villeString) {
VilleMeteo ville = new VilleMeteo();
villeString.replace(" ", "");
villeString.replace("[", "");
villeString.replace("]", "");
villeString.replace("\"", "");
String[] villepart = villeString.split(",");
String codeCommune = villepart[0].split(":")[1];
String nomCommune = villepart[1].split(":")[1];
String codePostal = villepart[2].split(":")[1];
String libelle = villepart[3].split(":")[1];
String ligne = "";
if (villepart[4].split(":").length == 2) {
ligne = villepart[4].split(":")[1];
}
String lattitude = villepart[5].split(":")[1];
String longitude = villepart[6].split(":")[1].split("}")[0];
longitude = longitude.split("]")[0];
ville.setCodeCommuneInsee(codeCommune);
ville.setNomCommune(nomCommune);
ville.setCodePostal(codePostal);
ville.setLibelleAcheminement(libelle);
ville.setLigne5(ligne);
ville.setLattitude(lattitude);
ville.setLongitude(longitude);
return ville;
}
}
| [
"[email protected]"
] | |
c2ac7882f05586c5b50e8bec55162379735836f4 | 0247ed0576c63f4237940d3e695bf09121a1cc93 | /src/com/igate/ems/controller/EmployeeController.java | 3bf21d4e0d60a911bf7457df77b6da7878685c46 | [] | no_license | siddy2181/EmployeeMaintenance | bdb6a4d1fbe486566cca989fd199bf2c529809e2 | 5580470dbbdb6ca64df26eb63515723339296b31 | refs/heads/master | 2021-05-10T14:41:47.663339 | 2018-01-26T02:00:18 | 2018-01-26T02:00:18 | 118,528,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,367 | java | package com.igate.ems.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
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.SessionAttributes;
import com.igate.ems.dto.Department;
import com.igate.ems.dto.Employee;
import com.igate.ems.dto.Grade;
import com.igate.ems.dto.User;
import com.igate.ems.exception.InvalidEmployeeDetails;
import com.igate.ems.service.IEmployeeMaintenanceService;
@Controller
@SessionAttributes(value = { "userName", "userType" })
public class EmployeeController {
@Autowired
IEmployeeMaintenanceService service;
static Logger emsLogger = Logger.getLogger(EmployeeController.class);
/**********************************************
* Globally Declaring checklist variables
***********************************************/
ArrayList<String> designation = new ArrayList<String>();
ArrayList<String> maritalStatus = new ArrayList<String>();
ArrayList<Department> departments = new ArrayList<Department>();
ArrayList<Grade> grades = new ArrayList<Grade>();
int size;
List<Employee> getAllEmployee = null;
String errorMsg = "";
//@formatter:off
/*******************************************************************************************
*ACTION : showHome *
*FROM : index.jsp *
*TO : homeEMS ; AdminHome ;EmployeeHome *
*DESCR : Gets Login Page *
*******************************************************************************************/
//@formatter:on
@RequestMapping(value = "showHome", method = RequestMethod.GET)
public String showHome(Model model, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
String userType = (String) session.getAttribute("userType");
if (userType != null) {
if (userType.equals("Admin")) {
return "AdminHome";
}
if (userType.equals("Employee")) {
return "EmployeeHome";
}
}
model.addAttribute("user", new User());
emsLogger.info("User Visited Home Page");
return "homeEMS";
}
//@formatter:off
/*******************************************************************************************
*ACTION : aboutUs *
*FROM : *
*TO : AboutUs *
*DESCR : displays the about us slider *
*******************************************************************************************/
//@formatter:on
@RequestMapping(value = "aboutUs")
public String aboutUs(Model model) {
emsLogger.info("User Visited AboutUs Page");
return "AboutUs";
}
//@formatter:off
/*******************************************************************************************
*ACTION : Gallery *
*FROM : *
*TO : Gallery *
*DESCR : displays the Employee Picture Gallery slider *
*******************************************************************************************/
//@formatter:on
@RequestMapping(value = "Gallery")
public String Gallery(Model model) {
emsLogger.info("User Visited Gallery Page");
return "Gallery";
}
/*
* @RequestMapping(value = "showLogin", method = RequestMethod.GET) public
* String showLogin(Model model) { model.addAttribute("user", new User());
* return "homeEMS.jsp#modal-login"; }
*/
//@formatter:off
/*******************************************************************************************
*ACTION : logout *
*FROM : *
*TO : homeEMS *
*DESCR : Logic for logging out *
*******************************************************************************************/
//@formatter:on
@RequestMapping(value = "logout", method = RequestMethod.GET)
public String loogout(Model model) {
model.addAttribute("userName", "");
model.addAttribute("userType", "");
model.addAttribute("user", new User());
emsLogger.info("User Logged Off");
return "homeEMS";
}
//@formatter:off
/**************************************************************************************************
*ACTION : validateLogin *
*FROM : *
*TO : errorPage ; homeEMS ; AdminHome ; EmployeeHome. *
*DESCR : Check and Validate Logging User if Admin or Employee and redirects to respective page. *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "validateLogin", method = RequestMethod.POST)
public String validateLogin(@ModelAttribute("user") User user, Model model) {
/*
* if (user.getUserName().equals("") || user.getUserName() == null) {
* errorMsg = "Invalid UserName or Password";
* model.addAttribute("errorMsg", errorMsg); return "homeEMS"; }
*/
try {
String userType = service.userLogin(user.getUserName(),
user.getPassword());
if (userType != null) {
departments.removeAll(departments);
Department dept = new Department();
dept.setDeptId(0);
dept.setDeptName("--");
departments.add(dept);
try {
departments.addAll(service.getDepartments());
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
designation.removeAll(designation);
designation.add("MANAGER");
designation.add("PROGRAMMER");
designation.add("TRAINEE");
designation.add("TECHIE");
maritalStatus.removeAll(maritalStatus);
maritalStatus.add("");
maritalStatus.add("Married");
maritalStatus.add("Unmarried");
maritalStatus.add("Widowed");
maritalStatus.add("Seperated");
maritalStatus.add("Divorced");
grades.removeAll(grades);
Grade grade = new Grade();
grade.setGradeCode("");
grade.setDescription("--");
grades.add(grade);
try {
grades.addAll(service.getGrades());
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
if (userType.equals("Admin")) {
model.addAttribute("userName", user.getUserName());
model.addAttribute("userType", userType);
emsLogger.info("User entered AdminHome Page");
return "AdminHome";
} else if (userType.equals("Employee")) {
model.addAttribute("userName", user.getUserName());
model.addAttribute("userType", userType);
emsLogger.info("User entered EmployeeHome Page");
return "EmployeeHome";
}
} else {
errorMsg = "Invalid UserName or Password";
model.addAttribute("errorMsg", errorMsg);
emsLogger
.info("User entered Invalid Details and was redirected to HomePage");
return "homeEMS";
}
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
return null;
}
//@formatter:off
/**************************************************************************************************
*ACTION : redirectAdminHome *
*FROM : *
*TO : AdminHome. *
*DESCR : redirects to admin home page. *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "redirectAdminHome", method = RequestMethod.GET)
public String redirectAdminHome() {
emsLogger.info("User redirected AdminHome Page");
return "AdminHome";
}
//@formatter:off
/**************************************************************************************************
*ACTION : redirectEmployeeHome *
*FROM : *
*TO : EmployeeHome. *
*DESCR : redirects to Employee Home page. *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "redirectEmployeeHome", method = RequestMethod.GET)
public String redirectEmployeeHome() {
emsLogger.info("User redirected to EmployeeHome Page");
return "EmployeeHome";
}
//@formatter:off
/**************************************************************************************************
*ACTION : showAddEmployee *
*FROM : *
*TO : AddEmployee. *
*DESCR : Displays Add Employee page and Adds an employee *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "showAddEmployee", method = RequestMethod.GET)
public String showAddEmployee(Model model) {
model.addAttribute("departments", departments);
model.addAttribute("designation", designation);
model.addAttribute("maritalStatus", maritalStatus);
model.addAttribute("empAdd", new Employee());
emsLogger.info("User visited AddEmployee Page");
return "AddEmployee";
}
//@formatter:off
/**************************************************************************************************
*ACTION : showViewAll *
*FROM : *
*TO : errorPage ; ShowAllEmployees. *
*DESCR : Displays 5 employees per page fetching from database *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "showViewAll", method = RequestMethod.GET)
public String viewAllEmployee(@RequestParam("page") int pageNo, Model model) {
/**********************************************
* Logic For Pagination
***********************************************/
List<Employee> empSub = null;
try {
if (pageNo == 0) {
getAllEmployee = service.viewAllEmployee();
size = getAllEmployee.size();
}
int start = 5 * pageNo;
if (size - start < 5) {
empSub = getAllEmployee.subList(start, size);
} else {
empSub = getAllEmployee.subList(start, start + 5);
}
} catch (InvalidEmployeeDetails | DataAccessException e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
model.addAttribute("size", size);
model.addAttribute("curPage", pageNo);
model.addAttribute("nextPage", pageNo + 1);
model.addAttribute("prePage", pageNo - 1);
if (size % 10 == 0) {
model.addAttribute("lastPage", (size / 5) - 1);
} else {
model.addAttribute("lastPage", size / 5);
}
model.addAttribute("EmployeeList", empSub);
emsLogger.info("User Viewed ShowAllEmployee Page");
return "ShowAllEmployees";
}
//@formatter:off
/**************************************************************************************************
*ACTION : addEmployee *
*FROM : *
*TO : errorPage ; AddEmployee ; InsertedPage . *
*DESCR : Adds an Employee and redirects to Inserted page which shows the details added *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "addEmployee", method = RequestMethod.POST)
public String addEmployee(@Valid @ModelAttribute("empAdd") Employee emp,
BindingResult bindResult, @RequestParam("doj") String doj,
@RequestParam("dob") String dob, Model model) {
int insertedDetails;
if (bindResult.hasErrors()) {
model.addAttribute("departments", departments);
model.addAttribute("designation", designation);
model.addAttribute("maritalStatus", maritalStatus);
return "AddEmployee";
} else {
try {
String empId = service.getEmpId();
emp.setEmpId(empId);
Grade grade = service.calGrade(emp.getBasic());
emp.setGrade(grade.getGradeCode());
emp.setDateOfBirth(dob);
emp.setDateOfJoining(doj);
insertedDetails = service.insertEmployee(emp);
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
model.addAttribute("inserted", emp);
emsLogger
.info("User added new Employee and was redirected to Inserted Page where new Employee Id and details were displayed");
return "InsertedPage";
}
}
//@formatter:off
/**************************************************************************************************
*ACTION : showSearchEmployee *
*FROM : *
*TO : SearchEmployee *
*DESCR : Redirects to Search Employee page *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "showSearchEmployee", method = RequestMethod.GET)
public String showSearchEmployee(Model model) {
model.addAttribute("departments", departments);
model.addAttribute("maritalStatus", maritalStatus);
model.addAttribute("grades", grades);
model.addAttribute("empSearch", new Employee());
emsLogger.info("User visited Search Employee Page");
return "SearchEmployee";
}
//@formatter:off
/**************************************************************************************************
*ACTION : searchEmployee *
*FROM : *
*TO : errorPage ; SearchEmployee. *
*DESCR : Searches an Employee using several wildcard entries *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "searchEmployee", method = RequestMethod.POST)
public String searchEmployee(@ModelAttribute("empSearch") Employee emp,
Model model) {
/******************************************************
*
* Logic to check if there are no entries for searching
*
********************************************************/
if (emp.getEmpId().equalsIgnoreCase("")
&& emp.getFirstName().equalsIgnoreCase("")
&& emp.getLastName().equalsIgnoreCase("")
&& Integer.parseInt(emp.getDeptId()) == 0
&& emp.getGrade().equalsIgnoreCase("")
&& emp.getMaritalStatus().equalsIgnoreCase("")) {
model.addAttribute("departments", departments);
model.addAttribute("maritalStatus", maritalStatus);
model.addAttribute("grades", grades);
model.addAttribute("empSearch", new Employee());
model.addAttribute("errorMsg", "Please Fill at least one field");
return "SearchEmployee";
}
/******************************************************
* Search by wildcard
********************************************************/
if (emp.getEmpId() == null || emp.getEmpId().equalsIgnoreCase("")) {
emp.setEmpId("%");
} else {
String empId = emp.getEmpId().replace("*", "%");
empId = empId.replace("?", "_");
emp.setEmpId(empId);
}
/******************************************************
* Search by first Name
********************************************************/
if (emp.getFirstName() == null
|| emp.getFirstName().equalsIgnoreCase("")) {
emp.setFirstName("%");
} else {
String fName = emp.getFirstName().replace("*", "%");
fName = fName.replace("?", "_");
emp.setFirstName(fName);
}
/******************************************************
* Search by last Name
********************************************************/
if (emp.getLastName() == null || emp.getLastName().equalsIgnoreCase("")) {
emp.setLastName("%");
} else {
String lName = emp.getLastName().replace("*", "%");
lName = lName.replace("?", "_");
emp.setLastName(lName);
}
/******************************************************
* Search by Department
********************************************************/
if (Integer.parseInt(emp.getDeptId()) == 0) {
emp.setDeptId("%");
}
/******************************************************
* Search by Grade
********************************************************/
if (emp.getGrade() == null || emp.getGrade().equalsIgnoreCase("")) {
emp.setGrade("%");
}
/******************************************************
* Search by Marital Status
********************************************************/
if (emp.getMaritalStatus() == null
|| emp.getMaritalStatus().equalsIgnoreCase("")) {
emp.setMaritalStatus("%");
}
ArrayList<Employee> emps = null;
try {
emps = service.searchEmployee(emp);
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
model.addAttribute("departments", departments);
model.addAttribute("maritalStatus", maritalStatus);
model.addAttribute("grades", grades);
model.addAttribute("empSearch", new Employee());
if (emps.size() != 0) {
model.addAttribute("emps", emps);
return "SearchResult";
} else {
model.addAttribute("departments", departments);
model.addAttribute("maritalStatus", maritalStatus);
model.addAttribute("grades", grades);
model.addAttribute("empSearch", new Employee());
model.addAttribute("errorMsg", "No data Found");
return "SearchEmployee";
}
}
//@formatter:off
/**************************************************************************************************
*ACTION : showUpdateEmployee *
*FROM : *
*TO : errorPage ; UpdationRequest. *
*DESCR : Redirects to UpdatION Page. *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "showUpdateEmployee", method = RequestMethod.GET)
public String showUpdateEmployee(Model model) {
ArrayList<String> empIds = null;
try {
empIds = service.getEmpIds();
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
model.addAttribute("empIds", empIds);
emsLogger.info("User requested for updation");
return "UpdationRequest";
}
//@formatter:off
/**************************************************************************************************
*ACTION : UpdateRequest *
*FROM : *
*TO : errorPage ; EmployeeUpdation. *
*DESCR : Options to select an employee to be updated . *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "UpdateRequest", method = RequestMethod.POST)
public String shoeUpdateForm(@RequestParam("selEmpId") String empId,
Model model) {
Employee emp = null;
try {
emp = service.searchByIdEmployee(empId);
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
model.addAttribute("departments", departments);
model.addAttribute("designation", designation);
model.addAttribute("maritalStatus", maritalStatus);
model.addAttribute("empUpdate", emp);
emsLogger.info("User Updation details were displayed");
return "EmployeeUpdation";
}
//@formatter:off
/*************************************************************************************************
*ACTION : UpdateEmployee *
*FROM : *
*TO : errorPage ; EmployeeUpdation ;AdminHome. *
*DESCR : Updates Employee Details. *
**************************************************************************************************/
//@formatter:on
@RequestMapping(value = "UpdateEmployee", method = RequestMethod.POST)
public String updateEmployee(
@Valid @ModelAttribute("empUpdate") Employee emp,
BindingResult bindResult, Model model) {
if (bindResult.hasErrors()) {
model.addAttribute("empUpdate", emp);
model.addAttribute("departments", departments);
model.addAttribute("designation", designation);
model.addAttribute("maritalStatus", maritalStatus);
return "EmployeeUpdation";
} else {
Grade grade = null;
try {
grade = service.calGrade(emp.getBasic());
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
emp.setGrade(grade.getGradeCode());
int rows = 0;
try {
rows = service.updateEmployee(emp);
} catch (InvalidEmployeeDetails e) {
model.addAttribute("errorMsg", e.getMessage());
return "errorPage";
}
emsLogger.info("User redirected to HomePage");
if (rows != 0) {
model.addAttribute("updated", 1);
model.addAttribute("empUpdate", emp);
model.addAttribute("departments", departments);
model.addAttribute("designation", designation);
model.addAttribute("maritalStatus", maritalStatus);
return "EmployeeUpdation";
} else {
return "AdminHome";
}
}
}
}
| [
"[email protected]"
] | |
a333d8430b8b8d4a3bf210597ecae26f4f99df1f | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-directconnect/src/main/java/com/amazonaws/services/directconnect/model/transform/AssociateHostedConnectionRequestProtocolMarshaller.java | 5db421cfc3a0f0e3ad50dc0f7ac1c5c727cce1b6 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 2,862 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.directconnect.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.directconnect.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* AssociateHostedConnectionRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class AssociateHostedConnectionRequestProtocolMarshaller implements
Marshaller<Request<AssociateHostedConnectionRequest>, AssociateHostedConnectionRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true)
.operationIdentifier("OvertureService.AssociateHostedConnection").serviceName("AmazonDirectConnect").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public AssociateHostedConnectionRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<AssociateHostedConnectionRequest> marshall(AssociateHostedConnectionRequest associateHostedConnectionRequest) {
if (associateHostedConnectionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<AssociateHostedConnectionRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(
SDK_OPERATION_BINDING, associateHostedConnectionRequest);
protocolMarshaller.startMarshalling();
AssociateHostedConnectionRequestMarshaller.getInstance().marshall(associateHostedConnectionRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
76d9064780a68dc24f3366ce66816dc041b21caa | 0e51c2fc9123e6b924d6930359c10d1bfc1a1b2d | /src/test/java/GeneralTests.java | 5fa7bdc3767721791eb63e12b004323ef9010e84 | [] | no_license | sivanl/GameOfLife | b01ca34447fa3c6c81cf1087c0977ff5d95c77e4 | ea643cdf82d51522132ec26f751cf4642e76027e | refs/heads/master | 2020-04-06T11:42:15.139069 | 2018-11-13T18:25:54 | 2018-11-13T18:25:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | import org.junit.Assert;
import org.junit.Test;
/**
* Created by sivanlauf on 13/11/2018.
*/
public class GeneralTests {
@Test
public void IsValidGridTest(){
boolean isValid = Game.isGridValid(3, 3, "0 0 0 0 1 0 0 1 0");
Assert.assertTrue(isValid);
boolean isValid2 = Game.isGridValid(3, 5, "0 0 0 0 1 0 0 1 0");
Assert.assertFalse(isValid2);
}
}
| [
"[email protected]"
] | |
0f039b0c2a1e4faac99d2cb0fa86b70270ec95d8 | 5c7b9021826a731e9c2d5095a6de4b23ed4c4ea8 | /src/main/java/com/example/demo/model/Eleve.java | 8d03fc7372c6a4872016f3a0bc551848e4d46346 | [] | no_license | HaouariBaderdine/SpringBoot-mongodb-auth-backend | cb8d27e339faf1c48cc68bde907e9c11d497dc67 | 368e124586b1e4190e39d013e528861fc5c708d2 | refs/heads/main | 2023-01-19T07:22:22.100011 | 2020-11-11T19:50:43 | 2020-11-11T19:50:43 | 310,915,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,669 | java | package com.example.demo.model;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.springframework.data.annotation.Id;
public class Eleve {
@Id
private String id;
@NotBlank
@Size(max = 50)
private String nom;
@NotBlank
@Size(max = 50)
private String prenom;
@NotBlank
@Size(max = 50)
private String dateNaissance;
@NotBlank
@Size(max = 20)
private String classe;
@NotBlank
@Size(max = 20)
private String idCollege;
public Eleve(@NotBlank @Size(max = 50) String nom, @NotBlank @Size(max = 50) String prenom,
@NotBlank @Size(max = 50) String dateNaissance, @NotBlank @Size(max = 20) String classe,
@NotBlank @Size(max = 20) String idCollege) {
this.nom = nom;
this.prenom = prenom;
this.dateNaissance = dateNaissance;
this.classe = classe;
this.idCollege = idCollege;
}
public String getId() {
return id;
}
public String getNom() {
return nom;
}
public String getPrenom() {
return prenom;
}
public String getDateNaissance() {
return dateNaissance;
}
public String getClasse() {
return classe;
}
public String getIdCollege() {
return idCollege;
}
public void setId(String id) {
this.id = id;
}
public void setNom(String nom) {
this.nom = nom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public void setDateNaissance(String dateNaissance) {
this.dateNaissance = dateNaissance;
}
public void setClasse(String classe) {
this.classe = classe;
}
public void setIdCollege(String idCollege) {
this.idCollege = idCollege;
}
}
| [
"[email protected]"
] | |
dc160f11d2310981f7c1a86752a6679c690401bb | 75c2211a6fefd167f382dac301e1b46617c917e1 | /expected-output/random/random8/sll/Input_withCos1.java | 019b8d9d042cf3e933f0a80508244fe656e45195 | [] | no_license | star-finder/jpf-costar | 0f87d88f420eace4b1b1c93ad44e764346b09f19 | b3f4d4893019a42b6c3f50e4294fd3ab6f2b5f88 | refs/heads/master | 2022-11-25T01:31:09.822003 | 2019-07-04T01:46:55 | 2019-07-04T01:46:55 | 105,350,745 | 2 | 1 | null | 2022-11-15T08:38:39 | 2017-09-30T07:20:18 | Java | UTF-8 | Java | false | false | 6,821 | java | package random.sll;
import org.junit.Test;
import gov.nasa.jpf.util.test.TestJPF;
public class Input_withCos1 extends TestJPF {
@Test
public void test_withCos1() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = null;
int elem_1 = 6;
root.elem = elem_1;
root.next = next_2;
obj.withCos(root);
}
@Test
public void test_withCos2() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = new random.sll.Node();
random.sll.Node next_6 = new random.sll.Node();
random.sll.Node next_8 = new random.sll.Node();
random.sll.Node next_10 = new random.sll.Node();
random.sll.Node next_12 = null;
int elem_9 = -7;
int elem_11 = -29;
int elem_3 = 12;
int elem_1 = 9;
int elem_7 = 15;
int elem_5 = -4;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
next_4.elem = elem_5;
next_4.next = next_6;
next_6.elem = elem_7;
next_6.next = next_8;
next_8.elem = elem_9;
next_8.next = next_10;
next_10.elem = elem_11;
next_10.next = next_12;
obj.withCos(root);
}
@Test
public void test_withCos3() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = new random.sll.Node();
random.sll.Node next_6 = new random.sll.Node();
random.sll.Node next_8 = new random.sll.Node();
random.sll.Node next_10 = new random.sll.Node();
random.sll.Node next_12 = new random.sll.Node();
random.sll.Node next_14 = null;
int elem_13 = -20;
int elem_9 = 31;
int elem_11 = 25;
int elem_3 = -2;
int elem_1 = 12;
int elem_7 = 16;
int elem_5 = 28;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
next_4.elem = elem_5;
next_4.next = next_6;
next_6.elem = elem_7;
next_6.next = next_8;
next_8.elem = elem_9;
next_8.next = next_10;
next_10.elem = elem_11;
next_10.next = next_12;
next_12.elem = elem_13;
next_12.next = next_14;
obj.withCos(root);
}
@Test
public void test_withCos4() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = null;
int elem_3 = 14;
int elem_1 = 1;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
obj.withCos(root);
}
@Test
public void test_withCos5() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = new random.sll.Node();
random.sll.Node next_6 = new random.sll.Node();
random.sll.Node next_8 = null;
int elem_3 = -23;
int elem_1 = 24;
int elem_7 = -27;
int elem_5 = -24;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
next_4.elem = elem_5;
next_4.next = next_6;
next_6.elem = elem_7;
next_6.next = next_8;
obj.withCos(root);
}
@Test
public void test_withCos6() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = new random.sll.Node();
random.sll.Node next_6 = null;
int elem_3 = -15;
int elem_1 = 13;
int elem_5 = 6;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
next_4.elem = elem_5;
next_4.next = next_6;
obj.withCos(root);
}
@Test
public void test_withCos7() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = new random.sll.Node();
random.sll.Node next_6 = new random.sll.Node();
random.sll.Node next_8 = new random.sll.Node();
random.sll.Node next_10 = new random.sll.Node();
random.sll.Node next_12 = new random.sll.Node();
random.sll.Node next_14 = new random.sll.Node();
random.sll.Node next_16 = null;
int elem_13 = -28;
int elem_9 = -22;
int elem_11 = -28;
int elem_15 = -24;
int elem_3 = 1;
int elem_1 = -12;
int elem_7 = 5;
int elem_5 = -12;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
next_4.elem = elem_5;
next_4.next = next_6;
next_6.elem = elem_7;
next_6.next = next_8;
next_8.elem = elem_9;
next_8.next = next_10;
next_10.elem = elem_11;
next_10.next = next_12;
next_12.elem = elem_13;
next_12.next = next_14;
next_14.elem = elem_15;
next_14.next = next_16;
obj.withCos(root);
}
@Test
public void test_withCos8() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = new random.sll.Node();
random.sll.Node next_6 = new random.sll.Node();
random.sll.Node next_8 = new random.sll.Node();
random.sll.Node next_10 = new random.sll.Node();
random.sll.Node next_12 = new random.sll.Node();
random.sll.Node next_14 = new random.sll.Node();
random.sll.Node next_16 = new random.sll.Node();
random.sll.Node next_18 = null;
int elem_13 = -21;
int elem_9 = 3;
int elem_11 = 5;
int elem_17 = -9;
int elem_15 = -18;
int elem_3 = 19;
int elem_1 = 29;
int elem_7 = 21;
int elem_5 = -10;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
next_4.elem = elem_5;
next_4.next = next_6;
next_6.elem = elem_7;
next_6.next = next_8;
next_8.elem = elem_9;
next_8.next = next_10;
next_10.elem = elem_11;
next_10.next = next_12;
next_12.elem = elem_13;
next_12.next = next_14;
next_14.elem = elem_15;
next_14.next = next_16;
next_16.elem = elem_17;
next_16.next = next_18;
obj.withCos(root);
}
@Test
public void test_withCos9() throws Exception {
Input obj = new Input();
random.sll.Node root = null;
obj.withCos(root);
}
@Test
public void test_withCos10() throws Exception {
Input obj = new Input();
random.sll.Node root = new random.sll.Node();
random.sll.Node next_2 = new random.sll.Node();
random.sll.Node next_4 = new random.sll.Node();
random.sll.Node next_6 = new random.sll.Node();
random.sll.Node next_8 = new random.sll.Node();
random.sll.Node next_10 = null;
int elem_9 = 7;
int elem_3 = -12;
int elem_1 = 13;
int elem_7 = -7;
int elem_5 = 13;
root.elem = elem_1;
root.next = next_2;
next_2.elem = elem_3;
next_2.next = next_4;
next_4.elem = elem_5;
next_4.next = next_6;
next_6.elem = elem_7;
next_6.next = next_8;
next_8.elem = elem_9;
next_8.next = next_10;
obj.withCos(root);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.