blob_id stringlengths 40 40 | __id__ int64 225 39,780B | directory_id stringlengths 40 40 | path stringlengths 6 313 | content_id stringlengths 40 40 | detected_licenses list | license_type stringclasses 2
values | repo_name stringlengths 6 132 | repo_url stringlengths 25 151 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 70 | visit_date timestamp[ns] | revision_date timestamp[ns] | committer_date timestamp[ns] | github_id int64 7.28k 689M ⌀ | star_events_count int64 0 131k | fork_events_count int64 0 48k | gha_license_id stringclasses 23
values | gha_fork bool 2
classes | gha_event_created_at timestamp[ns] | gha_created_at timestamp[ns] | gha_updated_at timestamp[ns] | gha_pushed_at timestamp[ns] | gha_size int64 0 40.4M ⌀ | gha_stargazers_count int32 0 112k ⌀ | gha_forks_count int32 0 39.4k ⌀ | gha_open_issues_count int32 0 11k ⌀ | gha_language stringlengths 1 21 ⌀ | gha_archived bool 2
classes | gha_disabled bool 1
class | content stringlengths 7 4.37M | src_encoding stringlengths 3 16 | language stringclasses 1
value | length_bytes int64 7 4.37M | extension stringclasses 24
values | filename stringlengths 4 174 | language_id stringclasses 1
value | entities list | contaminating_dataset stringclasses 0
values | malware_signatures list | redacted_content stringlengths 7 4.37M | redacted_length_bytes int64 7 4.37M | alphanum_fraction float32 0.25 0.94 | alpha_fraction float32 0.25 0.94 | num_lines int32 1 84k | avg_line_length float32 0.76 99.9 | std_line_length float32 0 220 | max_line_length int32 5 998 | is_vendor bool 2
classes | is_generated bool 1
class | max_hex_length int32 0 319 | hex_fraction float32 0 0.38 | max_unicode_length int32 0 408 | unicode_fraction float32 0 0.36 | max_base64_length int32 0 506 | base64_fraction float32 0 0.5 | avg_csv_sep_count float32 0 4 | is_autogen_header bool 1
class | is_empty_html bool 1
class | shard stringclasses 16
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
af0e83e21a17f18eeb6af85b7dda95613605066a | 5,420,248,735,457 | f6ddb593b47f017b0c862d16324c91d4636a6a8a | /src/main/java/stepanyuk/simplebookstore/dao/BookDao.java | 6d7d9e00249ee56bad0f53921f04b410e00b0f8e | [] | no_license | stepanyukforgit/simple-bookstore | https://github.com/stepanyukforgit/simple-bookstore | 3210ae10a9531e4a10f986b553469c2df8cad47a | 9f17e06f14c992a91225d3a45181e344e0310cce | refs/heads/master | 2017-11-01T20:45:27.492000 | 2017-07-07T20:12:42 | 2017-07-07T20:12:42 | 96,032,513 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package stepanyuk.simplebookstore.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import stepanyuk.simplebookstore.entity.Book;
import stepanyuk.simplebookstore.util.HibernateUtil;
/**
*
* @author stepanyuk
*/
public class BookDao{
public void saveBook(Book book){
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = null;
try{
transaction = session.beginTransaction();
session.save(book);
transaction.commit();
}catch(Exception e){
if( transaction != null)
transaction.rollback();
System.err.println(e.getMessage());
}
finally{
session.close();
}
}
public List<Book> getBooksList(){
Session session = HibernateUtil.getSessionFactory().openSession();
List<Book> allBooks = session.createQuery("From Book").list();
session.close();
return allBooks;
}
public Book getBook(int bookId){
Session session = HibernateUtil.getSessionFactory().openSession();
Book book = session.get(Book.class, bookId);
session.close();
return book;
}
public void deleteBook(int idBook){
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = null;
try{
transaction = session.beginTransaction();
Book book = getBook(idBook);
// System.out.println(book.getTitle());
session.delete(session.get(Book.class, idBook));
// session.remove(book);
System.out.println("deleted");
transaction.commit();
}catch(Exception e){
if( transaction != null)
transaction.rollback();
System.err.println(e.getMessage());
}
finally{
session.close();
}
}
}
| UTF-8 | Java | 1,985 | java | BookDao.java | Java | [
{
"context": "lebookstore.util.HibernateUtil;\n\n/**\n *\n * @author stepanyuk\n */\npublic class BookDao{\n \n public void sa",
"end": 254,
"score": 0.9995710253715515,
"start": 245,
"tag": "USERNAME",
"value": "stepanyuk"
}
] | null | [] | package stepanyuk.simplebookstore.dao;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import stepanyuk.simplebookstore.entity.Book;
import stepanyuk.simplebookstore.util.HibernateUtil;
/**
*
* @author stepanyuk
*/
public class BookDao{
public void saveBook(Book book){
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = null;
try{
transaction = session.beginTransaction();
session.save(book);
transaction.commit();
}catch(Exception e){
if( transaction != null)
transaction.rollback();
System.err.println(e.getMessage());
}
finally{
session.close();
}
}
public List<Book> getBooksList(){
Session session = HibernateUtil.getSessionFactory().openSession();
List<Book> allBooks = session.createQuery("From Book").list();
session.close();
return allBooks;
}
public Book getBook(int bookId){
Session session = HibernateUtil.getSessionFactory().openSession();
Book book = session.get(Book.class, bookId);
session.close();
return book;
}
public void deleteBook(int idBook){
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction transaction = null;
try{
transaction = session.beginTransaction();
Book book = getBook(idBook);
// System.out.println(book.getTitle());
session.delete(session.get(Book.class, idBook));
// session.remove(book);
System.out.println("deleted");
transaction.commit();
}catch(Exception e){
if( transaction != null)
transaction.rollback();
System.err.println(e.getMessage());
}
finally{
session.close();
}
}
}
| 1,985 | 0.592443 | 0.592443 | 66 | 29.075758 | 20.500044 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false | 5 |
d37044cdeb7eed8b0449115d38795a678d0b7680 | 5,420,248,736,111 | 2739da5e455b378eda210e8f3458f52cc3a45523 | /app/src/main/java/com/example/android/musicalstructureapp/PlaylistActivity.java | 1a282a96c7df20bc2bcbca35e20158c0774e3cb8 | [] | no_license | shoxtrem/MusicalStructureApp | https://github.com/shoxtrem/MusicalStructureApp | c6f4d3295734e841b4e5bc23d67dc078cdcbb5dd | 3bf25d84c72a9b554086557f64264ca71627c890 | refs/heads/master | 2020-03-19T14:20:38.327000 | 2018-06-13T07:38:42 | 2018-06-13T07:38:42 | 136,616,688 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.android.musicalstructureapp;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import java.util.ArrayList;
public class PlaylistActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playlist);
ArrayList<Song> song = new ArrayList<>();
song.add(new Song("California Rock", "", "by Musical Structure"));
song.add(new Song("Workout Motivation", "", "by Spotify"));
song.add(new Song("Vacation Vibes", "", "by James"));
song.add(new Song("Lovin' it", "", "by McDonald's"));
song.add(new Song("Squad Anthem", "", "by Team5"));
song.add(new Song("Never Stop", "", "by Musical Structure"));
song.add(new Song("Princess songs", "", "by Disney"));
song.add(new Song("Love songs", "", "by Mom"));
// Create an {@link SongAdapter}, whose data source is a list of {@link Song}s. The
// adapter knows how to create list items for each item in the list.
SongAdapter adapter = new SongAdapter(this, song, R.color.colorBlack);
// Find the {@link ListView} object in the view hierarchy of the {@link Activity}.
// There should be a {@link ListView} with the view ID called list, which is declared in the
// song_list.xml layout file.
ListView listView = (ListView) findViewById(R.id.list);
// Make the {@link ListView} use the {@link SongAdapter} we created above, so that the
// {@link ListView} will display list items for each {@link Song} in the list.
listView.setAdapter(adapter);
// Find the view that shows the back button and add clickListener to it
ImageButton back = (ImageButton) findViewById(R.id.back_button);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
// Find the view that shows the songs button and add clickListener to it
ImageButton songs = (ImageButton) findViewById(R.id.song_button);
songs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, SongsActivity.class);
startActivity(intent);
}
});
// Find the view that shows the menu button and add clickListener to it
ImageButton menu = (ImageButton) findViewById(R.id.menu_button);
menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
// Find the view that shows the album button and add clickListener to it
ImageButton album = (ImageButton) findViewById(R.id.album_button);
album.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, AlbumActivity.class);
startActivity(intent);
}
});
// Find the view that shows the artist button and add clickListener to it
ImageButton artist = (ImageButton) findViewById(R.id.artist_button);
artist.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, ArtistActivity.class);
startActivity(intent);
}
});
}
}
| UTF-8 | Java | 4,007 | java | PlaylistActivity.java | Java | [
{
"context": " song.add(new Song(\"Vacation Vibes\", \"\", \"by James\"));\n song.add(new Song(\"Lovin' it\", \"\", \"b",
"end": 756,
"score": 0.56803297996521,
"start": 751,
"tag": "NAME",
"value": "James"
},
{
"context": "));\n song.add(new Song(\"Lovin' it\", \... | null | [] | package com.example.android.musicalstructureapp;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import java.util.ArrayList;
public class PlaylistActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_playlist);
ArrayList<Song> song = new ArrayList<>();
song.add(new Song("California Rock", "", "by Musical Structure"));
song.add(new Song("Workout Motivation", "", "by Spotify"));
song.add(new Song("Vacation Vibes", "", "by James"));
song.add(new Song("Lovin' it", "", "by McDonald's"));
song.add(new Song("Squad Anthem", "", "by Team5"));
song.add(new Song("Never Stop", "", "by Musical Structure"));
song.add(new Song("Princess songs", "", "by Disney"));
song.add(new Song("Love songs", "", "by Mom"));
// Create an {@link SongAdapter}, whose data source is a list of {@link Song}s. The
// adapter knows how to create list items for each item in the list.
SongAdapter adapter = new SongAdapter(this, song, R.color.colorBlack);
// Find the {@link ListView} object in the view hierarchy of the {@link Activity}.
// There should be a {@link ListView} with the view ID called list, which is declared in the
// song_list.xml layout file.
ListView listView = (ListView) findViewById(R.id.list);
// Make the {@link ListView} use the {@link SongAdapter} we created above, so that the
// {@link ListView} will display list items for each {@link Song} in the list.
listView.setAdapter(adapter);
// Find the view that shows the back button and add clickListener to it
ImageButton back = (ImageButton) findViewById(R.id.back_button);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
// Find the view that shows the songs button and add clickListener to it
ImageButton songs = (ImageButton) findViewById(R.id.song_button);
songs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, SongsActivity.class);
startActivity(intent);
}
});
// Find the view that shows the menu button and add clickListener to it
ImageButton menu = (ImageButton) findViewById(R.id.menu_button);
menu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
// Find the view that shows the album button and add clickListener to it
ImageButton album = (ImageButton) findViewById(R.id.album_button);
album.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, AlbumActivity.class);
startActivity(intent);
}
});
// Find the view that shows the artist button and add clickListener to it
ImageButton artist = (ImageButton) findViewById(R.id.artist_button);
artist.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(PlaylistActivity.this, ArtistActivity.class);
startActivity(intent);
}
});
}
}
| 4,007 | 0.62865 | 0.628151 | 100 | 39.07 | 30.898951 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.67 | false | false | 5 |
43099bb32a052a5d853fb7bae88ec23f8c720cf7 | 10,075,993,282,228 | e470974a243c347fc26521dd309d96e9e7108211 | /多人语音聊天室-AOS/app/src/main/java/com/netease/audioroom/demo/model/SimpleMessage.java | 5466a390186132057cba037a43421da66e1009b6 | [] | no_license | lf-sy/AudioChatRoom | https://github.com/lf-sy/AudioChatRoom | 7b64379e6b42fbcb9b829b7d16f4d9831c1bfdc8 | 16eb70aeefcf5a88b257b19f3211e0592cabcdd6 | refs/heads/master | 2022-01-26T12:39:21.304000 | 2019-06-19T01:54:59 | 2019-06-19T01:54:59 | 193,085,426 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.netease.audioroom.demo.model;
public class SimpleMessage {
public static final int TYPE_NORMAL_MESSAGE = 1;
public static final int TYPE_MEMBER_CHANGE = 2;
public final String nick;
public final String content;
public final int type;
public SimpleMessage(String nick, String content, int type) {
this.nick = nick;
this.content = content;
this.type = type;
}
}
| UTF-8 | Java | 432 | java | SimpleMessage.java | Java | [] | null | [] | package com.netease.audioroom.demo.model;
public class SimpleMessage {
public static final int TYPE_NORMAL_MESSAGE = 1;
public static final int TYPE_MEMBER_CHANGE = 2;
public final String nick;
public final String content;
public final int type;
public SimpleMessage(String nick, String content, int type) {
this.nick = nick;
this.content = content;
this.type = type;
}
}
| 432 | 0.666667 | 0.662037 | 21 | 19.571428 | 20.388071 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false | 5 |
10df92e99d1ec68412eb4ef81fd79f0b8b83b59b | 20,968,030,344,078 | 127105380ab8ac3401c4e89b1fe09c2da85e2dae | /app/src/main/java/ru/bmstu/iu3/totodo/data/db/TaskDb.java | 2d503aff5e7cee20ff5a2b3ad512d05e2c77479b | [] | no_license | icetroid/asmaryandz | https://github.com/icetroid/asmaryandz | f1570e04275c3224545dcedea2964d6285aedf82 | 78ac3547adc4c85aba173872713c6807124c4481 | refs/heads/master | 2021-09-01T00:09:28.607000 | 2017-12-23T17:54:58 | 2017-12-23T17:54:58 | 111,098,663 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ru.bmstu.iu3.totodo.data.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import ru.bmstu.iu3.totodo.data.models.Task;
import static ru.bmstu.iu3.totodo.data.db.TaskContract.*;
/**
* Created by Icetroid on 21.11.2017.
*/
public class TaskDb
{
private static final String TAG = "TaskDb";
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
private static String[] defaultProjection = {
TaskEntry.TABLE_NAME + "." + TaskEntry._ID,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_FULL_TEXT,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_CALENDAR,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_NOTIFY_TIME,
PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY
};
private static String defaultQuery = TaskEntry.TABLE_NAME + " LEFT OUTER JOIN " + PriorityEntry.TABLE_NAME + " ON " + TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_PRIORITY + "=" + PriorityEntry.TABLE_NAME + "." + PriorityEntry._ID;
private TaskDbHelper mTaskDbHelper;
private SQLiteDatabase db;
public TaskDb(Context context)
{
mTaskDbHelper = new TaskDbHelper(context);
}
public long insertTask(Task task)
{
db = mTaskDbHelper.getWritableDatabase();
// Log.i(TAG, task.toString());
String fullText = task.getText();
String priority = String.valueOf(getPriorityId(task.getPriority()));
Date date = task.getDate();
String formatDate = new SimpleDateFormat(DATE_FORMAT).format(date);
boolean addToCalendar = task.isAddedToCalendar();
int notifyTime = task.getNotifyTime();
ContentValues contentValues = new ContentValues();
contentValues.put(TaskEntry.COLUMN_FULL_TEXT, fullText);
contentValues.put(TaskEntry.COLUMN_PRIORITY, priority);
contentValues.put(TaskEntry.COLUMN_DATE, formatDate);
contentValues.put(TaskEntry.COLUMN_CALENDAR, addToCalendar);
contentValues.put(TaskEntry.COLUMN_NOTIFY_TIME, notifyTime);
long row = db.insert(TaskEntry.TABLE_NAME, null, contentValues);
// Log.i(TAG, "row added " + row);
return row;
}
public List<Task> getTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc)
{
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
List<Task> tasks = getTasksWithPriority(priority, order);
return tasks;
}
public List<Task> getTasksWithPriority(Task.Priority priority, String orderBy)
{
String selection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?";
String[] selectionArgs = new String[]{priority.name()};
List<Task> tasks = getTasks(selection,selectionArgs, null,null,orderBy);
return tasks;
}
public List<Task> getTasksWithPriorityNoOrder(Task.Priority priority)
{
List<Task> tasks = getTasksWithPriority(priority, null);
return tasks;
}
public int updateTask(Task task)
{
db = mTaskDbHelper.getReadableDatabase();
String fullText = task.getText();
String priority = String.valueOf(getPriorityId(task.getPriority()));
Date date = task.getDate();
String formatDate = new SimpleDateFormat(DATE_FORMAT).format(date);
boolean addToCalendar = task.isAddedToCalendar();
int notifyTime = task.getNotifyTime();
ContentValues contentValues = new ContentValues();
contentValues.put(TaskEntry.COLUMN_FULL_TEXT, fullText);
contentValues.put(TaskEntry.COLUMN_PRIORITY, priority);
contentValues.put(TaskEntry.COLUMN_DATE, formatDate);
contentValues.put(TaskEntry.COLUMN_CALENDAR, addToCalendar);
contentValues.put(TaskEntry.COLUMN_NOTIFY_TIME, notifyTime);
String selection = TaskEntry._ID + " LIKE ?";
String[] selectionArgs = { String.valueOf(task.getId()) };
int count = db.update(
TaskEntry.TABLE_NAME,
contentValues,
selection,
selectionArgs);
Log.i(TAG, "count " + count + " text " + fullText);
return count;
}
public List<Task> getTasks(String selection, String[] selectionsArgs, String groupBy, String having, String orderBy)
{
db = mTaskDbHelper.getReadableDatabase();
String[] projection = {
TaskEntry.TABLE_NAME + "." + TaskEntry._ID,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_FULL_TEXT,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_CALENDAR,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_NOTIFY_TIME,
PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY
};
Cursor cursor = db.query(TaskEntry.TABLE_NAME + " LEFT OUTER JOIN " + PriorityEntry.TABLE_NAME + " ON " + TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_PRIORITY + "=" + PriorityEntry.TABLE_NAME + "." + PriorityEntry._ID,
projection, selection, selectionsArgs, groupBy, having, orderBy);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
Task task = new Task();
long id = cursor.getLong(0);
String text = cursor.getString(1);
String date = cursor.getString(2);
boolean addToCalendar = cursor.getInt(3) == 1 ? true : false;
int notifyTime = cursor.getInt(4);
String priority = cursor.getString(5);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
task.setId(id);
task.setText(text);
task.setPriority(priority);
task.setFullDate(formatDate);
task.setAddedToCalendar(addToCalendar);
task.setNotifyTime(notifyTime);
tasks.add(task);
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
// Log.i(TAG, "found " + tasks.size());
return tasks;
}
public List<Task> getAllTasks()
{
List<Task> tasks = getTasks(null,null,null,null,null);
return tasks;
}
public void deleteAllTasks()
{
db = mTaskDbHelper.getWritableDatabase();
db.delete(TaskEntry.TABLE_NAME, null, null);
}
public long getPriorityId(Task.Priority priority)
{
db = mTaskDbHelper.getReadableDatabase();
String selection = PriorityEntry.COLUMN_PRIORITY + " = ?";
String[] selectionArgs = new String[]{priority.name()};
Cursor cursor = db.query(PriorityEntry.TABLE_NAME, null, selection, selectionArgs, null, null, null);
if(!cursor.moveToFirst())
{
return -1;
}
long id = cursor.getLong(cursor.getColumnIndex(PriorityEntry._ID));
cursor.close();
return id;
}
public List<Task> getTodayTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isToday(formatDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
public List<Task> getTomorrowTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isTomorrow(formatDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
public List<Task> getThisWeekTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isThisWeek(formatDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
private Task getTask(Cursor cursor)
{
Task task = new Task();
long id = cursor.getLong(0);
String text = cursor.getString(1);
String date = cursor.getString(2);
boolean addToCalendar = cursor.getInt(3) == 1 ? true : false;
int notifyTime = cursor.getInt(4);
String taskPriority = cursor.getString(5);
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
task.setId(id);
task.setText(text);
task.setPriority(taskPriority);
task.setFullDate(formatDate);
task.setAddedToCalendar(addToCalendar);
task.setNotifyTime(notifyTime);
return task;
}
private boolean isToday(Date formatDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTime(new Date());
if(calendar.get(Calendar.DAY_OF_MONTH) == now.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
private boolean isTomorrow(Date formatDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTimeInMillis((new Date()).getTime() + 24 * 3600 * 1000);
if(calendar.get(Calendar.DAY_OF_MONTH) == now.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
private boolean isThisWeek(Date formatDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTime(new Date());
if(calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
public List<Task> getDateTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc, Date choosenDate) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isDate(formatDate, choosenDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
private boolean isDate(Date formatDate, Date choosenDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTime(choosenDate);
if(calendar.get(Calendar.DAY_OF_MONTH) == now.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
public void removeTask(long id) {
String selection = TaskEntry._ID + " LIKE ?";
// Specify arguments in placeholder order.
String[] selectionArgs = { String.valueOf(id) };
// Issue SQL statement.
db.delete(TaskEntry.TABLE_NAME, selection, selectionArgs);
}
}
| UTF-8 | Java | 17,122 | java | TaskDb.java | Java | [
{
"context": ".totodo.data.db.TaskContract.*;\n\n/**\n * Created by Icetroid on 21.11.2017.\n */\n\npublic class TaskDb\n{\n pri",
"end": 515,
"score": 0.9992926120758057,
"start": 507,
"tag": "USERNAME",
"value": "Icetroid"
}
] | null | [] | package ru.bmstu.iu3.totodo.data.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import ru.bmstu.iu3.totodo.data.models.Task;
import static ru.bmstu.iu3.totodo.data.db.TaskContract.*;
/**
* Created by Icetroid on 21.11.2017.
*/
public class TaskDb
{
private static final String TAG = "TaskDb";
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
private static String[] defaultProjection = {
TaskEntry.TABLE_NAME + "." + TaskEntry._ID,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_FULL_TEXT,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_CALENDAR,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_NOTIFY_TIME,
PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY
};
private static String defaultQuery = TaskEntry.TABLE_NAME + " LEFT OUTER JOIN " + PriorityEntry.TABLE_NAME + " ON " + TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_PRIORITY + "=" + PriorityEntry.TABLE_NAME + "." + PriorityEntry._ID;
private TaskDbHelper mTaskDbHelper;
private SQLiteDatabase db;
public TaskDb(Context context)
{
mTaskDbHelper = new TaskDbHelper(context);
}
public long insertTask(Task task)
{
db = mTaskDbHelper.getWritableDatabase();
// Log.i(TAG, task.toString());
String fullText = task.getText();
String priority = String.valueOf(getPriorityId(task.getPriority()));
Date date = task.getDate();
String formatDate = new SimpleDateFormat(DATE_FORMAT).format(date);
boolean addToCalendar = task.isAddedToCalendar();
int notifyTime = task.getNotifyTime();
ContentValues contentValues = new ContentValues();
contentValues.put(TaskEntry.COLUMN_FULL_TEXT, fullText);
contentValues.put(TaskEntry.COLUMN_PRIORITY, priority);
contentValues.put(TaskEntry.COLUMN_DATE, formatDate);
contentValues.put(TaskEntry.COLUMN_CALENDAR, addToCalendar);
contentValues.put(TaskEntry.COLUMN_NOTIFY_TIME, notifyTime);
long row = db.insert(TaskEntry.TABLE_NAME, null, contentValues);
// Log.i(TAG, "row added " + row);
return row;
}
public List<Task> getTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc)
{
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
List<Task> tasks = getTasksWithPriority(priority, order);
return tasks;
}
public List<Task> getTasksWithPriority(Task.Priority priority, String orderBy)
{
String selection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?";
String[] selectionArgs = new String[]{priority.name()};
List<Task> tasks = getTasks(selection,selectionArgs, null,null,orderBy);
return tasks;
}
public List<Task> getTasksWithPriorityNoOrder(Task.Priority priority)
{
List<Task> tasks = getTasksWithPriority(priority, null);
return tasks;
}
public int updateTask(Task task)
{
db = mTaskDbHelper.getReadableDatabase();
String fullText = task.getText();
String priority = String.valueOf(getPriorityId(task.getPriority()));
Date date = task.getDate();
String formatDate = new SimpleDateFormat(DATE_FORMAT).format(date);
boolean addToCalendar = task.isAddedToCalendar();
int notifyTime = task.getNotifyTime();
ContentValues contentValues = new ContentValues();
contentValues.put(TaskEntry.COLUMN_FULL_TEXT, fullText);
contentValues.put(TaskEntry.COLUMN_PRIORITY, priority);
contentValues.put(TaskEntry.COLUMN_DATE, formatDate);
contentValues.put(TaskEntry.COLUMN_CALENDAR, addToCalendar);
contentValues.put(TaskEntry.COLUMN_NOTIFY_TIME, notifyTime);
String selection = TaskEntry._ID + " LIKE ?";
String[] selectionArgs = { String.valueOf(task.getId()) };
int count = db.update(
TaskEntry.TABLE_NAME,
contentValues,
selection,
selectionArgs);
Log.i(TAG, "count " + count + " text " + fullText);
return count;
}
public List<Task> getTasks(String selection, String[] selectionsArgs, String groupBy, String having, String orderBy)
{
db = mTaskDbHelper.getReadableDatabase();
String[] projection = {
TaskEntry.TABLE_NAME + "." + TaskEntry._ID,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_FULL_TEXT,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_CALENDAR,
TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_NOTIFY_TIME,
PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY
};
Cursor cursor = db.query(TaskEntry.TABLE_NAME + " LEFT OUTER JOIN " + PriorityEntry.TABLE_NAME + " ON " + TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_PRIORITY + "=" + PriorityEntry.TABLE_NAME + "." + PriorityEntry._ID,
projection, selection, selectionsArgs, groupBy, having, orderBy);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
Task task = new Task();
long id = cursor.getLong(0);
String text = cursor.getString(1);
String date = cursor.getString(2);
boolean addToCalendar = cursor.getInt(3) == 1 ? true : false;
int notifyTime = cursor.getInt(4);
String priority = cursor.getString(5);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
task.setId(id);
task.setText(text);
task.setPriority(priority);
task.setFullDate(formatDate);
task.setAddedToCalendar(addToCalendar);
task.setNotifyTime(notifyTime);
tasks.add(task);
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
// Log.i(TAG, "found " + tasks.size());
return tasks;
}
public List<Task> getAllTasks()
{
List<Task> tasks = getTasks(null,null,null,null,null);
return tasks;
}
public void deleteAllTasks()
{
db = mTaskDbHelper.getWritableDatabase();
db.delete(TaskEntry.TABLE_NAME, null, null);
}
public long getPriorityId(Task.Priority priority)
{
db = mTaskDbHelper.getReadableDatabase();
String selection = PriorityEntry.COLUMN_PRIORITY + " = ?";
String[] selectionArgs = new String[]{priority.name()};
Cursor cursor = db.query(PriorityEntry.TABLE_NAME, null, selection, selectionArgs, null, null, null);
if(!cursor.moveToFirst())
{
return -1;
}
long id = cursor.getLong(cursor.getColumnIndex(PriorityEntry._ID));
cursor.close();
return id;
}
public List<Task> getTodayTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isToday(formatDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
public List<Task> getTomorrowTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isTomorrow(formatDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
public List<Task> getThisWeekTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isThisWeek(formatDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
private Task getTask(Cursor cursor)
{
Task task = new Task();
long id = cursor.getLong(0);
String text = cursor.getString(1);
String date = cursor.getString(2);
boolean addToCalendar = cursor.getInt(3) == 1 ? true : false;
int notifyTime = cursor.getInt(4);
String taskPriority = cursor.getString(5);
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
task.setId(id);
task.setText(text);
task.setPriority(taskPriority);
task.setFullDate(formatDate);
task.setAddedToCalendar(addToCalendar);
task.setNotifyTime(notifyTime);
return task;
}
private boolean isToday(Date formatDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTime(new Date());
if(calendar.get(Calendar.DAY_OF_MONTH) == now.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
private boolean isTomorrow(Date formatDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTimeInMillis((new Date()).getTime() + 24 * 3600 * 1000);
if(calendar.get(Calendar.DAY_OF_MONTH) == now.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
private boolean isThisWeek(Date formatDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTime(new Date());
if(calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
public List<Task> getDateTasksWithPriorityOrderByDate(Task.Priority priority, boolean desc, Date choosenDate) {
db = mTaskDbHelper.getReadableDatabase();
String todaySelection = PriorityEntry.TABLE_NAME + "." + PriorityEntry.COLUMN_PRIORITY + " = ?"; //"date(datetime("+TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE+ " / 1000 , 'unixepoch')) = ? AND " +
String[] selectionsArgs = new String[]{priority.name()};
String order = TaskEntry.TABLE_NAME + "." + TaskEntry.COLUMN_DATE;
if(desc)
{
order += " DESC";
}
Cursor cursor = db.query(defaultQuery, defaultProjection, todaySelection, selectionsArgs, null, null, order);
List<Task> tasks = new LinkedList<>();
while(cursor.moveToNext())
{
String date = cursor.getString(2);
// Log.i(TAG, "1 = " + cursor.getString(1) + " 2 = " + cursor.getString(2));
// String priority = cursor.getString(cursor.getColumnIndex())
Date formatDate = null;
try {
formatDate = new SimpleDateFormat(DATE_FORMAT).parse(date);
} catch (ParseException e) {
Log.e(TAG, e.getMessage());
}
if(isDate(formatDate, choosenDate))
{
Task task = getTask(cursor);
tasks.add(task);
}
// Log.i(TAG, "Task " + task.getText() + " " + task.getPriority());
}
cursor.close();
Log.i(TAG, "found " + tasks.size() + " " + todaySelection);
return tasks;
}
private boolean isDate(Date formatDate, Date choosenDate)
{
Calendar calendar = Calendar.getInstance();
calendar.setTime(formatDate);
Calendar now = Calendar.getInstance();
now.setTime(choosenDate);
if(calendar.get(Calendar.DAY_OF_MONTH) == now.get(Calendar.DAY_OF_MONTH) && calendar.get(Calendar.MONTH) == now.get(Calendar.MONTH) && calendar.get(Calendar.YEAR) == now.get(Calendar.YEAR))
{
return true;
}
return false;
}
public void removeTask(long id) {
String selection = TaskEntry._ID + " LIKE ?";
// Specify arguments in placeholder order.
String[] selectionArgs = { String.valueOf(id) };
// Issue SQL statement.
db.delete(TaskEntry.TABLE_NAME, selection, selectionArgs);
}
}
| 17,122 | 0.592279 | 0.58784 | 468 | 35.585468 | 37.447159 | 236 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.717949 | false | false | 5 |
96e9de54272496277ade36db6a9582bbf782a609 | 20,968,030,346,578 | 70becd9e3047ef5df2ac298ce839ca5c1a34cbd5 | /src/main/java/com/food/profile/service/datatype/NameDataEntityInfo.java | ea227698ff181d1298438e83e41552f06272b6ad | [] | no_license | zuqer/EBProfileEJB | https://github.com/zuqer/EBProfileEJB | 7c5b81b837d7588832b7d0cbc4c88ddb894a8c64 | c0eeb3bdaab6a3ff7996778650cfff4f99d5b3cc | refs/heads/master | 2016-05-25T14:19:08.251000 | 2014-10-20T18:23:03 | 2014-10-20T18:23:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.food.profile.service.datatype;
import java.io.Serializable;
import java.util.Date;
import com.food.persistence.BusinessModel;
import com.food.persistence.ORMModel;
import com.food.profile.service.entity.NameDataEntity;
public class NameDataEntityInfo implements BusinessModel, Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String nameLine1;
private String nameLine2;
private String element1;
private String element2;
private String element3;
private String element4;
private String element5;
private String element6;
private String element7;
private String element8;
private String element9;
private String element10;
private String linkType;
private String nameType;
private boolean activeStatus;
private Date expireDate;
private String expireBy;
private String serviceCode;
private Date createDate;
private String createBy;
private Date updateDate;
private String updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNameLine1() {
return nameLine1;
}
public void setNameLine1(String nameLine1) {
this.nameLine1 = nameLine1;
}
public String getNameLine2() {
return nameLine2;
}
public void setNameLine2(String nameLine2) {
this.nameLine2 = nameLine2;
}
public String getElement1() {
return element1;
}
public void setElement1(String element1) {
this.element1 = element1;
}
public String getElement2() {
return element2;
}
public void setElement2(String element2) {
this.element2 = element2;
}
public String getElement3() {
return element3;
}
public void setElement3(String element3) {
this.element3 = element3;
}
public String getElement4() {
return element4;
}
public void setElement4(String element4) {
this.element4 = element4;
}
public String getElement5() {
return element5;
}
public void setElement5(String element5) {
this.element5 = element5;
}
public String getElement6() {
return element6;
}
public void setElement6(String element6) {
this.element6 = element6;
}
public String getElement7() {
return element7;
}
public void setElement7(String element7) {
this.element7 = element7;
}
public String getElement8() {
return element8;
}
public void setElement8(String element8) {
this.element8 = element8;
}
public String getElement9() {
return element9;
}
public void setElement9(String element9) {
this.element9 = element9;
}
public String getElement10() {
return element10;
}
public void setElement10(String element10) {
this.element10 = element10;
}
public String getLinkType() {
return linkType;
}
public void setLinkType(String linkType) {
this.linkType = linkType;
}
public String getNameType() {
return nameType;
}
public void setNameType(String nameType) {
this.nameType = nameType;
}
public boolean isActiveStatus() {
return activeStatus;
}
public void setActiveStatus(boolean activeStatus) {
this.activeStatus = activeStatus;
}
public Date getExpireDate() {
return expireDate;
}
public void setExpireDate(Date expireDate) {
this.expireDate = expireDate;
}
public String getExpireBy() {
return expireBy;
}
public void setExpireBy(String expireBy) {
this.expireBy = expireBy;
}
public String getServiceCode() {
return serviceCode;
}
public void setServiceCode(String serviceCode) {
this.serviceCode = serviceCode;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public ORMModel toORMModel() {
NameDataEntity entityBean = new NameDataEntity();
entityBean.setActiveStatus(activeStatus);
entityBean.setCreateBy(createBy);
entityBean.setCreateDate(createDate);
entityBean.setElement1(element1);
entityBean.setElement10(element10);
entityBean.setElement2(element2);
entityBean.setElement3(element3);
entityBean.setElement4(element4);
entityBean.setElement5(element5);
entityBean.setElement6(element6);
entityBean.setElement7(element7);
entityBean.setElement8(element8);
entityBean.setElement9(element9);
entityBean.setExpireBy(expireBy);
entityBean.setExpireDate(expireDate);
entityBean.setId(id);
entityBean.setLinkType(linkType);
entityBean.setNameLine1(nameLine1);
entityBean.setNameLine2(nameLine2);
entityBean.setNameType(nameType);
entityBean.setServiceCode(serviceCode);
entityBean.setUpdateBy(updateBy);
entityBean.setUpdateDate(updateDate);
entityBean.setNew(id==null);
return entityBean;
}
}
| UTF-8 | Java | 5,244 | java | NameDataEntityInfo.java | Java | [] | null | [] | package com.food.profile.service.datatype;
import java.io.Serializable;
import java.util.Date;
import com.food.persistence.BusinessModel;
import com.food.persistence.ORMModel;
import com.food.profile.service.entity.NameDataEntity;
public class NameDataEntityInfo implements BusinessModel, Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String nameLine1;
private String nameLine2;
private String element1;
private String element2;
private String element3;
private String element4;
private String element5;
private String element6;
private String element7;
private String element8;
private String element9;
private String element10;
private String linkType;
private String nameType;
private boolean activeStatus;
private Date expireDate;
private String expireBy;
private String serviceCode;
private Date createDate;
private String createBy;
private Date updateDate;
private String updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNameLine1() {
return nameLine1;
}
public void setNameLine1(String nameLine1) {
this.nameLine1 = nameLine1;
}
public String getNameLine2() {
return nameLine2;
}
public void setNameLine2(String nameLine2) {
this.nameLine2 = nameLine2;
}
public String getElement1() {
return element1;
}
public void setElement1(String element1) {
this.element1 = element1;
}
public String getElement2() {
return element2;
}
public void setElement2(String element2) {
this.element2 = element2;
}
public String getElement3() {
return element3;
}
public void setElement3(String element3) {
this.element3 = element3;
}
public String getElement4() {
return element4;
}
public void setElement4(String element4) {
this.element4 = element4;
}
public String getElement5() {
return element5;
}
public void setElement5(String element5) {
this.element5 = element5;
}
public String getElement6() {
return element6;
}
public void setElement6(String element6) {
this.element6 = element6;
}
public String getElement7() {
return element7;
}
public void setElement7(String element7) {
this.element7 = element7;
}
public String getElement8() {
return element8;
}
public void setElement8(String element8) {
this.element8 = element8;
}
public String getElement9() {
return element9;
}
public void setElement9(String element9) {
this.element9 = element9;
}
public String getElement10() {
return element10;
}
public void setElement10(String element10) {
this.element10 = element10;
}
public String getLinkType() {
return linkType;
}
public void setLinkType(String linkType) {
this.linkType = linkType;
}
public String getNameType() {
return nameType;
}
public void setNameType(String nameType) {
this.nameType = nameType;
}
public boolean isActiveStatus() {
return activeStatus;
}
public void setActiveStatus(boolean activeStatus) {
this.activeStatus = activeStatus;
}
public Date getExpireDate() {
return expireDate;
}
public void setExpireDate(Date expireDate) {
this.expireDate = expireDate;
}
public String getExpireBy() {
return expireBy;
}
public void setExpireBy(String expireBy) {
this.expireBy = expireBy;
}
public String getServiceCode() {
return serviceCode;
}
public void setServiceCode(String serviceCode) {
this.serviceCode = serviceCode;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public ORMModel toORMModel() {
NameDataEntity entityBean = new NameDataEntity();
entityBean.setActiveStatus(activeStatus);
entityBean.setCreateBy(createBy);
entityBean.setCreateDate(createDate);
entityBean.setElement1(element1);
entityBean.setElement10(element10);
entityBean.setElement2(element2);
entityBean.setElement3(element3);
entityBean.setElement4(element4);
entityBean.setElement5(element5);
entityBean.setElement6(element6);
entityBean.setElement7(element7);
entityBean.setElement8(element8);
entityBean.setElement9(element9);
entityBean.setExpireBy(expireBy);
entityBean.setExpireDate(expireDate);
entityBean.setId(id);
entityBean.setLinkType(linkType);
entityBean.setNameLine1(nameLine1);
entityBean.setNameLine2(nameLine2);
entityBean.setNameType(nameType);
entityBean.setServiceCode(serviceCode);
entityBean.setUpdateBy(updateBy);
entityBean.setUpdateDate(updateDate);
entityBean.setNew(id==null);
return entityBean;
}
}
| 5,244 | 0.713959 | 0.691457 | 250 | 18.976 | 16.439934 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.46 | false | false | 5 |
e341e367e7937bcdbedce020efdacd392f799494 | 26,173,530,706,003 | a0add4ab894b0f8adb92946bfd9a344cb5524934 | /BuinessSOP-portlet/docroot/WEB-INF/service/com/chola/business/model/businessSOPppusersClp.java | 7ce8df580fc76bca56dbf7b265fdb174ad0187d2 | [] | no_license | ashish-clover/liferay-codes | https://github.com/ashish-clover/liferay-codes | 1e0b339c070c25a304d989fb10066cff93491e13 | c485d5f8f254dbb8c11be0031e67757ba5b081d7 | refs/heads/master | 2020-03-09T10:15:18.037000 | 2018-07-04T06:09:48 | 2018-07-04T06:09:48 | 128,732,866 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.chola.business.model;
import aQute.bnd.annotation.ProviderType;
import com.chola.business.service.ClpSerializer;
import com.chola.business.service.businessSOPppusersLocalServiceUtil;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.model.BaseModel;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* @generated
*/
@ProviderType
public class businessSOPppusersClp extends BaseModelImpl<businessSOPppusers>
implements businessSOPppusers {
public businessSOPppusersClp() {
}
@Override
public Class<?> getModelClass() {
return businessSOPppusers.class;
}
@Override
public String getModelClassName() {
return businessSOPppusers.class.getName();
}
@Override
public long getPrimaryKey() {
return _id;
}
@Override
public void setPrimaryKey(long primaryKey) {
setId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _id;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("id", getId());
attributes.put("businesssop_uniqueid", getBusinesssop_uniqueid());
attributes.put("user_id", getUser_id());
attributes.put("entityCacheEnabled", isEntityCacheEnabled());
attributes.put("finderCacheEnabled", isFinderCacheEnabled());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long id = (Long)attributes.get("id");
if (id != null) {
setId(id);
}
String businesssop_uniqueid = (String)attributes.get(
"businesssop_uniqueid");
if (businesssop_uniqueid != null) {
setBusinesssop_uniqueid(businesssop_uniqueid);
}
String user_id = (String)attributes.get("user_id");
if (user_id != null) {
setUser_id(user_id);
}
_entityCacheEnabled = GetterUtil.getBoolean("entityCacheEnabled");
_finderCacheEnabled = GetterUtil.getBoolean("finderCacheEnabled");
}
@Override
public long getId() {
return _id;
}
@Override
public void setId(long id) {
_id = id;
if (_businessSOPppusersRemoteModel != null) {
try {
Class<?> clazz = _businessSOPppusersRemoteModel.getClass();
Method method = clazz.getMethod("setId", long.class);
method.invoke(_businessSOPppusersRemoteModel, id);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getBusinesssop_uniqueid() {
return _businesssop_uniqueid;
}
@Override
public void setBusinesssop_uniqueid(String businesssop_uniqueid) {
_businesssop_uniqueid = businesssop_uniqueid;
if (_businessSOPppusersRemoteModel != null) {
try {
Class<?> clazz = _businessSOPppusersRemoteModel.getClass();
Method method = clazz.getMethod("setBusinesssop_uniqueid",
String.class);
method.invoke(_businessSOPppusersRemoteModel,
businesssop_uniqueid);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getUser_id() {
return _user_id;
}
@Override
public void setUser_id(String user_id) {
_user_id = user_id;
if (_businessSOPppusersRemoteModel != null) {
try {
Class<?> clazz = _businessSOPppusersRemoteModel.getClass();
Method method = clazz.getMethod("setUser_id", String.class);
method.invoke(_businessSOPppusersRemoteModel, user_id);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
public BaseModel<?> getbusinessSOPppusersRemoteModel() {
return _businessSOPppusersRemoteModel;
}
public void setbusinessSOPppusersRemoteModel(
BaseModel<?> businessSOPppusersRemoteModel) {
_businessSOPppusersRemoteModel = businessSOPppusersRemoteModel;
}
public Object invokeOnRemoteModel(String methodName,
Class<?>[] parameterTypes, Object[] parameterValues)
throws Exception {
Object[] remoteParameterValues = new Object[parameterValues.length];
for (int i = 0; i < parameterValues.length; i++) {
if (parameterValues[i] != null) {
remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]);
}
}
Class<?> remoteModelClass = _businessSOPppusersRemoteModel.getClass();
ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader();
Class<?>[] remoteParameterTypes = new Class[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
if (parameterTypes[i].isPrimitive()) {
remoteParameterTypes[i] = parameterTypes[i];
}
else {
String parameterTypeName = parameterTypes[i].getName();
remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName);
}
}
Method method = remoteModelClass.getMethod(methodName,
remoteParameterTypes);
Object returnValue = method.invoke(_businessSOPppusersRemoteModel,
remoteParameterValues);
if (returnValue != null) {
returnValue = ClpSerializer.translateOutput(returnValue);
}
return returnValue;
}
@Override
public void persist() {
if (this.isNew()) {
businessSOPppusersLocalServiceUtil.addbusinessSOPppusers(this);
}
else {
businessSOPppusersLocalServiceUtil.updatebusinessSOPppusers(this);
}
}
@Override
public businessSOPppusers toEscapedModel() {
return (businessSOPppusers)ProxyUtil.newProxyInstance(businessSOPppusers.class.getClassLoader(),
new Class[] { businessSOPppusers.class },
new AutoEscapeBeanHandler(this));
}
@Override
public Object clone() {
businessSOPppusersClp clone = new businessSOPppusersClp();
clone.setId(getId());
clone.setBusinesssop_uniqueid(getBusinesssop_uniqueid());
clone.setUser_id(getUser_id());
return clone;
}
@Override
public int compareTo(businessSOPppusers businessSOPppusers) {
long primaryKey = businessSOPppusers.getPrimaryKey();
if (getPrimaryKey() < primaryKey) {
return -1;
}
else if (getPrimaryKey() > primaryKey) {
return 1;
}
else {
return 0;
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof businessSOPppusersClp)) {
return false;
}
businessSOPppusersClp businessSOPppusers = (businessSOPppusersClp)obj;
long primaryKey = businessSOPppusers.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
public Class<?> getClpSerializerClass() {
return _clpSerializerClass;
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public boolean isEntityCacheEnabled() {
return _entityCacheEnabled;
}
@Override
public boolean isFinderCacheEnabled() {
return _finderCacheEnabled;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(7);
sb.append("{id=");
sb.append(getId());
sb.append(", businesssop_uniqueid=");
sb.append(getBusinesssop_uniqueid());
sb.append(", user_id=");
sb.append(getUser_id());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(13);
sb.append("<model><model-name>");
sb.append("com.chola.business.model.businessSOPppusers");
sb.append("</model-name>");
sb.append(
"<column><column-name>id</column-name><column-value><![CDATA[");
sb.append(getId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>businesssop_uniqueid</column-name><column-value><![CDATA[");
sb.append(getBusinesssop_uniqueid());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>user_id</column-name><column-value><![CDATA[");
sb.append(getUser_id());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private long _id;
private String _businesssop_uniqueid;
private String _user_id;
private BaseModel<?> _businessSOPppusersRemoteModel;
private Class<?> _clpSerializerClass = ClpSerializer.class;
private boolean _entityCacheEnabled;
private boolean _finderCacheEnabled;
} | UTF-8 | Java | 8,958 | java | businessSOPppusersClp.java | Java | [] | null | [] | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.chola.business.model;
import aQute.bnd.annotation.ProviderType;
import com.chola.business.service.ClpSerializer;
import com.chola.business.service.businessSOPppusersLocalServiceUtil;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.model.BaseModel;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* @generated
*/
@ProviderType
public class businessSOPppusersClp extends BaseModelImpl<businessSOPppusers>
implements businessSOPppusers {
public businessSOPppusersClp() {
}
@Override
public Class<?> getModelClass() {
return businessSOPppusers.class;
}
@Override
public String getModelClassName() {
return businessSOPppusers.class.getName();
}
@Override
public long getPrimaryKey() {
return _id;
}
@Override
public void setPrimaryKey(long primaryKey) {
setId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _id;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("id", getId());
attributes.put("businesssop_uniqueid", getBusinesssop_uniqueid());
attributes.put("user_id", getUser_id());
attributes.put("entityCacheEnabled", isEntityCacheEnabled());
attributes.put("finderCacheEnabled", isFinderCacheEnabled());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long id = (Long)attributes.get("id");
if (id != null) {
setId(id);
}
String businesssop_uniqueid = (String)attributes.get(
"businesssop_uniqueid");
if (businesssop_uniqueid != null) {
setBusinesssop_uniqueid(businesssop_uniqueid);
}
String user_id = (String)attributes.get("user_id");
if (user_id != null) {
setUser_id(user_id);
}
_entityCacheEnabled = GetterUtil.getBoolean("entityCacheEnabled");
_finderCacheEnabled = GetterUtil.getBoolean("finderCacheEnabled");
}
@Override
public long getId() {
return _id;
}
@Override
public void setId(long id) {
_id = id;
if (_businessSOPppusersRemoteModel != null) {
try {
Class<?> clazz = _businessSOPppusersRemoteModel.getClass();
Method method = clazz.getMethod("setId", long.class);
method.invoke(_businessSOPppusersRemoteModel, id);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getBusinesssop_uniqueid() {
return _businesssop_uniqueid;
}
@Override
public void setBusinesssop_uniqueid(String businesssop_uniqueid) {
_businesssop_uniqueid = businesssop_uniqueid;
if (_businessSOPppusersRemoteModel != null) {
try {
Class<?> clazz = _businessSOPppusersRemoteModel.getClass();
Method method = clazz.getMethod("setBusinesssop_uniqueid",
String.class);
method.invoke(_businessSOPppusersRemoteModel,
businesssop_uniqueid);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
@Override
public String getUser_id() {
return _user_id;
}
@Override
public void setUser_id(String user_id) {
_user_id = user_id;
if (_businessSOPppusersRemoteModel != null) {
try {
Class<?> clazz = _businessSOPppusersRemoteModel.getClass();
Method method = clazz.getMethod("setUser_id", String.class);
method.invoke(_businessSOPppusersRemoteModel, user_id);
}
catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
}
public BaseModel<?> getbusinessSOPppusersRemoteModel() {
return _businessSOPppusersRemoteModel;
}
public void setbusinessSOPppusersRemoteModel(
BaseModel<?> businessSOPppusersRemoteModel) {
_businessSOPppusersRemoteModel = businessSOPppusersRemoteModel;
}
public Object invokeOnRemoteModel(String methodName,
Class<?>[] parameterTypes, Object[] parameterValues)
throws Exception {
Object[] remoteParameterValues = new Object[parameterValues.length];
for (int i = 0; i < parameterValues.length; i++) {
if (parameterValues[i] != null) {
remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]);
}
}
Class<?> remoteModelClass = _businessSOPppusersRemoteModel.getClass();
ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader();
Class<?>[] remoteParameterTypes = new Class[parameterTypes.length];
for (int i = 0; i < parameterTypes.length; i++) {
if (parameterTypes[i].isPrimitive()) {
remoteParameterTypes[i] = parameterTypes[i];
}
else {
String parameterTypeName = parameterTypes[i].getName();
remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName);
}
}
Method method = remoteModelClass.getMethod(methodName,
remoteParameterTypes);
Object returnValue = method.invoke(_businessSOPppusersRemoteModel,
remoteParameterValues);
if (returnValue != null) {
returnValue = ClpSerializer.translateOutput(returnValue);
}
return returnValue;
}
@Override
public void persist() {
if (this.isNew()) {
businessSOPppusersLocalServiceUtil.addbusinessSOPppusers(this);
}
else {
businessSOPppusersLocalServiceUtil.updatebusinessSOPppusers(this);
}
}
@Override
public businessSOPppusers toEscapedModel() {
return (businessSOPppusers)ProxyUtil.newProxyInstance(businessSOPppusers.class.getClassLoader(),
new Class[] { businessSOPppusers.class },
new AutoEscapeBeanHandler(this));
}
@Override
public Object clone() {
businessSOPppusersClp clone = new businessSOPppusersClp();
clone.setId(getId());
clone.setBusinesssop_uniqueid(getBusinesssop_uniqueid());
clone.setUser_id(getUser_id());
return clone;
}
@Override
public int compareTo(businessSOPppusers businessSOPppusers) {
long primaryKey = businessSOPppusers.getPrimaryKey();
if (getPrimaryKey() < primaryKey) {
return -1;
}
else if (getPrimaryKey() > primaryKey) {
return 1;
}
else {
return 0;
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof businessSOPppusersClp)) {
return false;
}
businessSOPppusersClp businessSOPppusers = (businessSOPppusersClp)obj;
long primaryKey = businessSOPppusers.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
public Class<?> getClpSerializerClass() {
return _clpSerializerClass;
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public boolean isEntityCacheEnabled() {
return _entityCacheEnabled;
}
@Override
public boolean isFinderCacheEnabled() {
return _finderCacheEnabled;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(7);
sb.append("{id=");
sb.append(getId());
sb.append(", businesssop_uniqueid=");
sb.append(getBusinesssop_uniqueid());
sb.append(", user_id=");
sb.append(getUser_id());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(13);
sb.append("<model><model-name>");
sb.append("com.chola.business.model.businessSOPppusers");
sb.append("</model-name>");
sb.append(
"<column><column-name>id</column-name><column-value><![CDATA[");
sb.append(getId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>businesssop_uniqueid</column-name><column-value><![CDATA[");
sb.append(getBusinesssop_uniqueid());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>user_id</column-name><column-value><![CDATA[");
sb.append(getUser_id());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private long _id;
private String _businesssop_uniqueid;
private String _user_id;
private BaseModel<?> _businessSOPppusersRemoteModel;
private Class<?> _clpSerializerClass = ClpSerializer.class;
private boolean _entityCacheEnabled;
private boolean _finderCacheEnabled;
} | 8,958 | 0.723487 | 0.721925 | 367 | 23.411444 | 24.206585 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.787466 | false | false | 5 |
524ecef754b0c97df0f714267f9463f18f75f9ca | 7,593,502,190,294 | 097ddb240cc2ff061494b9addf90c94b58d32a2c | /src/main/java/ui/controller/Servlet.java | 9256f4a7e05677ca5f825c237ff19aaf5cd70663 | [] | no_license | frederikausloos/web3-project-frederikausloos | https://github.com/frederikausloos/web3-project-frederikausloos | 3975e367761f918a4e20e6effde009cd6eb1277c | 57337417d36fa9b049ca25659ccf264091075c52 | refs/heads/master | 2022-12-27T21:26:59.359000 | 2020-10-03T14:47:20 | 2020-10-03T14:47:20 | 303,083,153 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ui.controller;
import domain.db.PersonService;
import domain.model.Person;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
@WebServlet("/Servlet")
public class Servlet extends HttpServlet {
private PersonService service = new PersonService();
private HandlerFactory handlerFactory = new HandlerFactory();
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
private void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String destination = "index.jsp";
String command = request.getParameter("command");
if (command != null){
try {
RequestHandler handler = handlerFactory.getHandler(command, service);
destination = handler.handleRequest(request, response);
} catch (Exception e) {
request.setAttribute("error", e.getMessage());
destination = "index.jsp";
}
}
request.getRequestDispatcher(destination).forward(request,response);
}
}
| UTF-8 | Java | 1,584 | java | Servlet.java | Java | [] | null | [] | package ui.controller;
import domain.db.PersonService;
import domain.model.Person;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
@WebServlet("/Servlet")
public class Servlet extends HttpServlet {
private PersonService service = new PersonService();
private HandlerFactory handlerFactory = new HandlerFactory();
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
private void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String destination = "index.jsp";
String command = request.getParameter("command");
if (command != null){
try {
RequestHandler handler = handlerFactory.getHandler(command, service);
destination = handler.handleRequest(request, response);
} catch (Exception e) {
request.setAttribute("error", e.getMessage());
destination = "index.jsp";
}
}
request.getRequestDispatcher(destination).forward(request,response);
}
}
| 1,584 | 0.718434 | 0.718434 | 46 | 33.434784 | 33.440182 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.717391 | false | false | 5 |
e2463957bd62505cae87dccd4550282ba6443128 | 7,593,502,192,942 | f9ca92e7ac049ae8a821c85957d73f3f5d1b3978 | /eco-back/src/main/java/ma/fgs/product/service/UserService.java | 6ca43e442ccea9c2176f272bfb9d74a6ec5f1fd2 | [] | no_license | zios07/ecommerce-app | https://github.com/zios07/ecommerce-app | b8a0f3acd2f99ff9d9d8ff10dc93e23e3662785d | eba752cf0c9399e4318f80a091e3ccb736889ff9 | refs/heads/master | 2020-04-13T09:22:56.851000 | 2020-03-21T22:35:55 | 2020-03-21T22:35:55 | 163,109,974 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ma.fgs.product.service;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import ma.fgs.product.domain.Role;
import ma.fgs.product.domain.User;
import ma.fgs.product.repository.UserRepository;
import ma.fgs.product.service.api.IRoleService;
import ma.fgs.product.service.api.IUserService;
import ma.fgs.product.service.exception.NotFoundException;
@Service
public class UserService implements IUserService {
@Autowired
private UserRepository repo;
@Autowired
private IRoleService roleService;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
@Override
public User addUser(User user) {
if(repo.count() == 0) {
user.setRole(roleService.getRoleAdmin());
} else {
if( user.getRole() == null ) {
Role role = roleService.getRoleUser();
user.setRole(role);
}
}
if (user.getAccount() != null) {
user.getAccount().setPassword(passwordEncoder.encode(user.getAccount().getPassword()));
}
return repo.save(user);
}
@Override
public User findUser(long id) throws NotFoundException {
if (!repo.existsById(id))
throw new NotFoundException("USER.NOT.FOUND", "No user found with id: " + id);
return repo.findById(id).get();
}
@Override
public List<User> findAllUsers() {
List<User> users = repo.findAll();
users.stream().filter(user -> Objects.nonNull(user.getAccount()))
.collect(Collectors.toList())
.forEach(user -> {
user.getAccount().setPassword(null);
});
return users;
}
@Override
public void deleteUser(long id) throws NotFoundException {
if (!repo.existsById(id))
throw new NotFoundException("USER.NOT.FOUND", "No user found with id: " + id);
repo.deleteById(id);
}
@Override
public List<User> searchUsers(User userDto) throws NotFoundException {
// TODO Auto-generated method stub
return null;
}
@Override
public User updateUser(User user) throws NotFoundException {
if (!repo.existsById(user.getId()))
throw new NotFoundException("USER.NOT.FOUND", "No user found with id: " + user.getId());
return repo.save(user);
}
@Override
public User findUserByUsername(String username) throws NotFoundException {
User user = repo.findByAccountUsername(username);
if (user == null)
throw new NotFoundException("USER.NOT.FOUND", "No user found with username: " + username);
return user;
}
}
| UTF-8 | Java | 2,533 | java | UserService.java | Java | [] | null | [] | package ma.fgs.product.service;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import ma.fgs.product.domain.Role;
import ma.fgs.product.domain.User;
import ma.fgs.product.repository.UserRepository;
import ma.fgs.product.service.api.IRoleService;
import ma.fgs.product.service.api.IUserService;
import ma.fgs.product.service.exception.NotFoundException;
@Service
public class UserService implements IUserService {
@Autowired
private UserRepository repo;
@Autowired
private IRoleService roleService;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
@Override
public User addUser(User user) {
if(repo.count() == 0) {
user.setRole(roleService.getRoleAdmin());
} else {
if( user.getRole() == null ) {
Role role = roleService.getRoleUser();
user.setRole(role);
}
}
if (user.getAccount() != null) {
user.getAccount().setPassword(passwordEncoder.encode(user.getAccount().getPassword()));
}
return repo.save(user);
}
@Override
public User findUser(long id) throws NotFoundException {
if (!repo.existsById(id))
throw new NotFoundException("USER.NOT.FOUND", "No user found with id: " + id);
return repo.findById(id).get();
}
@Override
public List<User> findAllUsers() {
List<User> users = repo.findAll();
users.stream().filter(user -> Objects.nonNull(user.getAccount()))
.collect(Collectors.toList())
.forEach(user -> {
user.getAccount().setPassword(null);
});
return users;
}
@Override
public void deleteUser(long id) throws NotFoundException {
if (!repo.existsById(id))
throw new NotFoundException("USER.NOT.FOUND", "No user found with id: " + id);
repo.deleteById(id);
}
@Override
public List<User> searchUsers(User userDto) throws NotFoundException {
// TODO Auto-generated method stub
return null;
}
@Override
public User updateUser(User user) throws NotFoundException {
if (!repo.existsById(user.getId()))
throw new NotFoundException("USER.NOT.FOUND", "No user found with id: " + user.getId());
return repo.save(user);
}
@Override
public User findUserByUsername(String username) throws NotFoundException {
User user = repo.findByAccountUsername(username);
if (user == null)
throw new NotFoundException("USER.NOT.FOUND", "No user found with username: " + username);
return user;
}
}
| 2,533 | 0.736676 | 0.736281 | 93 | 26.236559 | 25.127373 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.602151 | false | false | 5 |
e0e15d823a10063f89dbddd0e5ec06395e3f4e08 | 4,707,284,170,179 | 5312c22980ba5bd59a637a058e2539ef36616b71 | /app/src/main/java/com/example/xiaoyi_test_2/Utils/Base36Utils.java | 9da2921941b9330c623dd4be9d24f52e27cbd795 | [] | no_license | XiaoGao128/XiaoYi | https://github.com/XiaoGao128/XiaoYi | 162cb09a5ac2c9ce9182091602ec284c8a3da1df | f9f1033815b20a3e9d732003a9575017d2484696 | refs/heads/master | 2022-07-10T10:40:27.461000 | 2020-05-12T07:49:27 | 2020-05-12T07:49:27 | 263,268,821 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.xiaoyi_test_2.Utils;
import android.util.Base64;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class Base36Utils {
/**
* 将图片转换成Base64编码的字符串
*/
public static String imageToBase64(File file){
FileInputStream is = null;
byte[] data = null;
String result = null;
try{
is = new FileInputStream(file);
//创建一个字符流大小的数组。
data = new byte[is.available()];
//写入数组
is.read(data);
//用默认的编码格式进行编码
result = Base64.encodeToString(data,Base64.NO_CLOSE);
}catch (Exception e){
e.printStackTrace();
}finally {
if(null !=is){
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return result;
}
}
| UTF-8 | Java | 1,037 | java | Base36Utils.java | Java | [] | null | [] | package com.example.xiaoyi_test_2.Utils;
import android.util.Base64;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class Base36Utils {
/**
* 将图片转换成Base64编码的字符串
*/
public static String imageToBase64(File file){
FileInputStream is = null;
byte[] data = null;
String result = null;
try{
is = new FileInputStream(file);
//创建一个字符流大小的数组。
data = new byte[is.available()];
//写入数组
is.read(data);
//用默认的编码格式进行编码
result = Base64.encodeToString(data,Base64.NO_CLOSE);
}catch (Exception e){
e.printStackTrace();
}finally {
if(null !=is){
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return result;
}
}
| 1,037 | 0.503665 | 0.490052 | 39 | 23.487179 | 14.923517 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435897 | false | false | 5 |
940b555052288090edd5a24aad26a5b2f38778fa | 20,160,576,499,483 | ef3e420901429ad433044a96bf5cf5f34bfcafc1 | /Android_SpeedSDK /AndroidSpeedDeveloper/MyApplication/app/src/main/java/com/example/zengzhaolin/myapplication/Kit.java | 67149499182c2d9df341536a174d3225588663f3 | [] | no_license | zeng4250538/Andriod_Speed_SDK | https://github.com/zeng4250538/Andriod_Speed_SDK | fd66602985fb7a692fbd00e753db6b1499064975 | 4f37257fc7d1334d957fd1fab183446f35aa37a1 | refs/heads/master | 2021-01-09T06:35:30.839000 | 2017-02-06T02:31:28 | 2017-02-06T02:31:28 | 81,011,631 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.zengzhaolin.myapplication;
import android.content.Context;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by zengzhaolin on 2016/12/15.
*/
public class Kit implements RequestBaseUrl {
public String startSpeedService(Context self) throws ParseException {
if (new DateJudge().dateJudge(self)==true) {
String number = new RequestHelper().GET("http://120.196.166.113/bdproxy/?appid=tencent");
try {
JSONObject json = new JSONObject(number);
String objectString = json.getString("result");
if (objectString != null) {
String speedService = new RequestHelper().POST("http://120.197.27.91:9180/services/AACAPIV1/applyTecentGamesQoS", "{\"UserIdentifier\":{\"IP\":\"" + json.getString("privateip") + "\",\"MSISDN\":\"" + json.getString("result") + "\"},\"ServiceId\":\"1000000117\",\"ResourceFeatureProperties\":[{\"Type\":0,\"Priority\":1,\"FlowProperties\":[{\"Direction\":2,\"SourceIpAddress\":\"10.229.160.177\",\"DestinationIpAddress\":\"223.167.81.81\",\"SourcePort\":40666,\"DestinationPort\":80,\"Protocol\":\"UDP\",\"MaximumUpStreamSpeedRate\":102400,\"MaximumDownStreamSpeedRate\":102400}]}], \"Duration\":1800}", json.getString("privateip"));
Log.i("Info", "post请求的结果" + speedService);
if (speedService != "请求异常" || speedService != "网络访问失败") {
JSONObject speedJson = new JSONObject(speedService);
String speedServiceString = speedJson.getString("CorrelationId");
//储存id
StoreDataKit object = new StoreDataKit();
object.sharedPreferencesData("CorrelationId", speedServiceString, self);
//储存请求成功的时间
Date dates = new Date();
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = format.format(dates);
object.sharedPreferencesData("date", time, self);
Log.i("Info", "当前时间:" + object.getSharedPreferencesData("date", self));
return speedServiceString;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return "";
}
return "未超时";
}
public String endSpeedService(Context self){
StoreDataKit OJ = new StoreDataKit();
String number = new RequestHelper().DELETE("http://120.197.27.91:9180/services/AACAPIV1/removeTecentGamesQoS/"+OJ.getSharedPreferencesData("CorrelationId",self));
OJ.deleteStoreData(self);
return number;
}
}
| UTF-8 | Java | 3,014 | java | Kit.java | Java | [
{
"context": "eFormat;\nimport java.util.Date;\n\n/**\n * Created by zengzhaolin on 2016/12/15.\n */\n\n\npublic class Kit implements",
"end": 316,
"score": 0.9996625781059265,
"start": 305,
"tag": "USERNAME",
"value": "zengzhaolin"
},
{
"context": " String number = new RequestHelp... | null | [] | package com.example.zengzhaolin.myapplication;
import android.content.Context;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by zengzhaolin on 2016/12/15.
*/
public class Kit implements RequestBaseUrl {
public String startSpeedService(Context self) throws ParseException {
if (new DateJudge().dateJudge(self)==true) {
String number = new RequestHelper().GET("http://172.16.58.3/bdproxy/?appid=tencent");
try {
JSONObject json = new JSONObject(number);
String objectString = json.getString("result");
if (objectString != null) {
String speedService = new RequestHelper().POST("http://172.16.31.10:9180/services/AACAPIV1/applyTecentGamesQoS", "{\"UserIdentifier\":{\"IP\":\"" + json.getString("privateip") + "\",\"MSISDN\":\"" + json.getString("result") + "\"},\"ServiceId\":\"1000000117\",\"ResourceFeatureProperties\":[{\"Type\":0,\"Priority\":1,\"FlowProperties\":[{\"Direction\":2,\"SourceIpAddress\":\"10.229.160.177\",\"DestinationIpAddress\":\"192.168.127.12\",\"SourcePort\":40666,\"DestinationPort\":80,\"Protocol\":\"UDP\",\"MaximumUpStreamSpeedRate\":102400,\"MaximumDownStreamSpeedRate\":102400}]}], \"Duration\":1800}", json.getString("privateip"));
Log.i("Info", "post请求的结果" + speedService);
if (speedService != "请求异常" || speedService != "网络访问失败") {
JSONObject speedJson = new JSONObject(speedService);
String speedServiceString = speedJson.getString("CorrelationId");
//储存id
StoreDataKit object = new StoreDataKit();
object.sharedPreferencesData("CorrelationId", speedServiceString, self);
//储存请求成功的时间
Date dates = new Date();
DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = format.format(dates);
object.sharedPreferencesData("date", time, self);
Log.i("Info", "当前时间:" + object.getSharedPreferencesData("date", self));
return speedServiceString;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return "";
}
return "未超时";
}
public String endSpeedService(Context self){
StoreDataKit OJ = new StoreDataKit();
String number = new RequestHelper().DELETE("http://172.16.31.10:9180/services/AACAPIV1/removeTecentGamesQoS/"+OJ.getSharedPreferencesData("CorrelationId",self));
OJ.deleteStoreData(self);
return number;
}
}
| 3,009 | 0.590909 | 0.554613 | 74 | 38.837837 | 79.081047 | 652 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.756757 | false | false | 5 |
51c037032587e7e485950ef4bbe31a5f76f4b269 | 11,218,454,592,913 | d426a6a34da947c8a1a4b3f43849366c1e656e6a | /app/src/main/java/materialteste/com/br/porteiroadmin/activitys/PortariaDeletar.java | b43aee50a9a36b6b60dd8be522c60e590245bc34 | [] | no_license | jramal/PorteiroAdmin | https://github.com/jramal/PorteiroAdmin | 710da2a99cf1d63f911c115f0ba61de49c98492e | 1bee9e932ed80cee6228edaabda9723aaaf28a3f | refs/heads/master | 2021-01-12T08:46:08.812000 | 2015-09-03T03:23:19 | 2015-09-03T03:23:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package materialteste.com.br.porteiroadmin.activitys;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import materialteste.com.br.porteiroadmin.R;
import materialteste.com.br.porteiroadmin.dao.portariaDAO;
import materialteste.com.br.porteiroadmin.vo.portariaVO;
public class PortariaDeletar extends Activity {
private int ID = 0;
private Button btnDeletarVis;
private Button btnEncerrarVis;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lay_portaria_deletar);
Intent it = getIntent();
ID = it.getIntExtra("codigo", 1);
final portariaDAO dao = new portariaDAO(getBaseContext());
final portariaVO vo = dao.getById(ID);
btnDeletarVis = (Button)findViewById(R.id.btnDeletarVis);
btnEncerrarVis = (Button)findViewById(R.id.btnEncerrarVis);
btnDeletarVis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder msg = new AlertDialog.Builder(PortariaDeletar.this);
msg.setMessage("Deseja excluir esta visita ?");
msg.setPositiveButton("SIM", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (dao.delete(vo)){
Toast.makeText(getBaseContext(), "Sucesso!", Toast.LENGTH_SHORT).show();
finish();
}
}
});
msg.setNegativeButton("NÂO", null);
msg.show();
}
});
btnEncerrarVis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder msg = new AlertDialog.Builder(PortariaDeletar.this);
msg.setMessage("Deseja encerrar esta visita ?");
msg.setPositiveButton("SIM", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (dao.delete(vo)){
Toast.makeText(getBaseContext(), "Sucesso!", Toast.LENGTH_SHORT).show();
finish();
}
}
});
msg.setNegativeButton("NÂO", null);
msg.show();
}
});
}
}
| UTF-8 | Java | 2,949 | java | PortariaDeletar.java | Java | [] | null | [] | package materialteste.com.br.porteiroadmin.activitys;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import materialteste.com.br.porteiroadmin.R;
import materialteste.com.br.porteiroadmin.dao.portariaDAO;
import materialteste.com.br.porteiroadmin.vo.portariaVO;
public class PortariaDeletar extends Activity {
private int ID = 0;
private Button btnDeletarVis;
private Button btnEncerrarVis;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lay_portaria_deletar);
Intent it = getIntent();
ID = it.getIntExtra("codigo", 1);
final portariaDAO dao = new portariaDAO(getBaseContext());
final portariaVO vo = dao.getById(ID);
btnDeletarVis = (Button)findViewById(R.id.btnDeletarVis);
btnEncerrarVis = (Button)findViewById(R.id.btnEncerrarVis);
btnDeletarVis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder msg = new AlertDialog.Builder(PortariaDeletar.this);
msg.setMessage("Deseja excluir esta visita ?");
msg.setPositiveButton("SIM", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (dao.delete(vo)){
Toast.makeText(getBaseContext(), "Sucesso!", Toast.LENGTH_SHORT).show();
finish();
}
}
});
msg.setNegativeButton("NÂO", null);
msg.show();
}
});
btnEncerrarVis.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder msg = new AlertDialog.Builder(PortariaDeletar.this);
msg.setMessage("Deseja encerrar esta visita ?");
msg.setPositiveButton("SIM", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (dao.delete(vo)){
Toast.makeText(getBaseContext(), "Sucesso!", Toast.LENGTH_SHORT).show();
finish();
}
}
});
msg.setNegativeButton("NÂO", null);
msg.show();
}
});
}
}
| 2,949 | 0.5962 | 0.595182 | 81 | 35.382717 | 26.375994 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 5 |
f1704800b49bcb719c0fb905a48eb18763c272c1 | 17,480,516,908,459 | 3c281f40e18c0834ccb91e19d66d378d305f0c00 | /src/offer/ReverseList/Solution.java | 4c51a69d15b0064f93b2a54dea2df0e037cd7edf | [] | no_license | jxq0816/sword2offer-java | https://github.com/jxq0816/sword2offer-java | 35f14245fe9cf51065e19a1cb62332242338b8e1 | 844ef529d7a81c304fe4c0e7f14c7687727df933 | refs/heads/master | 2021-07-17T22:55:48.134000 | 2020-05-02T14:58:10 | 2020-05-02T14:58:10 | 147,004,554 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package offer.ReverseList;
public class Solution {
// public ListNode ReverseList(ListNode head) {
// if(head== null){
// return null;
// }
// ListNode reverseHead = null;
// // 指针1:当前节点
// ListNode currentNode = head;
// // 指针2:当前节点的前一个节点
// ListNode prevNode = null;
// while(currentNode != null){
// // 指针3:当前节点的后一个节点
// ListNode nextNode = currentNode.next;
// if(nextNode == null){
// reverseHead = currentNode;
// }
// // 指针翻转
// currentNode.next = prevNode;
// // 将前一个节点指向当前节点
// prevNode = currentNode;
// // 将当前节点指向后一个节点
// currentNode = nextNode;
// }
// return reverseHead;
// }
public ListNode ReverseList(ListNode head) {
if(head==null || head.next==null){
return head;
}
ListNode newList= ReverseList(head.next);
head.next.next=head;//翻转指向
head.next=null;//记得赋值NULL,防止链表错乱
return newList;
}
}
| UTF-8 | Java | 1,240 | java | Solution.java | Java | [] | null | [] | package offer.ReverseList;
public class Solution {
// public ListNode ReverseList(ListNode head) {
// if(head== null){
// return null;
// }
// ListNode reverseHead = null;
// // 指针1:当前节点
// ListNode currentNode = head;
// // 指针2:当前节点的前一个节点
// ListNode prevNode = null;
// while(currentNode != null){
// // 指针3:当前节点的后一个节点
// ListNode nextNode = currentNode.next;
// if(nextNode == null){
// reverseHead = currentNode;
// }
// // 指针翻转
// currentNode.next = prevNode;
// // 将前一个节点指向当前节点
// prevNode = currentNode;
// // 将当前节点指向后一个节点
// currentNode = nextNode;
// }
// return reverseHead;
// }
public ListNode ReverseList(ListNode head) {
if(head==null || head.next==null){
return head;
}
ListNode newList= ReverseList(head.next);
head.next.next=head;//翻转指向
head.next=null;//记得赋值NULL,防止链表错乱
return newList;
}
}
| 1,240 | 0.508272 | 0.505515 | 37 | 28.405405 | 13.751578 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.486486 | false | false | 5 |
804c0b6c95dc1d8be3f59f9fdb255a0095970878 | 20,401,094,668,048 | 780f52d24d51880d4c83b61628061b13632aa753 | /HipChatStandupBot/src/standupbot/commands/CommandSilentStart.java | 74e558c02056fc241dad717228e1891ae6108d27 | [] | no_license | beamersauce/hipchat_standup_bot | https://github.com/beamersauce/hipchat_standup_bot | 56f081464fbb8d29e378be8c6693acd8e0eb6219 | 269ad473a3400e38eda511b37347b4a202963a34 | refs/heads/master | 2021-01-01T05:49:12.313000 | 2015-09-01T18:39:47 | 2015-09-01T18:39:47 | 25,736,661 | 1 | 0 | null | false | 2014-12-15T12:32:07 | 2014-10-25T15:47:42 | 2014-12-14T21:26:28 | 2014-12-15T12:32:06 | 2,632 | 0 | 0 | 0 | Java | null | null | package standupbot.commands;
import java.util.ArrayList;
import java.util.List;
import standup.StandupBot;
import standupbot.data_model.BotData;
public class CommandSilentStart extends StandupCommand
{
private static String commandName = "silentstart";
//@Override
public void handleCommand(StandupBot bot, List<String> args, BotData botData)
{
botData.silentStart = !botData.silentStart;
if ( botData.silentStart )
bot.sendMessage("Enabled silent start");
else
bot.sendMessage("Disabled silent start");
}
//@Override
public StandupBotCommandHelp getHelpMessage()
{
List<String> help_commands = new ArrayList<String>();
return new StandupBotCommandHelp(help_commands, "turns on/off startup text when bot first turns on");
}
//@Override
public String getCommandName()
{
return commandName;
}
//@Override
public String getDisplayMessage(StandupBot bot, BotData botData)
{
return "SilentStart enabled: " + botData.silentStart;
}
}
| UTF-8 | Java | 977 | java | CommandSilentStart.java | Java | [] | null | [] | package standupbot.commands;
import java.util.ArrayList;
import java.util.List;
import standup.StandupBot;
import standupbot.data_model.BotData;
public class CommandSilentStart extends StandupCommand
{
private static String commandName = "silentstart";
//@Override
public void handleCommand(StandupBot bot, List<String> args, BotData botData)
{
botData.silentStart = !botData.silentStart;
if ( botData.silentStart )
bot.sendMessage("Enabled silent start");
else
bot.sendMessage("Disabled silent start");
}
//@Override
public StandupBotCommandHelp getHelpMessage()
{
List<String> help_commands = new ArrayList<String>();
return new StandupBotCommandHelp(help_commands, "turns on/off startup text when bot first turns on");
}
//@Override
public String getCommandName()
{
return commandName;
}
//@Override
public String getDisplayMessage(StandupBot bot, BotData botData)
{
return "SilentStart enabled: " + botData.silentStart;
}
}
| 977 | 0.75435 | 0.75435 | 41 | 22.829268 | 25.152124 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.439024 | false | false | 5 |
f3ccbefd86b5477740062c36ea00d1f0208dfc8a | 6,296,422,074,707 | 5c181e59fb9d5eaacc00d9cf215baec7f9a9cc01 | /HeladeriaProyectoFinal-ejb/src/java/ec/edu/itq/programacion2/heladeria/servicio/ProductoServicio.java | 0d44cc3708add8629c97c727e40212ba45ea08ac | [] | no_license | Pablo1999-zp/PoryectoEAR | https://github.com/Pablo1999-zp/PoryectoEAR | 03f690feb701975c695bff0e4c14d5a9235c31fd | b6e4ee97c64b52d635bc784a69759fb3b7775e3e | refs/heads/master | 2023-03-29T21:40:06.892000 | 2021-03-30T02:14:26 | 2021-03-30T02:14:26 | 352,838,291 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 ec.edu.itq.programacion2.heladeria.servicio;
import ec.edu.itq.programacion2.heladeria.modelo.Produto;
import ec.edu.itq.programacion2.heladeria.modelo.dao.ProdutoDao;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
/**
*
* @author User
*/
@Stateless
@LocalBean
public class ProductoServicio {
@EJB
private ProdutoDao produtoDao;
public List<Produto> buscarProducto(){
List<Produto> listaProduto = produtoDao.buscarProducto();
return listaProduto;
}
}
| UTF-8 | Java | 748 | java | ProductoServicio.java | Java | [
{
"context": "ss;\nimport javax.ejb.LocalBean;\n\n/**\n *\n * @author User\n */\n@Stateless\n@LocalBean\npublic class ProductoSe",
"end": 486,
"score": 0.8214455246925354,
"start": 482,
"tag": "USERNAME",
"value": "User"
}
] | null | [] | /*
* 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 ec.edu.itq.programacion2.heladeria.servicio;
import ec.edu.itq.programacion2.heladeria.modelo.Produto;
import ec.edu.itq.programacion2.heladeria.modelo.dao.ProdutoDao;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
/**
*
* @author User
*/
@Stateless
@LocalBean
public class ProductoServicio {
@EJB
private ProdutoDao produtoDao;
public List<Produto> buscarProducto(){
List<Produto> listaProduto = produtoDao.buscarProducto();
return listaProduto;
}
}
| 748 | 0.73262 | 0.72861 | 33 | 21.666666 | 22.800407 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.393939 | false | false | 5 |
215c0cbc7b50bf5beb0cb1a8ee6eeda0269ec797 | 25,434,796,359,071 | a996a1404ce3dd1944f9fa775cba9c9d8e0601f5 | /src/main/java/com/kakao/task/sprinkle/global/exception/GlobalControllerAdvice.java | d03b9e5472daf931d1d8482fc986ff092a13faf0 | [] | no_license | yeob32/kakaopay-sprinkle | https://github.com/yeob32/kakaopay-sprinkle | 983528de30d34e0d1776af1ce716c44d94c8834b | 566b2f71eeec30aca6882fc0e8f2237fbeb9c34b | refs/heads/master | 2022-11-09T12:15:39.337000 | 2020-07-01T14:12:28 | 2020-07-01T14:12:28 | 275,280,885 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kakao.task.sprinkle.global.exception;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
@Slf4j
@ControllerAdvice
public class GlobalControllerAdvice {
@ExceptionHandler(ApiException.class)
protected ResponseEntity<ErrorResponse> handleBusinessException(final ApiException e) {
log.error("handle API Exception > ", e);
return new ResponseEntity<>(ErrorResponse.of(e), HttpStatus.valueOf(e.getErrorCode().getStatus()));
}
@ExceptionHandler(MissingServletRequestParameterException.class)
protected ResponseEntity<ErrorResponse> handleMissingParams(MissingServletRequestParameterException e) {
return new ResponseEntity<>(ErrorResponse.of(ErrorCode.REQUIRED_PARAMETER, e.getMessage()), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(BindException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
protected ErrorResponse handleBindException(BindException e) {
return ErrorResponse.of(ErrorCode.INVALID_INPUT_VALUE, e.getMessage());
}
}
| UTF-8 | Java | 1,415 | java | GlobalControllerAdvice.java | Java | [] | null | [] | package com.kakao.task.sprinkle.global.exception;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
@Slf4j
@ControllerAdvice
public class GlobalControllerAdvice {
@ExceptionHandler(ApiException.class)
protected ResponseEntity<ErrorResponse> handleBusinessException(final ApiException e) {
log.error("handle API Exception > ", e);
return new ResponseEntity<>(ErrorResponse.of(e), HttpStatus.valueOf(e.getErrorCode().getStatus()));
}
@ExceptionHandler(MissingServletRequestParameterException.class)
protected ResponseEntity<ErrorResponse> handleMissingParams(MissingServletRequestParameterException e) {
return new ResponseEntity<>(ErrorResponse.of(ErrorCode.REQUIRED_PARAMETER, e.getMessage()), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(BindException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
protected ErrorResponse handleBindException(BindException e) {
return ErrorResponse.of(ErrorCode.INVALID_INPUT_VALUE, e.getMessage());
}
}
| 1,415 | 0.802827 | 0.800707 | 32 | 43.21875 | 35.20097 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false | 5 |
a2d0abd7c440df3b775b47db43a9006e496d8d30 | 20,332,375,206,226 | d86346336d604557c541413c9232714bc14906a7 | /app/src/main/java/me/hwproj/mafiagame/content/phases/vote/VotePhaseGameState.java | 743c3f915452e1af6a45001597f256de9bf78999 | [] | no_license | Krock21rus/MafiaGame | https://github.com/Krock21rus/MafiaGame | 478f72f798497e13ba8508087b429498a63460c2 | 843f8558aa26f05002359ea4349e5e7d152f5b22 | refs/heads/master | 2020-05-07T20:56:19.529000 | 2020-02-03T17:22:50 | 2020-02-03T17:22:50 | 180,883,199 | 2 | 0 | null | false | 2019-05-28T19:14:11 | 2019-04-11T21:49:38 | 2019-05-28T19:13:35 | 2019-05-28T19:14:10 | 304 | 1 | 0 | 0 | Java | false | false | package me.hwproj.mafiagame.content.phases.vote;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import me.hwproj.mafiagame.networking.serialization.DeserializationException;
import me.hwproj.mafiagame.networking.serialization.SerializationException;
import me.hwproj.mafiagame.phase.GameState;
public class VotePhaseGameState extends GameState {
public boolean end;
public boolean[] cantChoose;
public int killedPlayer;
public void serialize(DataOutputStream out) throws SerializationException {
try {
if (end) {
out.writeByte(1);
out.writeInt(killedPlayer);
return;
}
out.writeByte(0);
out.writeInt(cantChoose.length);
for (boolean p : cantChoose) {
out.writeBoolean(p);
}
} catch (IOException e) {
throw new SerializationException(e);
}
}
public static VotePhaseGameState deserialize(DataInputStream in) throws DeserializationException {
try {
byte b = in.readByte();
if (b != 0) {
int killedPlayer = in.readInt();
return killed(killedPlayer);
}
int length = in.readInt();
boolean[] cantChoose = new boolean[length];
for (int i = 0; i < length; i++) {
cantChoose[i] = in.readBoolean();
}
return choises(cantChoose);
} catch (IOException e) {
throw new DeserializationException(e);
}
}
private static VotePhaseGameState killed(int killedPlayer) {
VotePhaseGameState s = new VotePhaseGameState();
s.end = true;
s.killedPlayer = killedPlayer;
return s;
}
private static VotePhaseGameState choises(boolean[] cantChoose) {
VotePhaseGameState s = new VotePhaseGameState();
s.end = false;
s.cantChoose = cantChoose;
return s;
}
}
| UTF-8 | Java | 2,041 | java | VotePhaseGameState.java | Java | [] | null | [] | package me.hwproj.mafiagame.content.phases.vote;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import me.hwproj.mafiagame.networking.serialization.DeserializationException;
import me.hwproj.mafiagame.networking.serialization.SerializationException;
import me.hwproj.mafiagame.phase.GameState;
public class VotePhaseGameState extends GameState {
public boolean end;
public boolean[] cantChoose;
public int killedPlayer;
public void serialize(DataOutputStream out) throws SerializationException {
try {
if (end) {
out.writeByte(1);
out.writeInt(killedPlayer);
return;
}
out.writeByte(0);
out.writeInt(cantChoose.length);
for (boolean p : cantChoose) {
out.writeBoolean(p);
}
} catch (IOException e) {
throw new SerializationException(e);
}
}
public static VotePhaseGameState deserialize(DataInputStream in) throws DeserializationException {
try {
byte b = in.readByte();
if (b != 0) {
int killedPlayer = in.readInt();
return killed(killedPlayer);
}
int length = in.readInt();
boolean[] cantChoose = new boolean[length];
for (int i = 0; i < length; i++) {
cantChoose[i] = in.readBoolean();
}
return choises(cantChoose);
} catch (IOException e) {
throw new DeserializationException(e);
}
}
private static VotePhaseGameState killed(int killedPlayer) {
VotePhaseGameState s = new VotePhaseGameState();
s.end = true;
s.killedPlayer = killedPlayer;
return s;
}
private static VotePhaseGameState choises(boolean[] cantChoose) {
VotePhaseGameState s = new VotePhaseGameState();
s.end = false;
s.cantChoose = cantChoose;
return s;
}
}
| 2,041 | 0.600686 | 0.598726 | 67 | 29.462687 | 23.089914 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.522388 | false | false | 5 |
5140ef9fa930ba378803ad4ecdd172cedfae09d0 | 30,073,361,043,507 | e524815ffd309b0a7ebb5f5cc406a399d818073a | /app/src/main/java/com/grobo/notifications/services/lostandfound/NewLostAndFound.java | b807fb269309adcaef6209149db64962b9d2f003 | [
"MIT"
] | permissive | NJACKWinterOfCode/IITP-App | https://github.com/NJACKWinterOfCode/IITP-App | 28811441bf3a0a97630d6abbabc0006921c9f7a8 | 0261f20e8c1e7d8f3654f749d9d14d2214a151b8 | refs/heads/development | 2020-09-22T05:23:32.879000 | 2020-01-06T06:38:16 | 2020-01-06T06:38:16 | 225,065,422 | 1 | 5 | MIT | true | 2020-01-06T06:38:18 | 2019-11-30T20:20:42 | 2020-01-03T15:06:38 | 2020-01-06T06:38:17 | 1,494 | 1 | 5 | 4 | Java | false | false | package com.grobo.notifications.services.lostandfound;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.ArrayMap;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.grobo.notifications.R;
import com.grobo.notifications.network.LostAndFoundRoutes;
import com.grobo.notifications.network.RetrofitClientInstance;
import org.json.JSONObject;
import java.util.Map;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static com.grobo.notifications.utils.Constants.USER_MONGO_ID;
import static com.grobo.notifications.utils.Constants.USER_TOKEN;
public class NewLostAndFound extends Fragment implements View.OnClickListener {
public NewLostAndFound() {
}
private ProgressDialog progressDialog;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_new_lost_found, container, false);
Button postButton = view.findViewById(R.id.post_lost_found);
postButton.setOnClickListener(this);
progressDialog = new ProgressDialog(getContext());
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
return view;
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.post_lost_found) {
validatePost();
}
}
private void validatePost() {
boolean valid = true;
TextView name = getView().findViewById(R.id.lost_found_name);
TextView description = getView().findViewById(R.id.lost_found_description);
TextView place = getView().findViewById(R.id.lost_found_place);
TextView time = getView().findViewById(R.id.lost_found_time);
TextView date = getView().findViewById(R.id.lost_found_date);
TextView contact = getView().findViewById(R.id.lost_found_contact);
RadioGroup status = getView().findViewById(R.id.radio_group_lost_found);
if (name.getText().toString().isEmpty()) {
name.setError("Please enter a valid title");
valid = false;
} else {
name.setError(null);
}
if (place.getText().toString().isEmpty()) {
place.setError("Please enter a description");
valid = false;
} else {
place.setError(null);
}
if (time.getText().toString().isEmpty()) {
time.setError("Please enter a valid venue");
valid = false;
} else {
time.setError(null);
}
if (date.getText().toString().isEmpty()) {
date.setError("Please enter a valid venue");
valid = false;
} else {
date.setError(null);
}
if (contact.getText().toString().isEmpty()) {
contact.setError("Please enter a valid venue");
valid = false;
} else {
contact.setError(null);
}
int statusNumber;
switch (status.getCheckedRadioButtonId()) {
case R.id.radio_lost:
statusNumber = 1;
break;
case R.id.radio_found:
statusNumber = 2;
break;
default:
statusNumber = 0;
}
if (valid) {
progressDialog.setMessage("Posting Lost and found...");
progressDialog.show();
String feedPoster = PreferenceManager.getDefaultSharedPreferences(getContext()).getString(USER_MONGO_ID, "");
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("lostnfoundPoster", feedPoster);
jsonParams.put("date", date.getText().toString());
jsonParams.put("time", time.getText().toString());
jsonParams.put("name", name.getText().toString());
jsonParams.put("place", place.getText().toString());
jsonParams.put("description", description.getText().toString());
jsonParams.put("contact", contact.getText().toString());
jsonParams.put("lostStatus", statusNumber);
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), (new JSONObject(jsonParams)).toString());
String token = PreferenceManager.getDefaultSharedPreferences(getContext()).getString(USER_TOKEN, "0");
LostAndFoundRoutes service = RetrofitClientInstance.getRetrofitInstance().create(LostAndFoundRoutes.class);
Call<ResponseBody> call = service.postLostNFound(token, body);
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
if (response.isSuccessful()) {
Toast.makeText(getContext(), "Posted Successfully.", Toast.LENGTH_SHORT).show();
getActivity().finish();
} else {
Log.e("failure", String.valueOf(response.message()));
}
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
Toast.makeText(getContext(), "Post failed, please try again", Toast.LENGTH_LONG).show();
}
});
}
}
}
| UTF-8 | Java | 6,051 | java | NewLostAndFound.java | Java | [] | null | [] | package com.grobo.notifications.services.lostandfound;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.ArrayMap;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import com.grobo.notifications.R;
import com.grobo.notifications.network.LostAndFoundRoutes;
import com.grobo.notifications.network.RetrofitClientInstance;
import org.json.JSONObject;
import java.util.Map;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static com.grobo.notifications.utils.Constants.USER_MONGO_ID;
import static com.grobo.notifications.utils.Constants.USER_TOKEN;
public class NewLostAndFound extends Fragment implements View.OnClickListener {
public NewLostAndFound() {
}
private ProgressDialog progressDialog;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_new_lost_found, container, false);
Button postButton = view.findViewById(R.id.post_lost_found);
postButton.setOnClickListener(this);
progressDialog = new ProgressDialog(getContext());
progressDialog.setCancelable(false);
progressDialog.setIndeterminate(true);
return view;
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.post_lost_found) {
validatePost();
}
}
private void validatePost() {
boolean valid = true;
TextView name = getView().findViewById(R.id.lost_found_name);
TextView description = getView().findViewById(R.id.lost_found_description);
TextView place = getView().findViewById(R.id.lost_found_place);
TextView time = getView().findViewById(R.id.lost_found_time);
TextView date = getView().findViewById(R.id.lost_found_date);
TextView contact = getView().findViewById(R.id.lost_found_contact);
RadioGroup status = getView().findViewById(R.id.radio_group_lost_found);
if (name.getText().toString().isEmpty()) {
name.setError("Please enter a valid title");
valid = false;
} else {
name.setError(null);
}
if (place.getText().toString().isEmpty()) {
place.setError("Please enter a description");
valid = false;
} else {
place.setError(null);
}
if (time.getText().toString().isEmpty()) {
time.setError("Please enter a valid venue");
valid = false;
} else {
time.setError(null);
}
if (date.getText().toString().isEmpty()) {
date.setError("Please enter a valid venue");
valid = false;
} else {
date.setError(null);
}
if (contact.getText().toString().isEmpty()) {
contact.setError("Please enter a valid venue");
valid = false;
} else {
contact.setError(null);
}
int statusNumber;
switch (status.getCheckedRadioButtonId()) {
case R.id.radio_lost:
statusNumber = 1;
break;
case R.id.radio_found:
statusNumber = 2;
break;
default:
statusNumber = 0;
}
if (valid) {
progressDialog.setMessage("Posting Lost and found...");
progressDialog.show();
String feedPoster = PreferenceManager.getDefaultSharedPreferences(getContext()).getString(USER_MONGO_ID, "");
Map<String, Object> jsonParams = new ArrayMap<>();
jsonParams.put("lostnfoundPoster", feedPoster);
jsonParams.put("date", date.getText().toString());
jsonParams.put("time", time.getText().toString());
jsonParams.put("name", name.getText().toString());
jsonParams.put("place", place.getText().toString());
jsonParams.put("description", description.getText().toString());
jsonParams.put("contact", contact.getText().toString());
jsonParams.put("lostStatus", statusNumber);
RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), (new JSONObject(jsonParams)).toString());
String token = PreferenceManager.getDefaultSharedPreferences(getContext()).getString(USER_TOKEN, "0");
LostAndFoundRoutes service = RetrofitClientInstance.getRetrofitInstance().create(LostAndFoundRoutes.class);
Call<ResponseBody> call = service.postLostNFound(token, body);
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
if (response.isSuccessful()) {
Toast.makeText(getContext(), "Posted Successfully.", Toast.LENGTH_SHORT).show();
getActivity().finish();
} else {
Log.e("failure", String.valueOf(response.message()));
}
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
if (progressDialog.isShowing()) {
progressDialog.dismiss();
}
Toast.makeText(getContext(), "Post failed, please try again", Toast.LENGTH_LONG).show();
}
});
}
}
}
| 6,051 | 0.608494 | 0.606677 | 169 | 34.804733 | 29.455067 | 151 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.668639 | false | false | 5 |
9402aa39adb57eab855a6dfd457f8975b33592c9 | 6,682,969,166,277 | 74f1d9c4cecd58262888ffed02101c1b6bedfe13 | /src/main/java/com/chinaxiaopu/xiaopuMobi/service/topic/VoteResultDetailService.java | f190e97b6aec5e422d475a60f424af2dabb442fb | [] | no_license | wwm0104/xiaopu | https://github.com/wwm0104/xiaopu | 341da3f711c0682d3bc650ac62179935330c27b2 | ddb1b57c84cc6e6fdfdd82c2e998eea341749c87 | refs/heads/master | 2021-01-01T04:38:42.376000 | 2017-07-13T15:44:19 | 2017-07-13T15:44:19 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.chinaxiaopu.xiaopuMobi.service.topic;
import com.chinaxiaopu.xiaopuMobi.config.SystemConfig;
import com.chinaxiaopu.xiaopuMobi.dto.topic.PKResultDetailDto;
import com.chinaxiaopu.xiaopuMobi.mapper.PkResultMapper;
import com.chinaxiaopu.xiaopuMobi.mapper.TopicMapper;
import com.chinaxiaopu.xiaopuMobi.model.Topic;
import com.chinaxiaopu.xiaopuMobi.util.StrUtils;
import com.chinaxiaopu.xiaopuMobi.vo.topic.PKResultDetailVo;
import com.chinaxiaopu.xiaopuMobi.vo.topic.PKResultListVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2016/11/3.
*/
@Slf4j
@Service
public class VoteResultDetailService {
@Autowired
private TopicMapper topicMapper;
@Autowired
private PkResultMapper pkResultMapper;
/**
* 获取PK结果基础数据
*
* @param pKResultDto
* @return
*/
public List<PKResultDetailVo> getPkDetail(PKResultDetailDto pKResultDto) {
String filePath = null;
try {
filePath = SystemConfig.getInstance().getImgsDomain();//图片路径
} catch (Exception e) {
e.printStackTrace();
}
Topic topic = topicMapper.selectByPrimaryKey(pKResultDto.getTopicId());
List<PKResultDetailVo> _list=null;
if(topic != null){
if(StrUtils.isNotEmpty(topic.getChallengeTopicId())){
pKResultDto.setTopicId(topic.getChallengeTopicId());
_list = topicMapper.getPkDetail(pKResultDto);
for (PKResultDetailVo vo : _list){
vo.setPath(filePath);
vo.setContentMap(vo.getContent());
}
}
}
return _list;
}
/**
* 获取Pk结果list数据
*
* @param pKResultDto
* @return
*/
public List<PKResultListVo> getPkResultList(PKResultDetailDto pKResultDto) {
List<PKResultListVo> _list = pkResultMapper.getPkResultList(pKResultDto);
String filePath = null;
try {
filePath = SystemConfig.getInstance().getImgsDomain();//图片路径
} catch (Exception e) {
e.printStackTrace();
}
for (PKResultListVo vo : _list) {
vo.setPath(filePath);
vo.setContentMap(vo.getContent().toString());
}
return _list;
}
}
| UTF-8 | Java | 2,490 | java | VoteResultDetailService.java | Java | [] | null | [] | package com.chinaxiaopu.xiaopuMobi.service.topic;
import com.chinaxiaopu.xiaopuMobi.config.SystemConfig;
import com.chinaxiaopu.xiaopuMobi.dto.topic.PKResultDetailDto;
import com.chinaxiaopu.xiaopuMobi.mapper.PkResultMapper;
import com.chinaxiaopu.xiaopuMobi.mapper.TopicMapper;
import com.chinaxiaopu.xiaopuMobi.model.Topic;
import com.chinaxiaopu.xiaopuMobi.util.StrUtils;
import com.chinaxiaopu.xiaopuMobi.vo.topic.PKResultDetailVo;
import com.chinaxiaopu.xiaopuMobi.vo.topic.PKResultListVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2016/11/3.
*/
@Slf4j
@Service
public class VoteResultDetailService {
@Autowired
private TopicMapper topicMapper;
@Autowired
private PkResultMapper pkResultMapper;
/**
* 获取PK结果基础数据
*
* @param pKResultDto
* @return
*/
public List<PKResultDetailVo> getPkDetail(PKResultDetailDto pKResultDto) {
String filePath = null;
try {
filePath = SystemConfig.getInstance().getImgsDomain();//图片路径
} catch (Exception e) {
e.printStackTrace();
}
Topic topic = topicMapper.selectByPrimaryKey(pKResultDto.getTopicId());
List<PKResultDetailVo> _list=null;
if(topic != null){
if(StrUtils.isNotEmpty(topic.getChallengeTopicId())){
pKResultDto.setTopicId(topic.getChallengeTopicId());
_list = topicMapper.getPkDetail(pKResultDto);
for (PKResultDetailVo vo : _list){
vo.setPath(filePath);
vo.setContentMap(vo.getContent());
}
}
}
return _list;
}
/**
* 获取Pk结果list数据
*
* @param pKResultDto
* @return
*/
public List<PKResultListVo> getPkResultList(PKResultDetailDto pKResultDto) {
List<PKResultListVo> _list = pkResultMapper.getPkResultList(pKResultDto);
String filePath = null;
try {
filePath = SystemConfig.getInstance().getImgsDomain();//图片路径
} catch (Exception e) {
e.printStackTrace();
}
for (PKResultListVo vo : _list) {
vo.setPath(filePath);
vo.setContentMap(vo.getContent().toString());
}
return _list;
}
}
| 2,490 | 0.654947 | 0.650859 | 77 | 30.766233 | 23.632959 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
fc9b07d8692feffc810ecb6138a977c7d3a4192c | 12,695,923,395,814 | 6f447fb9323232256b27520ebf0bb1f833ea3200 | /src/test/java/uk/gov/ch/developer/docs/ApplicationVariables.java | d8d75989bbb4429ea51013af635b246ca1ca5d97 | [
"MIT"
] | permissive | companieshouse/docs.developer.ch.gov.uk | https://github.com/companieshouse/docs.developer.ch.gov.uk | f41d7429ced76431a36887eafd9add2af32e6f79 | 05f568884538aa0b8da7af8f4f72c702102a2b7b | refs/heads/master | 2023-07-11T14:16:04.218000 | 2023-06-05T12:49:24 | 2023-06-05T12:49:24 | 219,485,882 | 2 | 1 | MIT | false | 2023-06-05T12:49:25 | 2019-11-04T11:30:00 | 2021-12-15T16:04:23 | 2023-06-05T12:49:24 | 709 | 2 | 1 | 1 | Java | false | false | package uk.gov.ch.developer.docs;
public final class ApplicationVariables {
public static final String BAD_REQUEST_URL = "bad-path";
public final String HOME_PATH = "/dev-hub";
public final String HOME_VIEW = "dev-hub/overview";
public final String GET_STARTED_PATH = "/dev-hub/getstarted";
public final String GET_STARTED_VIEW = "dev-hub/getStarted";
private ApplicationVariables() {
}
}
| UTF-8 | Java | 420 | java | ApplicationVariables.java | Java | [] | null | [] | package uk.gov.ch.developer.docs;
public final class ApplicationVariables {
public static final String BAD_REQUEST_URL = "bad-path";
public final String HOME_PATH = "/dev-hub";
public final String HOME_VIEW = "dev-hub/overview";
public final String GET_STARTED_PATH = "/dev-hub/getstarted";
public final String GET_STARTED_VIEW = "dev-hub/getStarted";
private ApplicationVariables() {
}
}
| 420 | 0.707143 | 0.707143 | 13 | 31.307692 | 25.577589 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 12 |
e96f38509b5bb2961e539465c9692f28d16d0a47 | 28,132,035,842,567 | 5045180ad1b2e3aa76a55a5979d243197a35d679 | /itrip-beans/src/main/java/com/xyh/service/impl/HotelRoomServiceImpl.java | ef1f0952a4fe919613cb6d46732ecd24bb2672ab | [] | no_license | Demo7781/itrip-project-demo | https://github.com/Demo7781/itrip-project-demo | d948290c51bdb8baea7c662ec6c5cceaf121195c | a5abf25f9dc30dd747b6ef1c61501431d67167c9 | refs/heads/master | 2023-01-06T12:45:36.154000 | 2020-11-07T01:35:14 | 2020-11-07T01:35:14 | 310,743,762 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xyh.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xyh.entity.HotelRoom;
import com.xyh.mapper.HotelRoomMapper;
import com.xyh.service.HotelRoomService;
/**
* @Author xyh
* @Dare 2020/11/6 15:29
* @description: ${description}
* @Version 1.0
*/
@Service
public class HotelRoomServiceImpl extends ServiceImpl<HotelRoomMapper, HotelRoom> implements HotelRoomService {
}
| UTF-8 | Java | 538 | java | HotelRoomServiceImpl.java | Java | [
{
"context": " com.xyh.service.HotelRoomService;\n\n/**\n * @Author xyh\n * @Dare 2020/11/6 15:29\n * @description: ${descr",
"end": 335,
"score": 0.9996548295021057,
"start": 332,
"tag": "USERNAME",
"value": "xyh"
}
] | null | [] | package com.xyh.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xyh.entity.HotelRoom;
import com.xyh.mapper.HotelRoomMapper;
import com.xyh.service.HotelRoomService;
/**
* @Author xyh
* @Dare 2020/11/6 15:29
* @description: ${description}
* @Version 1.0
*/
@Service
public class HotelRoomServiceImpl extends ServiceImpl<HotelRoomMapper, HotelRoom> implements HotelRoomService {
}
| 538 | 0.79368 | 0.769517 | 20 | 25.85 | 26.537285 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false | 12 |
3ece07d609bfd09c9f8ee424067be5e9425449b0 | 17,523,466,635,337 | 60afbc805cd083bb682d63b782c13be301d28e4b | /app/src/main/java/com/peekay/gitforone/MainActivity.java | ce639d96730254bb2fba0f94639e10495bdee689 | [] | no_license | 3248868588/GitForOne | https://github.com/3248868588/GitForOne | 2113ac5047dd428b7bd0152480c2030671e174cf | fa467853fc440664b3cd2f49a56caab1c18bb748 | refs/heads/master | 2020-12-06T16:43:14.494000 | 2020-01-08T08:33:53 | 2020-01-08T08:33:53 | 232,509,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.peekay.gitforone;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.peekay.gitforone.MY.MY1Activity;
public class MainActivity extends AppCompatActivity {
Class[] classes = {MY1Activity.class, MainActivity.class, MainActivity.class, MainActivity.class, MainActivity.class,
MainActivity.class, MainActivity.class, MainActivity.class, MainActivity.class};
String[] names = {"MY1Activity.class", "名字1(数量与上面的对应即可)", "名字(没有对应就不要点击listview)",
"名字(用于跳转页面)", "名字", "名字", "名字", "名字", "名字"};
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = findViewById(R.id.lv);
listView.setAdapter(new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, names));
listView.setOnItemClickListener((adapterView, view, i, l) -> {
startActivity(new Intent(MainActivity.this, classes[i]));
//finish(); //跳转完成后是否关闭此页面
});
}
}
| UTF-8 | Java | 1,387 | java | MainActivity.java | Java | [] | null | [] | package com.peekay.gitforone;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.peekay.gitforone.MY.MY1Activity;
public class MainActivity extends AppCompatActivity {
Class[] classes = {MY1Activity.class, MainActivity.class, MainActivity.class, MainActivity.class, MainActivity.class,
MainActivity.class, MainActivity.class, MainActivity.class, MainActivity.class};
String[] names = {"MY1Activity.class", "名字1(数量与上面的对应即可)", "名字(没有对应就不要点击listview)",
"名字(用于跳转页面)", "名字", "名字", "名字", "名字", "名字"};
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView = findViewById(R.id.lv);
listView.setAdapter(new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, names));
listView.setOnItemClickListener((adapterView, view, i, l) -> {
startActivity(new Intent(MainActivity.this, classes[i]));
//finish(); //跳转完成后是否关闭此页面
});
}
}
| 1,387 | 0.711705 | 0.708562 | 32 | 38.78125 | 31.494776 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.28125 | false | false | 12 |
afacf24c4484eb2163aec113b5b6cff579fbfa8c | 11,476,152,651,483 | 5eb7be08998b3cf4af5591eb5c81ebbd10292086 | /src/test/java/tasks/easy/Task58Test.java | c6249b9b8d290d27b3459de8a6305e68a46123cc | [] | no_license | Karinkaaa/LeetCode | https://github.com/Karinkaaa/LeetCode | 8e42d033f6aca516f55540db57a1b4a29fc44f17 | 105d9d545589b77bf9539df55d29c5ab5538a5e1 | refs/heads/master | 2021-07-07T20:32:16.246000 | 2020-01-18T00:56:10 | 2020-01-18T00:56:10 | 198,888,386 | 0 | 0 | null | false | 2020-10-13T18:55:27 | 2019-07-25T19:15:04 | 2020-01-18T00:56:20 | 2020-10-13T18:55:26 | 87 | 0 | 0 | 1 | Java | false | false | package tasks.easy;
import org.junit.Assert;
import org.junit.Test;
import static tasks.easy.Task58.lengthOfLastWord;
public class Task58Test {
@Test
public void lengthOfLastWordTest() {
Assert.assertEquals(5, lengthOfLastWord("Hello World"));
Assert.assertEquals(1, lengthOfLastWord("a "));
}
} | UTF-8 | Java | 328 | java | Task58Test.java | Java | [] | null | [] | package tasks.easy;
import org.junit.Assert;
import org.junit.Test;
import static tasks.easy.Task58.lengthOfLastWord;
public class Task58Test {
@Test
public void lengthOfLastWordTest() {
Assert.assertEquals(5, lengthOfLastWord("Hello World"));
Assert.assertEquals(1, lengthOfLastWord("a "));
}
} | 328 | 0.710366 | 0.692073 | 16 | 19.5625 | 21.142282 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 12 |
1708a6e4a0c676aefd4b4db5b9387423cf9d5dae | 13,700,945,717,366 | caf31a623cb98f10d991560fd7fa2457109ebb0d | /app/src/main/java/lk/ac/mrt/cse/medipal/adaptor/NotificationRecyclerViewAdaptor.java | a9b39043aa40aa0e26c635e8874add5e5a0b690d | [] | no_license | Team-FYP/Medi_Pal | https://github.com/Team-FYP/Medi_Pal | 1c846b1a82d4739aed9714eda0157278df45eb1b | 48c05f6c3a3e762d2255f3a3ad7a51b00fb43882 | refs/heads/master | 2021-01-23T01:21:18.823000 | 2017-11-21T01:13:14 | 2017-11-21T01:13:14 | 92,867,106 | 0 | 0 | null | false | 2017-11-21T01:13:15 | 2017-05-30T19:09:36 | 2017-05-30T19:13:17 | 2017-11-21T01:13:14 | 1,916 | 0 | 0 | 0 | Java | false | null | package lk.ac.mrt.cse.medipal.adaptor;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.gson.Gson;
import com.rilixtech.materialfancybutton.MaterialFancyButton;
import org.w3c.dom.Text;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import lk.ac.mrt.cse.medipal.R;
import lk.ac.mrt.cse.medipal.constant.Common;
import lk.ac.mrt.cse.medipal.constant.ObjectType;
import lk.ac.mrt.cse.medipal.model.AllergyNotification;
import lk.ac.mrt.cse.medipal.model.Notification;
import lk.ac.mrt.cse.medipal.model.PrescriptionNotification;
import lk.ac.mrt.cse.medipal.model.ShareNotification;
import lk.ac.mrt.cse.medipal.view.doctor.DoctorPrescriptionView;
/**
* Created by lakshan on 11/19/17.
*/
public class NotificationRecyclerViewAdaptor extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private ArrayList<Notification> notificationList;
private Context context;
public NotificationRecyclerViewAdaptor(Context context, ArrayList<Notification> notificationList) {
this.context = context;
this.notificationList = notificationList;
}
@Override
public int getItemViewType(int position) {
return position;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch (viewType) {
case 0:
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.notification_row_layout, parent, false);
return new NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder(view);
case 1:
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.notification_row_layout, parent, false);
return new NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder(view);
default:
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.notification_row_layout, parent, false);
return new NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder(view);
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
// switch (position) {
// case 0:
// NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder infoHolder = ((NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder)holder);
// break;
// case 1:
// NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder medHolder = ((NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder)holder);
// }
NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder viewHolder = ((NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder)holder);
Notification notification = notificationList.get(position);
viewHolder.txt_msg.setText(notification.getMessage());
viewHolder.txt_time.setText(getTimeElapsed(notification.getTime()));
if (notificationList.get(position) instanceof ShareNotification){
viewHolder.icon_user.setController(
Fresco.newDraweeControllerBuilder()
.setOldController(viewHolder.icon_user.getController())
.setUri(notification.getPatient().getImage())
.build());
viewHolder.icon_type.setIconResource("\uf1d8");
viewHolder.icon_type.setBackgroundColor(context.getResources().getColor(R.color.met_baseColorBlue));
} else if (notificationList.get(position) instanceof AllergyNotification){
viewHolder.icon_user.setController(
Fresco.newDraweeControllerBuilder()
.setOldController(viewHolder.icon_user.getController())
.setUri(notification.getPatient().getImage())
.build());
viewHolder.icon_type.setIconResource("\uf071");
viewHolder.icon_type.setBackgroundColor(context.getResources().getColor(R.color.red));
} else {
viewHolder.icon_user.setController(
Fresco.newDraweeControllerBuilder()
.setOldController(viewHolder.icon_user.getController())
.setUri(notification.getPatient().getImage())
.build());
viewHolder.icon_type.setIconResource("\uf044");
viewHolder.icon_type.setBackgroundColor(context.getResources().getColor(R.color.met_primaryColor));
}
if (notification.isStatus().equals(Common.NotificationStatus.SEEN)){
viewHolder.notification_layout.setBackgroundColor(context.getResources().getColor(R.color.white));
} else {
viewHolder.notification_layout.setBackgroundColor(context.getResources().getColor(R.color.met_baseColorBlueLight));
}
}
@Override
public int getItemCount() {
return notificationList.size();
}
public class NotificationRecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
private RelativeLayout notification_layout;
private SimpleDraweeView icon_user;
private TextView txt_msg;
private TextView txt_time;
private MaterialFancyButton icon_type;
public NotificationRecyclerViewHolder(View itemView) {
super(itemView);
icon_user = itemView.findViewById(R.id.icon_user);
txt_msg = itemView.findViewById(R.id.txt_msg);
txt_time = itemView.findViewById(R.id.txt_time);
icon_type = itemView.findViewById(R.id.icon_type);
notification_layout = itemView.findViewById(R.id.notification_layout);
notification_layout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
Notification notification = notificationList.get(getAdapterPosition());
switch (view.getId()){
case R.id.notification_layout:
if (notification instanceof AllergyNotification){
Intent intent = new Intent(context, DoctorPrescriptionView.class);
Gson gson = new Gson();
String json = gson.toJson(((AllergyNotification)notification).getPrescription());
intent.putExtra(ObjectType.OBJECT_TYPE_PRESCRIPTION, json);
json = gson.toJson(notification.getPatient());
intent.putExtra(ObjectType.OBJECT_TYPE_PATIENT, json);
context.startActivity(intent);
}
break;
}
}
}
// public class PrescribeRecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
//
// public PrescribeRecyclerViewHolder(View itemView) {
// super(itemView);
// }
//
// @Override
// public void onClick(View view) {
// }
// }
//
// public class AllergyRecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
//
// public AllergyRecyclerViewHolder(View itemView) {
// super(itemView);
// }
//
// @Override
// public void onClick(View view) {
// }
// }
private String getTimeElapsed(String timeString){
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat(Common.Time.DATE_FORMAT, Locale.ENGLISH);
try {
Date startDate = simpleDateFormat.parse(timeString);
Date endDate = new Date();
long different = endDate.getTime() - startDate.getTime();
long secondsInMilli = 1000;
long minutesInMilli = secondsInMilli * 60;
long hoursInMilli = minutesInMilli * 60;
long daysInMilli = hoursInMilli * 24;
long elapsedDays = different / daysInMilli;
different = different % daysInMilli;
long elapsedHours = different / hoursInMilli;
different = different % hoursInMilli;
long elapsedMinutes = different / minutesInMilli;
different = different % minutesInMilli;
long elapsedSeconds = different / secondsInMilli;
if (elapsedDays == 0 && elapsedHours == 0 && elapsedMinutes == 0){
timeString = String.format(Locale.ENGLISH,
Common.Time.SECONDS_AGO,elapsedSeconds);
} else if (elapsedDays == 0 && elapsedHours == 0) {
timeString = String.format(Locale.ENGLISH,
Common.Time.MINS_AGO,elapsedMinutes);
} else if (elapsedDays == 0){
timeString = String.format(Locale.ENGLISH,
Common.Time.HOURS_AGO,elapsedHours);
} else {
timeString = String.format(Locale.ENGLISH,
Common.Time.DAYS_AGO,elapsedDays);
}
} catch (ParseException e) {
e.printStackTrace();
}
return timeString;
}
}
| UTF-8 | Java | 9,584 | java | NotificationRecyclerViewAdaptor.java | Java | [
{
"context": "aweeView;\nimport com.google.gson.Gson;\nimport com.rilixtech.materialfancybutton.MaterialFancyButton;\n\nimport ",
"end": 497,
"score": 0.8720504641532898,
"start": 488,
"tag": "USERNAME",
"value": "rilixtech"
},
{
"context": ".doctor.DoctorPrescriptionView;\n\n/**\n *... | null | [] | package lk.ac.mrt.cse.medipal.adaptor;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.gson.Gson;
import com.rilixtech.materialfancybutton.MaterialFancyButton;
import org.w3c.dom.Text;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import lk.ac.mrt.cse.medipal.R;
import lk.ac.mrt.cse.medipal.constant.Common;
import lk.ac.mrt.cse.medipal.constant.ObjectType;
import lk.ac.mrt.cse.medipal.model.AllergyNotification;
import lk.ac.mrt.cse.medipal.model.Notification;
import lk.ac.mrt.cse.medipal.model.PrescriptionNotification;
import lk.ac.mrt.cse.medipal.model.ShareNotification;
import lk.ac.mrt.cse.medipal.view.doctor.DoctorPrescriptionView;
/**
* Created by lakshan on 11/19/17.
*/
public class NotificationRecyclerViewAdaptor extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private ArrayList<Notification> notificationList;
private Context context;
public NotificationRecyclerViewAdaptor(Context context, ArrayList<Notification> notificationList) {
this.context = context;
this.notificationList = notificationList;
}
@Override
public int getItemViewType(int position) {
return position;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch (viewType) {
case 0:
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.notification_row_layout, parent, false);
return new NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder(view);
case 1:
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.notification_row_layout, parent, false);
return new NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder(view);
default:
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.notification_row_layout, parent, false);
return new NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder(view);
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
// switch (position) {
// case 0:
// NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder infoHolder = ((NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder)holder);
// break;
// case 1:
// NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder medHolder = ((NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder)holder);
// }
NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder viewHolder = ((NotificationRecyclerViewAdaptor.NotificationRecyclerViewHolder)holder);
Notification notification = notificationList.get(position);
viewHolder.txt_msg.setText(notification.getMessage());
viewHolder.txt_time.setText(getTimeElapsed(notification.getTime()));
if (notificationList.get(position) instanceof ShareNotification){
viewHolder.icon_user.setController(
Fresco.newDraweeControllerBuilder()
.setOldController(viewHolder.icon_user.getController())
.setUri(notification.getPatient().getImage())
.build());
viewHolder.icon_type.setIconResource("\uf1d8");
viewHolder.icon_type.setBackgroundColor(context.getResources().getColor(R.color.met_baseColorBlue));
} else if (notificationList.get(position) instanceof AllergyNotification){
viewHolder.icon_user.setController(
Fresco.newDraweeControllerBuilder()
.setOldController(viewHolder.icon_user.getController())
.setUri(notification.getPatient().getImage())
.build());
viewHolder.icon_type.setIconResource("\uf071");
viewHolder.icon_type.setBackgroundColor(context.getResources().getColor(R.color.red));
} else {
viewHolder.icon_user.setController(
Fresco.newDraweeControllerBuilder()
.setOldController(viewHolder.icon_user.getController())
.setUri(notification.getPatient().getImage())
.build());
viewHolder.icon_type.setIconResource("\uf044");
viewHolder.icon_type.setBackgroundColor(context.getResources().getColor(R.color.met_primaryColor));
}
if (notification.isStatus().equals(Common.NotificationStatus.SEEN)){
viewHolder.notification_layout.setBackgroundColor(context.getResources().getColor(R.color.white));
} else {
viewHolder.notification_layout.setBackgroundColor(context.getResources().getColor(R.color.met_baseColorBlueLight));
}
}
@Override
public int getItemCount() {
return notificationList.size();
}
public class NotificationRecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
private RelativeLayout notification_layout;
private SimpleDraweeView icon_user;
private TextView txt_msg;
private TextView txt_time;
private MaterialFancyButton icon_type;
public NotificationRecyclerViewHolder(View itemView) {
super(itemView);
icon_user = itemView.findViewById(R.id.icon_user);
txt_msg = itemView.findViewById(R.id.txt_msg);
txt_time = itemView.findViewById(R.id.txt_time);
icon_type = itemView.findViewById(R.id.icon_type);
notification_layout = itemView.findViewById(R.id.notification_layout);
notification_layout.setOnClickListener(this);
}
@Override
public void onClick(View view) {
Notification notification = notificationList.get(getAdapterPosition());
switch (view.getId()){
case R.id.notification_layout:
if (notification instanceof AllergyNotification){
Intent intent = new Intent(context, DoctorPrescriptionView.class);
Gson gson = new Gson();
String json = gson.toJson(((AllergyNotification)notification).getPrescription());
intent.putExtra(ObjectType.OBJECT_TYPE_PRESCRIPTION, json);
json = gson.toJson(notification.getPatient());
intent.putExtra(ObjectType.OBJECT_TYPE_PATIENT, json);
context.startActivity(intent);
}
break;
}
}
}
// public class PrescribeRecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
//
// public PrescribeRecyclerViewHolder(View itemView) {
// super(itemView);
// }
//
// @Override
// public void onClick(View view) {
// }
// }
//
// public class AllergyRecyclerViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
//
// public AllergyRecyclerViewHolder(View itemView) {
// super(itemView);
// }
//
// @Override
// public void onClick(View view) {
// }
// }
private String getTimeElapsed(String timeString){
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat(Common.Time.DATE_FORMAT, Locale.ENGLISH);
try {
Date startDate = simpleDateFormat.parse(timeString);
Date endDate = new Date();
long different = endDate.getTime() - startDate.getTime();
long secondsInMilli = 1000;
long minutesInMilli = secondsInMilli * 60;
long hoursInMilli = minutesInMilli * 60;
long daysInMilli = hoursInMilli * 24;
long elapsedDays = different / daysInMilli;
different = different % daysInMilli;
long elapsedHours = different / hoursInMilli;
different = different % hoursInMilli;
long elapsedMinutes = different / minutesInMilli;
different = different % minutesInMilli;
long elapsedSeconds = different / secondsInMilli;
if (elapsedDays == 0 && elapsedHours == 0 && elapsedMinutes == 0){
timeString = String.format(Locale.ENGLISH,
Common.Time.SECONDS_AGO,elapsedSeconds);
} else if (elapsedDays == 0 && elapsedHours == 0) {
timeString = String.format(Locale.ENGLISH,
Common.Time.MINS_AGO,elapsedMinutes);
} else if (elapsedDays == 0){
timeString = String.format(Locale.ENGLISH,
Common.Time.HOURS_AGO,elapsedHours);
} else {
timeString = String.format(Locale.ENGLISH,
Common.Time.DAYS_AGO,elapsedDays);
}
} catch (ParseException e) {
e.printStackTrace();
}
return timeString;
}
}
| 9,584 | 0.647955 | 0.644199 | 224 | 41.78125 | 34.57008 | 167 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553571 | false | false | 12 |
cd41e178860f60b6482e8bc8679a0b63d15d8c34 | 8,040,178,830,552 | 7b95f690dc13354984ee6fcfed7b3289b380e72f | /Manfreditor/src/main/java/manfred/manfreditor/application/ManfreditorContext.java | 0a36105714b5bee15c2197f62e0390dd30d6b644 | [] | no_license | RusselCK/manfred | https://github.com/RusselCK/manfred | eca994f44b1d57c8331aa86a9d1df66727544777 | 8ddc47e3bd6f2bb51f9754b660f4a4408e45b8e5 | refs/heads/master | 2023-04-06T01:49:33.534000 | 2021-05-02T13:58:00 | 2021-05-02T13:58:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package manfred.manfreditor.application;
import manfred.data.DataContext;
import manfred.data.infrastructure.map.TileConversionRule;
import manfred.manfreditor.application.startup.LoadKnownMapsCommand;
import manfred.manfreditor.common.CommonContext;
import manfred.manfreditor.common.command.Command;
import manfred.manfreditor.application.startup.LoadKnownMapObjectsCommand;
import manfred.manfreditor.map.MapContext;
import manfred.manfreditor.map.view.mapobject.MapObjectsView;
import manfred.manfreditor.map.view.mapobject.ObjectsViewCoordinateFactory;
import manfred.manfreditor.map.model.accessibility.AccessibilityMerger;
import manfred.manfreditor.map.model.Map;
import manfred.manfreditor.map.model.MapModel;
import manfred.manfreditor.map.model.ObjectInsertionValidator;
import manfred.manfreditor.map.model.objectfactory.ConcreteMapObjectFactory;
import manfred.manfreditor.map.model.mapobject.MapObject;
import manfred.manfreditor.map.model.mapobject.SelectedObject;
import manfred.manfreditor.map.model.mapobject.SelectionState;
import org.eclipse.swt.graphics.ImageLoader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import java.util.HashMap;
import java.util.List;
@Configuration
@ComponentScan(basePackages = "manfred.manfreditor.application")
@Import({DataContext.class, CommonContext.class, MapContext.class})
public class ManfreditorContext {
@Bean("StartupCommands")
public List<Command> startupCommands(
LoadKnownMapObjectsCommand loadKnownMapObjectsCommand,
LoadKnownMapsCommand loadKnownMapsCommand
) {
return List.of(loadKnownMapObjectsCommand, loadKnownMapsCommand);
}
@Bean
public ImageLoader swtImageLoader() {
return new ImageLoader();
}
}
| UTF-8 | Java | 1,918 | java | ManfreditorContext.java | Java | [] | null | [] | package manfred.manfreditor.application;
import manfred.data.DataContext;
import manfred.data.infrastructure.map.TileConversionRule;
import manfred.manfreditor.application.startup.LoadKnownMapsCommand;
import manfred.manfreditor.common.CommonContext;
import manfred.manfreditor.common.command.Command;
import manfred.manfreditor.application.startup.LoadKnownMapObjectsCommand;
import manfred.manfreditor.map.MapContext;
import manfred.manfreditor.map.view.mapobject.MapObjectsView;
import manfred.manfreditor.map.view.mapobject.ObjectsViewCoordinateFactory;
import manfred.manfreditor.map.model.accessibility.AccessibilityMerger;
import manfred.manfreditor.map.model.Map;
import manfred.manfreditor.map.model.MapModel;
import manfred.manfreditor.map.model.ObjectInsertionValidator;
import manfred.manfreditor.map.model.objectfactory.ConcreteMapObjectFactory;
import manfred.manfreditor.map.model.mapobject.MapObject;
import manfred.manfreditor.map.model.mapobject.SelectedObject;
import manfred.manfreditor.map.model.mapobject.SelectionState;
import org.eclipse.swt.graphics.ImageLoader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import java.util.HashMap;
import java.util.List;
@Configuration
@ComponentScan(basePackages = "manfred.manfreditor.application")
@Import({DataContext.class, CommonContext.class, MapContext.class})
public class ManfreditorContext {
@Bean("StartupCommands")
public List<Command> startupCommands(
LoadKnownMapObjectsCommand loadKnownMapObjectsCommand,
LoadKnownMapsCommand loadKnownMapsCommand
) {
return List.of(loadKnownMapObjectsCommand, loadKnownMapsCommand);
}
@Bean
public ImageLoader swtImageLoader() {
return new ImageLoader();
}
}
| 1,918 | 0.834202 | 0.834202 | 46 | 40.695652 | 24.552401 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.673913 | false | false | 12 |
34f0f8dd3404436130e2926e802895a90bd03c83 | 8,040,178,827,772 | 4e844e4ffe537bfe012a8d80ca5c1972c9f5cda0 | /src/main/java/com/sugar/model/ActionJoin.java | 8d4f328bc1dc268cfbfbf789a62e9103c622e293 | [] | no_license | Sugar93/sugar | https://github.com/Sugar93/sugar | 0e2603234cd0e203979649f9c1fd29c68e60c896 | 361e666817f6af3964797d111dc1857b5abfb947 | refs/heads/master | 2022-06-09T14:26:34.969000 | 2021-03-23T06:35:44 | 2021-03-23T06:35:44 | 132,575,950 | 0 | 0 | null | false | 2022-05-20T22:02:01 | 2018-05-08T08:08:48 | 2021-03-23T06:36:10 | 2022-05-20T22:02:00 | 103 | 0 | 0 | 1 | Java | false | false | package com.sugar.model;
import java.util.Date;
public class ActionJoin {
private Long joinId;
private Long actionId;
private String joinPerId;
private String joinPerName;
private Date createTime;
private Date updateTime;
private String remark;
private Byte state;
public Long getJoinId() {
return joinId;
}
public void setJoinId(Long joinId) {
this.joinId = joinId;
}
public Long getActionId() {
return actionId;
}
public void setActionId(Long actionId) {
this.actionId = actionId;
}
public String getJoinPerId() {
return joinPerId;
}
public void setJoinPerId(String joinPerId) {
this.joinPerId = joinPerId == null ? null : joinPerId.trim();
}
public String getJoinPerName() {
return joinPerName;
}
public void setJoinPerName(String joinPerName) {
this.joinPerName = joinPerName == null ? null : joinPerName.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Byte getState() {
return state;
}
public void setState(Byte state) {
this.state = state;
}
} | UTF-8 | Java | 1,626 | java | ActionJoin.java | Java | [] | null | [] | package com.sugar.model;
import java.util.Date;
public class ActionJoin {
private Long joinId;
private Long actionId;
private String joinPerId;
private String joinPerName;
private Date createTime;
private Date updateTime;
private String remark;
private Byte state;
public Long getJoinId() {
return joinId;
}
public void setJoinId(Long joinId) {
this.joinId = joinId;
}
public Long getActionId() {
return actionId;
}
public void setActionId(Long actionId) {
this.actionId = actionId;
}
public String getJoinPerId() {
return joinPerId;
}
public void setJoinPerId(String joinPerId) {
this.joinPerId = joinPerId == null ? null : joinPerId.trim();
}
public String getJoinPerName() {
return joinPerName;
}
public void setJoinPerName(String joinPerName) {
this.joinPerName = joinPerName == null ? null : joinPerName.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Byte getState() {
return state;
}
public void setState(Byte state) {
this.state = state;
}
} | 1,626 | 0.616236 | 0.616236 | 85 | 18.141176 | 18.327192 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.305882 | false | false | 12 |
62ce57d2b82e0293155b509947d6ab4b5bfc4698 | 755,914,248,332 | eb2c22492d4740a3eb455f2a898f6b3bc8235809 | /jnnsBank/proj-jnns/src/main/java/com/ideatech/ams/readData/service/ReadDataService.java | e22be503a5a2b21bcf0e764be237ba6f5fc30c38 | [] | no_license | deepexpert-gaohz/sa-d | https://github.com/deepexpert-gaohz/sa-d | 72a2d0cbfe95252d2a62f6247e7732c883049459 | 2d14275071b3d562447d24bd44d3a53f5a96fb71 | refs/heads/master | 2023-03-10T08:39:15.544000 | 2021-02-24T02:17:58 | 2021-02-24T02:17:58 | 341,395,351 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ideatech.ams.readData.service;
public interface ReadDataService {
void readData();
}
| UTF-8 | Java | 103 | java | ReadDataService.java | Java | [] | null | [] | package com.ideatech.ams.readData.service;
public interface ReadDataService {
void readData();
}
| 103 | 0.757282 | 0.757282 | 6 | 16.166666 | 17.092072 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 12 |
237bc681b2e8f5e2eb234e030fa0fc472e8cb6ed | 31,550,829,760,259 | fef2590bae9123f201578af7d47cb318e8f61234 | /app/src/main/java/com/example/myapplication/Adapter/WallOfFameAdapter.java | 9c5080c080ff5719cd7ad0d8ad3682f9e8ea282a | [] | no_license | Nandankumar207/Oyster | https://github.com/Nandankumar207/Oyster | 6f811809fd160424ac86e291398f4dd65aae440f | 920eb923831adfc894712f10565df7cc23fe3841 | refs/heads/master | 2020-05-07T09:12:52.797000 | 2019-04-09T12:58:40 | 2019-04-09T12:58:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.myapplication.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.myapplication.R;
public class WallOfFameAdapter extends RecyclerView.Adapter<WallOfFameAdapter.WallClass> {
Context context;
public WallOfFameAdapter(Context context) {
this.context = context;
}
@NonNull
@Override
public WallClass onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(context).inflate(R.layout.wall_of_fame_pojo,viewGroup,false);
return new WallClass(view);
}
@Override
public void onBindViewHolder(@NonNull WallClass wallClass, int i) {
}
@Override
public int getItemCount() {
return 3;
}
public class WallClass extends RecyclerView.ViewHolder {
public WallClass(@NonNull View itemView) {
super(itemView);
}
}
}
| UTF-8 | Java | 1,072 | java | WallOfFameAdapter.java | Java | [] | null | [] | package com.example.myapplication.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.myapplication.R;
public class WallOfFameAdapter extends RecyclerView.Adapter<WallOfFameAdapter.WallClass> {
Context context;
public WallOfFameAdapter(Context context) {
this.context = context;
}
@NonNull
@Override
public WallClass onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(context).inflate(R.layout.wall_of_fame_pojo,viewGroup,false);
return new WallClass(view);
}
@Override
public void onBindViewHolder(@NonNull WallClass wallClass, int i) {
}
@Override
public int getItemCount() {
return 3;
}
public class WallClass extends RecyclerView.ViewHolder {
public WallClass(@NonNull View itemView) {
super(itemView);
}
}
}
| 1,072 | 0.715485 | 0.713619 | 41 | 25.146341 | 26.070786 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.439024 | false | false | 12 |
2961ed8b50124722a69b26ac4718e3ff5f93cf57 | 9,268,539,465,406 | 5fcaab9595679b1513568f43c2243095436b2b69 | /tp1-udp-multicast_sasu_deroissart/src/main/java/fil/rsx/ex3/MulticastReceiver.java | 3141a17bd38f74736e952491596ce0f73d5d46d8 | [] | no_license | MaximeDeus/Reseaux | https://github.com/MaximeDeus/Reseaux | 7aff00aca33061ed73ad74e4bfc7d176dff559db | 125e1c548bac008cb2bcbdc551324dbe99f85887 | refs/heads/master | 2021-09-10T11:32:41.638000 | 2018-03-25T18:20:09 | 2018-03-25T18:20:09 | 125,909,442 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fil.rsx.ex3;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.util.HashMap;
/**
* A receiver of multicast transmissions using UDP
* protocol and threads
* @author DEROISSART Maxime, SASU Daniel
*
*/
public class MulticastReceiver extends Thread {
protected MulticastSocket socket = null;
protected InetAddress group = null;
protected HashMap<String, String> names;
public MulticastReceiver(String address, int port) throws IOException {
super();
this.socket = new MulticastSocket(port);
this.group = InetAddress.getByName(address);
this.names = new HashMap<String, String>();
this.names.put(InetAddress.getLocalHost().getHostAddress().toString(), "Me");
}
public void run(){
byte[] msg;
DatagramPacket pack;
try {
socket.joinGroup(this.group);
} catch (IOException e) {
e.printStackTrace();
}
while(true){
msg = new byte[1024];
pack = new DatagramPacket(msg, msg.length);
try {
socket.receive(pack);
if(!this.names.containsKey(pack.getAddress().toString())) {
this.names.put(pack.getAddress().toString(), NameGenerator.generateName());
}
System.out.print(this.names.get(pack.getAddress().toString()) + " says : ");
System.out.println(new String(pack.getData()));
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| UTF-8 | Java | 1,421 | java | MulticastReceiver.java | Java | [
{
"context": "sions using UDP\n * protocol and threads\n * @author DEROISSART Maxime, SASU Daniel\n *\n */\npublic class MulticastReceive",
"end": 278,
"score": 0.9978782534599304,
"start": 261,
"tag": "NAME",
"value": "DEROISSART Maxime"
},
{
"context": "protocol and threads\n * @au... | null | [] | package fil.rsx.ex3;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.util.HashMap;
/**
* A receiver of multicast transmissions using UDP
* protocol and threads
* @author <NAME>, <NAME>
*
*/
public class MulticastReceiver extends Thread {
protected MulticastSocket socket = null;
protected InetAddress group = null;
protected HashMap<String, String> names;
public MulticastReceiver(String address, int port) throws IOException {
super();
this.socket = new MulticastSocket(port);
this.group = InetAddress.getByName(address);
this.names = new HashMap<String, String>();
this.names.put(InetAddress.getLocalHost().getHostAddress().toString(), "Me");
}
public void run(){
byte[] msg;
DatagramPacket pack;
try {
socket.joinGroup(this.group);
} catch (IOException e) {
e.printStackTrace();
}
while(true){
msg = new byte[1024];
pack = new DatagramPacket(msg, msg.length);
try {
socket.receive(pack);
if(!this.names.containsKey(pack.getAddress().toString())) {
this.names.put(pack.getAddress().toString(), NameGenerator.generateName());
}
System.out.print(this.names.get(pack.getAddress().toString()) + " says : ");
System.out.println(new String(pack.getData()));
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
| 1,405 | 0.695285 | 0.691766 | 60 | 22.683332 | 22.517025 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.066667 | false | false | 12 |
7c712f154c0b2cdb5e2fba706c2508ac060ba210 | 22,308,060,138,012 | e9d0497a687c4a3a722bc4f3b77c9a617b254a98 | /src/main/java/com/example/demoboot/domain/Star.java | 02748430c0fe392e584d389b7927d52a8962eb67 | [] | no_license | teenyboy/blog | https://github.com/teenyboy/blog | 203879ef2661f2fe94dbe4cf8edcd5147ae4f5c2 | 31318f1102795281e3a9609714cdba37a223fd23 | refs/heads/master | 2021-09-01T10:36:15.605000 | 2017-12-26T14:18:23 | 2017-12-26T14:18:23 | 115,427,853 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demoboot.domain;
import java.util.Date;
public class Star {
private Long id;
private Long articleId;
private Long personId;
private Date createTime;
private int yn;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getArticleId() {
return articleId;
}
public void setArticleId(Long articleId) {
this.articleId = articleId;
}
public Long getPersonId() {
return personId;
}
public void setPersonId(Long personId) {
this.personId = personId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public int getYn() {
return yn;
}
public void setYn(int yn) {
this.yn = yn;
}
}
| UTF-8 | Java | 904 | java | Star.java | Java | [] | null | [] | package com.example.demoboot.domain;
import java.util.Date;
public class Star {
private Long id;
private Long articleId;
private Long personId;
private Date createTime;
private int yn;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getArticleId() {
return articleId;
}
public void setArticleId(Long articleId) {
this.articleId = articleId;
}
public Long getPersonId() {
return personId;
}
public void setPersonId(Long personId) {
this.personId = personId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public int getYn() {
return yn;
}
public void setYn(int yn) {
this.yn = yn;
}
}
| 904 | 0.589602 | 0.589602 | 52 | 16.384615 | 14.602626 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.326923 | false | false | 12 |
868a756c4f2e70f86039040970c49ecf0c9a4ab1 | 12,232,066,926,674 | 65f84dc102526f8f5c63bcfdfe30679a71ded7f0 | /321Blog/src/main/java/com/kuky/blog/basics/service/impl/ConfigServiceImpl.java | 458bbd868a756fcbb037674dac4b29d467aabbd7 | [] | no_license | Kukyhmy/repo1 | https://github.com/Kukyhmy/repo1 | 301eaebbaf42c8a6cdd1d646d0bd4249f7ec8a84 | 29ca8007db4d0d5d1b481d169071cf6247865737 | refs/heads/master | 2020-06-14T17:36:37.665000 | 2019-08-15T13:38:26 | 2019-08-15T13:38:32 | 195,074,183 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kuky.blog.basics.service.impl;
import com.kuky.blog.basics.dao.BlogConfigMapper;
import com.kuky.blog.basics.entity.BlogConfig;
import com.kuky.blog.basics.service.ConfigService;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author Kuky
* @create 2019/7/22 0:36
*/
@Repository
public class ConfigServiceImpl implements ConfigService {
@Resource
private BlogConfigMapper blogConfigMapper;
public static final String websiteName = "321 321blog";
public static final String websiteDescription = "321 blog是SpringBoot2+Thymeleaf+Mybatis建造的个人博客网站.SpringBoot实战博客";
public static final String websiteLogo = "/user/dist/img/logo2.png";
public static final String websiteIcon = "/user/dist/img/favicon.png";
public static final String avatar = "/user/dist/img/kuky.png";
public static final String email = "739663514@qq.com";
public static final String name = "Kuky";
public static final String footerAbout = "your personal 321blog. have fun.";
public static final String footerICP = "ICP备 xxxxxx-x号";
public static final String footerCopyRight = "@2019 KUKY";
public static final String footerPoweredBy = "321 321blog";
public static final String footerPoweredByURL = "##";
/**
*
* @return
*/
@Override
public Map<String, String> getAllConfigs() {
//获取所有的map并封装为map
List<BlogConfig> blogConfigs = blogConfigMapper.selectAll();
Map<String, String> configMap = blogConfigs.stream().collect(Collectors.toMap(BlogConfig::getConfigName, BlogConfig::getConfigValue));
for (Map.Entry<String, String> config : configMap.entrySet()) {
if ("websiteName".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteName);
}
if ("websiteDescription".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteDescription);
}
if ("websiteLogo".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteLogo);
}
if ("websiteIcon".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteIcon);
}
if ("yourAvatar".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(avatar);
}
if ("yourEmail".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(email);
}
if ("yourName".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(name);
}
if ("footerAbout".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerAbout);
}
if ("footerICP".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerICP);
}
if ("footerCopyRight".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerCopyRight);
}
if ("footerPoweredBy".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerPoweredBy);
}
if ("footerPoweredByURL".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerPoweredByURL);
}
}
return configMap;
}
@Override
public int updateConfig(String configName, String configValue) {
BlogConfig blogConfig = blogConfigMapper.selectByPrimaryKey(configName);
if (blogConfig != null) {
blogConfig.setConfigValue(configValue);
blogConfig.setUpdateTime(new Date());
return blogConfigMapper.updateByPrimaryKeySelective(blogConfig);
}
return 0;
}
}
| UTF-8 | Java | 4,283 | java | ConfigServiceImpl.java | Java | [
{
"context": "mport java.util.stream.Collectors;\n\n/**\n * @author Kuky\n * @create 2019/7/22 0:36\n */\n@Repository\npublic ",
"end": 446,
"score": 0.9994814395904541,
"start": 442,
"tag": "USERNAME",
"value": "Kuky"
},
{
"context": "uky.png\";\n public static final String email... | null | [] | package com.kuky.blog.basics.service.impl;
import com.kuky.blog.basics.dao.BlogConfigMapper;
import com.kuky.blog.basics.entity.BlogConfig;
import com.kuky.blog.basics.service.ConfigService;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author Kuky
* @create 2019/7/22 0:36
*/
@Repository
public class ConfigServiceImpl implements ConfigService {
@Resource
private BlogConfigMapper blogConfigMapper;
public static final String websiteName = "321 321blog";
public static final String websiteDescription = "321 blog是SpringBoot2+Thymeleaf+Mybatis建造的个人博客网站.SpringBoot实战博客";
public static final String websiteLogo = "/user/dist/img/logo2.png";
public static final String websiteIcon = "/user/dist/img/favicon.png";
public static final String avatar = "/user/dist/img/kuky.png";
public static final String email = "<EMAIL>";
public static final String name = "Kuky";
public static final String footerAbout = "your personal 321blog. have fun.";
public static final String footerICP = "ICP备 xxxxxx-x号";
public static final String footerCopyRight = "@2019 KUKY";
public static final String footerPoweredBy = "321 321blog";
public static final String footerPoweredByURL = "##";
/**
*
* @return
*/
@Override
public Map<String, String> getAllConfigs() {
//获取所有的map并封装为map
List<BlogConfig> blogConfigs = blogConfigMapper.selectAll();
Map<String, String> configMap = blogConfigs.stream().collect(Collectors.toMap(BlogConfig::getConfigName, BlogConfig::getConfigValue));
for (Map.Entry<String, String> config : configMap.entrySet()) {
if ("websiteName".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteName);
}
if ("websiteDescription".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteDescription);
}
if ("websiteLogo".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteLogo);
}
if ("websiteIcon".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(websiteIcon);
}
if ("yourAvatar".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(avatar);
}
if ("yourEmail".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(email);
}
if ("yourName".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(name);
}
if ("footerAbout".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerAbout);
}
if ("footerICP".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerICP);
}
if ("footerCopyRight".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerCopyRight);
}
if ("footerPoweredBy".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerPoweredBy);
}
if ("footerPoweredByURL".equals(config.getKey()) && StringUtils.isEmpty(config.getValue())) {
config.setValue(footerPoweredByURL);
}
}
return configMap;
}
@Override
public int updateConfig(String configName, String configValue) {
BlogConfig blogConfig = blogConfigMapper.selectByPrimaryKey(configName);
if (blogConfig != null) {
blogConfig.setConfigValue(configValue);
blogConfig.setUpdateTime(new Date());
return blogConfigMapper.updateByPrimaryKeySelective(blogConfig);
}
return 0;
}
}
| 4,274 | 0.644224 | 0.633829 | 104 | 39.701923 | 34.025974 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.471154 | false | false | 12 |
5ee74ff433d1375294e134a0f40a9fe82cdd62e0 | 23,716,809,447,171 | 76f9d31e33ec5e736ab5d0bec549a7987363b0d7 | /netty-3-01/src/main/java/com/demo/ark/util/CacheUtil.java | 5be613a11c75ccb8d833df6f489909cf4b166d63 | [] | no_license | wangjianhuaa/netty-demo | https://github.com/wangjianhuaa/netty-demo | 440fca620669905dcd879a03abdee7c297bf9389 | f1e47ecce217267a80f335ac7fad661cefdfa424 | refs/heads/main | 2023-07-05T11:15:50.352000 | 2021-08-23T02:20:57 | 2021-08-23T02:20:57 | 389,585,860 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.demo.ark.util;
import com.demo.ark.domain.Device;
import com.demo.ark.domain.ServerInfo;
import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* @author wangjianhua
* @Description
* @date 2021/8/18 14:56
*/
public class CacheUtil {
/**
* 用于存放用户Channel信息 也可以建立map结构模拟不同的消息群
*/
public static ChannelGroup wsChannelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
/**
* 缓存服务信息
*/
public static Map<Integer, ServerInfo> serverInfoMap = Collections.synchronizedMap(new HashMap<Integer, ServerInfo>());
/**
* 缓存用户 cacheClientChannel channelId -> Channel
*/
public static Map<String, Channel> cacheClientChannel = Collections.synchronizedMap(new HashMap<String,Channel>());
/**
* 设备组
*/
public static Map<String, Device> deviceGroup = Collections.synchronizedMap(new HashMap<String, Device>());
}
| UTF-8 | Java | 1,180 | java | CacheUtil.java | Java | [
{
"context": "til.HashMap;\nimport java.util.Map;\n\n/**\n * @author wangjianhua\n * @Description\n * @date 2021/8/18 14:56\n */\npubl",
"end": 389,
"score": 0.9989385604858398,
"start": 378,
"tag": "USERNAME",
"value": "wangjianhua"
}
] | null | [] | package com.demo.ark.util;
import com.demo.ark.domain.Device;
import com.demo.ark.domain.ServerInfo;
import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* @author wangjianhua
* @Description
* @date 2021/8/18 14:56
*/
public class CacheUtil {
/**
* 用于存放用户Channel信息 也可以建立map结构模拟不同的消息群
*/
public static ChannelGroup wsChannelGroup = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
/**
* 缓存服务信息
*/
public static Map<Integer, ServerInfo> serverInfoMap = Collections.synchronizedMap(new HashMap<Integer, ServerInfo>());
/**
* 缓存用户 cacheClientChannel channelId -> Channel
*/
public static Map<String, Channel> cacheClientChannel = Collections.synchronizedMap(new HashMap<String,Channel>());
/**
* 设备组
*/
public static Map<String, Device> deviceGroup = Collections.synchronizedMap(new HashMap<String, Device>());
}
| 1,180 | 0.728339 | 0.718412 | 40 | 26.700001 | 33.008484 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 12 |
5d5095becbb31fa9646ffb4497f475ef6d11cbc5 | 19,430,432,049,244 | 131ad85205b3642eb1ae24dc62aa0327e4ab0afe | /jb-basic/src/main/java/basic/design/creatingpattern/builder21/MyDate.java | 23a8932ac9e66b6f4c9869021099d403c4f93333 | [
"Apache-2.0"
] | permissive | ChaojieDZhao/jb-brother | https://github.com/ChaojieDZhao/jb-brother | eed228e8f474bf4162e9a94215c2181de30aa245 | 23c2692a8dbb6ffd1a2b7b03298ddf2b2c622312 | refs/heads/main | 2023-01-21T20:05:24.071000 | 2020-12-02T12:12:29 | 2020-12-02T12:12:29 | 317,843,897 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package basic.design.creatingpattern.builder21;
//产品
public class MyDate
{
String date;
}
| UTF-8 | Java | 96 | java | MyDate.java | Java | [] | null | [] | package basic.design.creatingpattern.builder21;
//产品
public class MyDate
{
String date;
}
| 96 | 0.771739 | 0.75 | 7 | 12.142858 | 15.697393 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
3c49a1cbc99711ba21122c011d562b7881611944 | 33,706,903,387,877 | 2a69d1ecc096fdd2f68aaeee2273cae497016a2a | /src/main/java/org/academiadecodigo/roothless/service/Interview/InterviewService.java | 08e77f9893599ad94c152e9d5c1d1827b963e52c | [] | no_license | tlourenzo/ac_interviews | https://github.com/tlourenzo/ac_interviews | 17fbc2c9ca8a32498cee6122f5ac52e7385b00ad | 395ce9a28ee0a2e28bf6d9c3849f8db37ef1fcaf | refs/heads/master | 2021-01-19T08:39:42.874000 | 2017-04-10T10:06:31 | 2017-04-10T10:06:31 | 87,655,235 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.academiadecodigo.roothless.service.Interview;
import org.academiadecodigo.roothless.model.Interview;
import org.academiadecodigo.roothless.service.Service;
import java.util.List;
/**
* Created by tlourenzo on 08-04-2017.
*/
public interface InterviewService extends Service {
boolean addInterview(Interview interview);
void removeInterview(Interview interview);
Interview getInterviewByDate(int day, int month, int year);
Interview getInterviewBySeveral(int user_id, String company, String date, String hour);
Interview getInterviewById(int interview_id);
List<Interview> getInterviewsByUser(int user_id);
List<Interview> getAllInterviews();
int count(int user_id);
void updateInterview(Interview interview);
}
| UTF-8 | Java | 765 | java | InterviewService.java | Java | [
{
"context": "ervice;\n\nimport java.util.List;\n\n/**\n * Created by tlourenzo on 08-04-2017.\n */\npublic interface InterviewServ",
"end": 221,
"score": 0.9996789693832397,
"start": 212,
"tag": "USERNAME",
"value": "tlourenzo"
}
] | null | [] | package org.academiadecodigo.roothless.service.Interview;
import org.academiadecodigo.roothless.model.Interview;
import org.academiadecodigo.roothless.service.Service;
import java.util.List;
/**
* Created by tlourenzo on 08-04-2017.
*/
public interface InterviewService extends Service {
boolean addInterview(Interview interview);
void removeInterview(Interview interview);
Interview getInterviewByDate(int day, int month, int year);
Interview getInterviewBySeveral(int user_id, String company, String date, String hour);
Interview getInterviewById(int interview_id);
List<Interview> getInterviewsByUser(int user_id);
List<Interview> getAllInterviews();
int count(int user_id);
void updateInterview(Interview interview);
}
| 765 | 0.777778 | 0.76732 | 22 | 33.772728 | 25.755726 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 12 |
bc450aeb87c9c8abdc6121eb019893c605a0ff6b | 2,851,858,338,535 | a9f025177fb044aa72739a7ac9e20f10d2b47586 | /src/main/java/sn/pharmacie/service/PharmacieService.java | 7f83af0675edf9b78fac224e51644efec7521dbf | [] | no_license | sycoumba/tpspringpharmacie | https://github.com/sycoumba/tpspringpharmacie | 5dbce995c17b07e10abaf101f165850b71b13c91 | 8391bd70ca1a5668be49b862bdbf69bf51602618 | refs/heads/main | 2023-01-20T15:43:30.343000 | 2020-12-06T00:23:08 | 2020-12-06T00:23:08 | 318,898,457 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package sn.pharmacie.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import sn.pharmacie.dao.Ipharmacie;
import sn.pharmacie.entities.Pharmacie;
@RestController
public class PharmacieService {
@Autowired
private Ipharmacie pharmaciedao;
@RequestMapping(value = "/liste/pharmacie",method = RequestMethod.GET)
public List<Pharmacie>getAll(){
return pharmaciedao.findAll();
}
@RequestMapping(value = "/liste/pharmacie/{ville}",method = RequestMethod.GET)
public List<Pharmacie>getAllPharmacieByVille(@PathVariable String ville){
return pharmaciedao.getAllPharmacieByVille(ville.toString());
}
@RequestMapping(value = "/liste/pharmacie/{quartier}",method = RequestMethod.GET)
public List<Pharmacie>getAllPharmacieByQartier(@PathVariable String quartier){
return pharmaciedao.getAllPharmacieByVille(quartier);
}
@RequestMapping(value = "/liste/pharmacie/delete/{id}",method = RequestMethod.DELETE)
public List<Pharmacie> delete (@PathVariable int id){
if(pharmaciedao.getById(id) !=null) {
pharmaciedao.delete(pharmaciedao.getById(id));
}
return pharmaciedao.findAll();
}
@RequestMapping(value = "/liste/pharmacie/save",method = RequestMethod.POST)
public List<Pharmacie>save(Pharmacie pharmacie){
pharmaciedao.save(pharmacie);
return pharmaciedao.findAll();
}
@RequestMapping(value = "/liste/pharmacie/update/{id}",method = RequestMethod.PUT)
public List<Pharmacie> update(@PathVariable int id, Pharmacie pharmacie){
pharmacie.setId(id);
pharmaciedao.save(pharmacie);
return pharmaciedao.findAll();
}
}
| UTF-8 | Java | 1,847 | java | PharmacieService.java | Java | [] | null | [] | package sn.pharmacie.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import sn.pharmacie.dao.Ipharmacie;
import sn.pharmacie.entities.Pharmacie;
@RestController
public class PharmacieService {
@Autowired
private Ipharmacie pharmaciedao;
@RequestMapping(value = "/liste/pharmacie",method = RequestMethod.GET)
public List<Pharmacie>getAll(){
return pharmaciedao.findAll();
}
@RequestMapping(value = "/liste/pharmacie/{ville}",method = RequestMethod.GET)
public List<Pharmacie>getAllPharmacieByVille(@PathVariable String ville){
return pharmaciedao.getAllPharmacieByVille(ville.toString());
}
@RequestMapping(value = "/liste/pharmacie/{quartier}",method = RequestMethod.GET)
public List<Pharmacie>getAllPharmacieByQartier(@PathVariable String quartier){
return pharmaciedao.getAllPharmacieByVille(quartier);
}
@RequestMapping(value = "/liste/pharmacie/delete/{id}",method = RequestMethod.DELETE)
public List<Pharmacie> delete (@PathVariable int id){
if(pharmaciedao.getById(id) !=null) {
pharmaciedao.delete(pharmaciedao.getById(id));
}
return pharmaciedao.findAll();
}
@RequestMapping(value = "/liste/pharmacie/save",method = RequestMethod.POST)
public List<Pharmacie>save(Pharmacie pharmacie){
pharmaciedao.save(pharmacie);
return pharmaciedao.findAll();
}
@RequestMapping(value = "/liste/pharmacie/update/{id}",method = RequestMethod.PUT)
public List<Pharmacie> update(@PathVariable int id, Pharmacie pharmacie){
pharmacie.setId(id);
pharmaciedao.save(pharmacie);
return pharmaciedao.findAll();
}
}
| 1,847 | 0.78993 | 0.78993 | 49 | 36.693878 | 28.119427 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.469388 | false | false | 12 |
b0a5681577cb7c21a1c153e34a6b1269f95b52f0 | 27,711,129,063,736 | 6038798b5b291ee81cc9281c5d0730ccf6460677 | /src/com/inv/interceptor/inv503Interceptor.java | 5cfa6561feaa7c9ed886919a5a0673bf7b50d333 | [] | no_license | moonsea/gld | https://github.com/moonsea/gld | 8150e3381fee04a81e384f79656e5408502dbf0b | 27cbb2a8eebbd5d1b9d5a643016a2a87d63b139b | refs/heads/master | 2016-04-23T00:13:43.472000 | 2016-03-16T18:21:48 | 2016-03-16T18:22:05 | 44,388,468 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2010-2011 星星<349446658@qq.com>
*
* This file is part of Wabacus
*
* Wabacus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.inv.interceptor;
import com.wabacus.config.component.application.report.ReportBean;
import com.wabacus.config.component.application.report.ReportDataSetValueBean;
import com.wabacus.system.ReportRequest;
import com.wabacus.system.component.application.report.configbean.editablereport.AbsEditableReportEditDataBean;
import com.wabacus.system.component.application.report.configbean.editablereport.EditableReportInsertDataBean;
import com.wabacus.system.component.application.report.configbean.editablereport.EditableReportUpdateDataBean;
import com.wabacus.system.intercept.AbsInterceptorDefaultAdapter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class inv503Interceptor extends AbsInterceptorDefaultAdapter
{
public Object beforeLoadData(ReportRequest rrequest,ReportBean rbean,Object typeObj,String sql)
{
if (typeObj instanceof ReportDataSetValueBean) {
//存储过程///////////
String e_item_code = rrequest.getAttribute("e_item_code").toString();
if (e_item_code != null && !e_item_code.equals(""))
{
sql = sql.replace("item_code <= 'zzzzzzzzzzzzzzzzzzzzzzzzzz'", "item_code <= '"+e_item_code+"'");
}
}
return sql;
}
}
| UTF-8 | Java | 2,139 | java | inv503Interceptor.java | Java | [
{
"context": "/* \n * Copyright (C) 2010-2011 星星<349446658@qq.com>\n * \n * This file is part of Wabacus \n * \n * Waba",
"end": 50,
"score": 0.9996207356452942,
"start": 34,
"tag": "EMAIL",
"value": "349446658@qq.com"
}
] | null | [] | /*
* Copyright (C) 2010-2011 星星<<EMAIL>>
*
* This file is part of Wabacus
*
* Wabacus is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.inv.interceptor;
import com.wabacus.config.component.application.report.ReportBean;
import com.wabacus.config.component.application.report.ReportDataSetValueBean;
import com.wabacus.system.ReportRequest;
import com.wabacus.system.component.application.report.configbean.editablereport.AbsEditableReportEditDataBean;
import com.wabacus.system.component.application.report.configbean.editablereport.EditableReportInsertDataBean;
import com.wabacus.system.component.application.report.configbean.editablereport.EditableReportUpdateDataBean;
import com.wabacus.system.intercept.AbsInterceptorDefaultAdapter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class inv503Interceptor extends AbsInterceptorDefaultAdapter
{
public Object beforeLoadData(ReportRequest rrequest,ReportBean rbean,Object typeObj,String sql)
{
if (typeObj instanceof ReportDataSetValueBean) {
//存储过程///////////
String e_item_code = rrequest.getAttribute("e_item_code").toString();
if (e_item_code != null && !e_item_code.equals(""))
{
sql = sql.replace("item_code <= 'zzzzzzzzzzzzzzzzzzzzzzzzzz'", "item_code <= '"+e_item_code+"'");
}
}
return sql;
}
}
| 2,130 | 0.77386 | 0.763987 | 55 | 37.654545 | 33.88924 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.054545 | false | false | 12 |
1ea36fe9993b79ea80b46701791e08819f4c2841 | 2,181,843,391,735 | f0e4c4102ef088fea22aa4022a04650dc9a393d0 | /ISS_Biblioteca RMI/Client/src/main/java/gui/registertemplate.txt | 2253a86fd4f5e1e66e90878816e21063b16f29ae | [] | no_license | Varanu/iss-biblioteca | https://github.com/Varanu/iss-biblioteca | 296506dd2fadac73b29464d3ae208e9d218018eb | e218a5acd9bba1b18c73c5876d56a25858e02840 | refs/heads/master | 2023-04-19T15:51:53.251000 | 2021-05-02T12:12:56 | 2021-05-02T12:12:56 | 341,461,536 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Created by JFormDesigner on Sun Apr 04 23:47:03 EEST 2021
*/
package gui;
import Domain.*;
import Service.*;
import java.awt.*;
import java.awt.event.*;
import java.rmi.RemoteException;
import javax.swing.*;
/**
* @author unknown
*/
public class Register extends JFrame {
public Register(Service service) {
initComponents();
this.service = service;
}
private void registerButtonActionPerformed(ActionEvent e) throws BibliotecaException, RemoteException {
if(service.registerUtilizator(textField5.getText(), String.valueOf(textField6.getPassword()), textField1.getText(), textField2.getText(), textField3.getText(), textField4.getText()) != null) {
JOptionPane.showMessageDialog(null, "Utilizator inregistrat", "Register Successully", JOptionPane.INFORMATION_MESSAGE);
dispose();
}
else{
textField5.setText("");
JOptionPane.showMessageDialog(null, "Username existent", "Register Error", JOptionPane.ERROR_MESSAGE);
}
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - unknown
dialogPane = new JPanel();
contentPanel = new JPanel();
label1 = new JLabel();
label2 = new JLabel();
label3 = new JLabel();
label4 = new JLabel();
textField1 = new JTextField();
textField2 = new JTextField();
label5 = new JLabel();
textField3 = new JTextField();
buttonBar = new JPanel();
textField4 = new JTextField();
label6 = new JLabel();
label7 = new JLabel();
label8 = new JLabel();
textField5 = new JTextField();
//textField6 = new JTextField();
okButton = new JButton();
//======== this ========
var contentPane = getContentPane();
contentPane.setLayout(null);
//======== dialogPane ========
{
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
int x = (screenSize.width - getWidth()) / 2;
int y = (screenSize.height - getHeight()) / 2;
//Set the new frame location
dialogPane.setLocation(x, y);
dialogPane.setLayout(null);
//======== contentPanel ========
{
contentPanel.setLayout(null);
//---- label1 ----
label1.setText("Nume");
contentPanel.add(label1);
label1.setBounds(35, 205, 65, 30);
//---- label2 ----
label2.setText("Prenume");
contentPanel.add(label2);
label2.setBounds(new Rectangle(new Point(30, 255), label2.getPreferredSize()));
//---- label3 ----
label3.setText("Adresa");
contentPanel.add(label3);
label3.setBounds(new Rectangle(new Point(35, 300), label3.getPreferredSize()));
//---- label4 ----
label4.setText("CNP");
contentPanel.add(label4);
label4.setBounds(45, 330, label4.getPreferredSize().width, 40);
contentPanel.add(textField1);
textField1.setBounds(115, 200, 175, 30);
contentPanel.add(textField2);
textField2.setBounds(115, 250, 175, 30);
//---- label5 ----
label5.setText("Register");
label5.setFont(new Font(".AppleSystemUIFont", Font.BOLD, 23));
label5.setHorizontalAlignment(SwingConstants.CENTER);
contentPanel.add(label5);
label5.setBounds(70, 10, 200, 80);
contentPanel.add(textField3);
textField3.setBounds(115, 295, 175, 30);
//======== buttonBar ========
{
buttonBar.setLayout(null);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < buttonBar.getComponentCount(); i++) {
Rectangle bounds = buttonBar.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = buttonBar.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
buttonBar.setMinimumSize(preferredSize);
buttonBar.setPreferredSize(preferredSize);
}
}
contentPanel.add(buttonBar);
buttonBar.setBounds(0, 400, 493, buttonBar.getPreferredSize().height);
contentPanel.add(textField4);
textField4.setBounds(115, 340, 175, 30);
contentPanel.add(label6);
label6.setBounds(new Rectangle(new Point(75, 355), label6.getPreferredSize()));
//---- label7 ----
label7.setText("Username");
contentPanel.add(label7);
label7.setBounds(new Rectangle(new Point(35, 110), label7.getPreferredSize()));
//---- label8 ----
label8.setText("Parola");
contentPanel.add(label8);
label8.setBounds(new Rectangle(new Point(35, 140), label8.getPreferredSize()));
contentPanel.add(textField5);
textField5.setBounds(115, 100, 170, 30);
contentPanel.add(textField6);
textField6.setBounds(115, 135, 170, 30);
//---- okButton ----
okButton.setText("Register");
okButton.addActionListener(e -> {
try {
registerButtonActionPerformed(e);
} catch (BibliotecaException | RemoteException bibliotecaException) {
bibliotecaException.printStackTrace();
}
});
contentPanel.add(okButton);
okButton.setBounds(new Rectangle(new Point(255, 380), okButton.getPreferredSize()));
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPanel.getComponentCount(); i++) {
Rectangle bounds = contentPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPanel.setMinimumSize(preferredSize);
contentPanel.setPreferredSize(preferredSize);
}
}
dialogPane.add(contentPanel);
contentPanel.setBounds(0, 0, 380, contentPanel.getPreferredSize().height);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < dialogPane.getComponentCount(); i++) {
Rectangle bounds = dialogPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = dialogPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
dialogPane.setMinimumSize(preferredSize);
dialogPane.setPreferredSize(preferredSize);
}
}
contentPane.add(dialogPane);
dialogPane.setBounds(0, 0, 380, dialogPane.getPreferredSize().height);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPane.getComponentCount(); i++) {
Rectangle bounds = contentPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPane.setMinimumSize(preferredSize);
contentPane.setPreferredSize(preferredSize);
}
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license - unknown
private JPanel dialogPane;
private JPanel contentPanel;
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JLabel label4;
private JTextField textField1;
private JTextField textField2;
private JLabel label5;
private JTextField textField3;
private JPanel buttonBar;
private JTextField textField4;
private JLabel label6;
private JLabel label7;
private JLabel label8;
private JTextField textField5;
//private JTextField textField6;
private JButton okButton;
// JFormDesigner - End of variables declaration //GEN-END:variables
private JPasswordField textField6 = new JPasswordField();
private Service service;
}
| UTF-8 | Java | 10,167 | txt | registertemplate.txt | Java | [
{
"context": "eException;\nimport javax.swing.*;\n\n\n/**\n * @author unknown\n */\npublic class Register extends JFrame {\n pu",
"end": 240,
"score": 0.9709007740020752,
"start": 233,
"tag": "USERNAME",
"value": "unknown"
},
{
"context": "/---- label1 ----\n label1... | null | [] | /*
* Created by JFormDesigner on Sun Apr 04 23:47:03 EEST 2021
*/
package gui;
import Domain.*;
import Service.*;
import java.awt.*;
import java.awt.event.*;
import java.rmi.RemoteException;
import javax.swing.*;
/**
* @author unknown
*/
public class Register extends JFrame {
public Register(Service service) {
initComponents();
this.service = service;
}
private void registerButtonActionPerformed(ActionEvent e) throws BibliotecaException, RemoteException {
if(service.registerUtilizator(textField5.getText(), String.valueOf(textField6.getPassword()), textField1.getText(), textField2.getText(), textField3.getText(), textField4.getText()) != null) {
JOptionPane.showMessageDialog(null, "Utilizator inregistrat", "Register Successully", JOptionPane.INFORMATION_MESSAGE);
dispose();
}
else{
textField5.setText("");
JOptionPane.showMessageDialog(null, "Username existent", "Register Error", JOptionPane.ERROR_MESSAGE);
}
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - unknown
dialogPane = new JPanel();
contentPanel = new JPanel();
label1 = new JLabel();
label2 = new JLabel();
label3 = new JLabel();
label4 = new JLabel();
textField1 = new JTextField();
textField2 = new JTextField();
label5 = new JLabel();
textField3 = new JTextField();
buttonBar = new JPanel();
textField4 = new JTextField();
label6 = new JLabel();
label7 = new JLabel();
label8 = new JLabel();
textField5 = new JTextField();
//textField6 = new JTextField();
okButton = new JButton();
//======== this ========
var contentPane = getContentPane();
contentPane.setLayout(null);
//======== dialogPane ========
{
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
int x = (screenSize.width - getWidth()) / 2;
int y = (screenSize.height - getHeight()) / 2;
//Set the new frame location
dialogPane.setLocation(x, y);
dialogPane.setLayout(null);
//======== contentPanel ========
{
contentPanel.setLayout(null);
//---- label1 ----
label1.setText("Nume");
contentPanel.add(label1);
label1.setBounds(35, 205, 65, 30);
//---- label2 ----
label2.setText("Prenume");
contentPanel.add(label2);
label2.setBounds(new Rectangle(new Point(30, 255), label2.getPreferredSize()));
//---- label3 ----
label3.setText("Adresa");
contentPanel.add(label3);
label3.setBounds(new Rectangle(new Point(35, 300), label3.getPreferredSize()));
//---- label4 ----
label4.setText("CNP");
contentPanel.add(label4);
label4.setBounds(45, 330, label4.getPreferredSize().width, 40);
contentPanel.add(textField1);
textField1.setBounds(115, 200, 175, 30);
contentPanel.add(textField2);
textField2.setBounds(115, 250, 175, 30);
//---- label5 ----
label5.setText("Register");
label5.setFont(new Font(".AppleSystemUIFont", Font.BOLD, 23));
label5.setHorizontalAlignment(SwingConstants.CENTER);
contentPanel.add(label5);
label5.setBounds(70, 10, 200, 80);
contentPanel.add(textField3);
textField3.setBounds(115, 295, 175, 30);
//======== buttonBar ========
{
buttonBar.setLayout(null);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < buttonBar.getComponentCount(); i++) {
Rectangle bounds = buttonBar.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = buttonBar.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
buttonBar.setMinimumSize(preferredSize);
buttonBar.setPreferredSize(preferredSize);
}
}
contentPanel.add(buttonBar);
buttonBar.setBounds(0, 400, 493, buttonBar.getPreferredSize().height);
contentPanel.add(textField4);
textField4.setBounds(115, 340, 175, 30);
contentPanel.add(label6);
label6.setBounds(new Rectangle(new Point(75, 355), label6.getPreferredSize()));
//---- label7 ----
label7.setText("Username");
contentPanel.add(label7);
label7.setBounds(new Rectangle(new Point(35, 110), label7.getPreferredSize()));
//---- label8 ----
label8.setText("Parola");
contentPanel.add(label8);
label8.setBounds(new Rectangle(new Point(35, 140), label8.getPreferredSize()));
contentPanel.add(textField5);
textField5.setBounds(115, 100, 170, 30);
contentPanel.add(textField6);
textField6.setBounds(115, 135, 170, 30);
//---- okButton ----
okButton.setText("Register");
okButton.addActionListener(e -> {
try {
registerButtonActionPerformed(e);
} catch (BibliotecaException | RemoteException bibliotecaException) {
bibliotecaException.printStackTrace();
}
});
contentPanel.add(okButton);
okButton.setBounds(new Rectangle(new Point(255, 380), okButton.getPreferredSize()));
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPanel.getComponentCount(); i++) {
Rectangle bounds = contentPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPanel.setMinimumSize(preferredSize);
contentPanel.setPreferredSize(preferredSize);
}
}
dialogPane.add(contentPanel);
contentPanel.setBounds(0, 0, 380, contentPanel.getPreferredSize().height);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < dialogPane.getComponentCount(); i++) {
Rectangle bounds = dialogPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = dialogPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
dialogPane.setMinimumSize(preferredSize);
dialogPane.setPreferredSize(preferredSize);
}
}
contentPane.add(dialogPane);
dialogPane.setBounds(0, 0, 380, dialogPane.getPreferredSize().height);
{
// compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPane.getComponentCount(); i++) {
Rectangle bounds = contentPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPane.setMinimumSize(preferredSize);
contentPane.setPreferredSize(preferredSize);
}
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license - unknown
private JPanel dialogPane;
private JPanel contentPanel;
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JLabel label4;
private JTextField textField1;
private JTextField textField2;
private JLabel label5;
private JTextField textField3;
private JPanel buttonBar;
private JTextField textField4;
private JLabel label6;
private JLabel label7;
private JLabel label8;
private JTextField textField5;
//private JTextField textField6;
private JButton okButton;
// JFormDesigner - End of variables declaration //GEN-END:variables
private JPasswordField textField6 = new JPasswordField();
private Service service;
}
| 10,167 | 0.559457 | 0.53536 | 240 | 41.362499 | 29.754374 | 200 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.95 | false | false | 12 |
45aa6d27970b9d9fe3c606f006faeafb3c335615 | 26,706,106,666,759 | 6d6430ea674275c11bcaf38ae3b2974750ebe167 | /JavaSource/ch/gibm/filter/LoginFilter.java | 98d1eae94c5b822964159b72d98675b3950dcb5b | [] | no_license | Thunderstonjek/SecJSFApp | https://github.com/Thunderstonjek/SecJSFApp | ca789af9f446fbb86f71b70a3a0879d9c039109f | 6f47aa3d29c9f48d70585d1b81a2a71b9f54a939 | refs/heads/master | 2020-09-28T17:56:34.735000 | 2020-01-05T17:04:54 | 2020-01-05T17:04:54 | 225,189,497 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ch.gibm.filter;
import java.io.IOException;
import javax.faces.application.ResourceHandler;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import ch.gibm.bean.LoginBean;
import ch.gibm.entity.User;
public class LoginFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
}
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
HttpSession session = req.getSession();
if(session.isNew()) {
login(request, resp, req);
return;
}
User user = (User) session.getAttribute(LoginBean.ATTR_USER);
if(user == null) {
login(request, resp, req);
return;
}
chain.doFilter(request, resp);
}
private void login(ServletRequest request, ServletResponse resp, HttpServletRequest req) throws ServletException, IOException{
RequestDispatcher disp = req.getRequestDispatcher("/pages/public/login.xhtml");
disp.forward(request, resp);
}
}
| UTF-8 | Java | 1,526 | java | LoginFilter.java | Java | [] | null | [] | package ch.gibm.filter;
import java.io.IOException;
import javax.faces.application.ResourceHandler;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import ch.gibm.bean.LoginBean;
import ch.gibm.entity.User;
public class LoginFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
}
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
HttpSession session = req.getSession();
if(session.isNew()) {
login(request, resp, req);
return;
}
User user = (User) session.getAttribute(LoginBean.ATTR_USER);
if(user == null) {
login(request, resp, req);
return;
}
chain.doFilter(request, resp);
}
private void login(ServletRequest request, ServletResponse resp, HttpServletRequest req) throws ServletException, IOException{
RequestDispatcher disp = req.getRequestDispatcher("/pages/public/login.xhtml");
disp.forward(request, resp);
}
}
| 1,526 | 0.770642 | 0.770642 | 58 | 25.310345 | 28.063478 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.758621 | false | false | 12 |
045b1279dca483da1f65bf74a9f4a48e02e93496 | 30,365,418,844,088 | 628ae45380688e97a1c081d591c9aa784cd32aef | /Class/src/report/leesangyong/r0005/practise1.java | cee137e5d7e0272f9c03410704fb49dc97e6d8b9 | [] | no_license | Cruising0904/Class | https://github.com/Cruising0904/Class | d1636468a4db8c71495c3e2f18c40b675794e441 | 1f40d95e1ad96831337f2c5c76d7a8a4df67d9d6 | refs/heads/master | 2020-12-03T09:20:27.758000 | 2017-09-08T01:40:22 | 2017-09-08T01:40:22 | 95,616,087 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package report.leesangyong.r0005;
public class practise1 {
public static void main(String[]args){
System.out.println('2' - '0');
}
}
| UTF-8 | Java | 142 | java | practise1.java | Java | [] | null | [] | package report.leesangyong.r0005;
public class practise1 {
public static void main(String[]args){
System.out.println('2' - '0');
}
}
| 142 | 0.683099 | 0.633803 | 7 | 18.285715 | 15.727267 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
6fa176712b9ec82ba904f18d56714202846ac29a | 33,268,816,710,002 | 4f646f9203fd5e64de23acac520426e0c1f6b0f1 | /src/test/java/com/example/assignment/debt/DebtServiceTest.java | fa369bb5695096391e4fd280e9fb7174cd1a9a28 | [] | no_license | sreenivassvs123/assignment | https://github.com/sreenivassvs123/assignment | 29936a52bb05bc5adb111856c786e6aca3514aaf | 05c4dec086efb891ab8237b9663d3fb0f5aec9f7 | refs/heads/master | 2023-05-06T08:16:13.703000 | 2021-05-25T06:34:34 | 2021-05-25T06:34:34 | 370,107,012 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.assignment.debt;
import com.example.assignment.debt.dependency.PaymentServiceClient;
import com.example.assignment.debt.dependency.PaymentServiceClientException;
import com.example.assignment.debt.dependency.model.Debt;
import com.example.assignment.debt.dependency.model.InstallmentFrequency;
import com.example.assignment.debt.dependency.model.Payment;
import com.example.assignment.debt.dependency.model.PaymentPlan;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ExtendWith(MockitoExtension.class)
class DebtServiceTest {
@Mock
private PaymentServiceClient paymentServiceClient;
@InjectMocks
private DebtService debtService;
@Test
void testGetDebtsNullResponse() throws PaymentServiceClientException, JsonProcessingException {
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(null);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(0, debts.size());
}
/**
* Debt with no paymentPlan
* RemainingAmount is original Debt's amount and NextPaymentDueDate is not known
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtsWithNoPaymentPlan() throws PaymentServiceClientException, JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertFalse(debts.get(0).isInPaymentPlan());
assertNull(debts.get(0).getNextPaymentDueDate());
assertTrue(debt.getAmount().equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with PaymentPlan exist but completed as the amountToPay is fully paid off.
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithFullyPaidPaymentPlan() throws PaymentServiceClientException, JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build(),
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 15)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertFalse(debts.get(0).isInPaymentPlan());
assertNull(debts.get(0).getNextPaymentDueDate());
assertTrue(BigDecimal.ZERO.equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with PaymentPlan exist and completed but the total amount paid is more than paymentPlan's amountToPay.
* Debt amount = 10$; PaymentPlan's amountToPay = 10$; Total payments done for the paymentPlan = 55$
* making 45$ over payment
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithOverPaidPaymentPlan() throws PaymentServiceClientException, JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build(),
Payment.builder()
.amount(BigDecimal.valueOf(50))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 15)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertFalse(debts.get(0).isInPaymentPlan());
assertNull(debts.get(0).getNextPaymentDueDate());
assertTrue(BigDecimal.valueOf(-45).equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with paymentPlan with pending amount and weekly installmentFrequency.
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithInProgressAndWeeklyPaymentPlan() throws PaymentServiceClientException,
JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertTrue(debts.get(0).isInPaymentPlan());
assertTrue("2021-05-15".equals(debts.get(0).getNextPaymentDueDate()));
assertTrue(BigDecimal.valueOf(5).equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with paymentPlan with pending amount and biWeekly installmentFrequency.
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithInProgressAndBiWeeklyPaymentPlan() throws PaymentServiceClientException,
JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.BI_WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertTrue(debts.get(0).isInPaymentPlan());
assertTrue("2021-05-22".equals(debts.get(0).getNextPaymentDueDate()));
assertTrue(BigDecimal.valueOf(5).equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with active paymentPlan but no payments done till date.
* Remaining amount is the paymentPlan's amountToPay; NextPaymentDueDate is the paymentPlan's startDate
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithInProgressPaymentPlanAndNoPaymentsMadeTillDate() throws PaymentServiceClientException,
JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.valueOf(15)).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.BI_WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = null;
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertTrue(debts.get(0).isInPaymentPlan());
assertTrue("2021-05-15".equals(debts.get(0).getNextPaymentDueDate()));
assertTrue(paymentPlan.getAmountToPay().equals(debts.get(0).getRemainingAmount()));
}
} | UTF-8 | Java | 11,692 | java | DebtServiceTest.java | Java | [] | null | [] | package com.example.assignment.debt;
import com.example.assignment.debt.dependency.PaymentServiceClient;
import com.example.assignment.debt.dependency.PaymentServiceClientException;
import com.example.assignment.debt.dependency.model.Debt;
import com.example.assignment.debt.dependency.model.InstallmentFrequency;
import com.example.assignment.debt.dependency.model.Payment;
import com.example.assignment.debt.dependency.model.PaymentPlan;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ExtendWith(MockitoExtension.class)
class DebtServiceTest {
@Mock
private PaymentServiceClient paymentServiceClient;
@InjectMocks
private DebtService debtService;
@Test
void testGetDebtsNullResponse() throws PaymentServiceClientException, JsonProcessingException {
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(null);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(0, debts.size());
}
/**
* Debt with no paymentPlan
* RemainingAmount is original Debt's amount and NextPaymentDueDate is not known
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtsWithNoPaymentPlan() throws PaymentServiceClientException, JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertFalse(debts.get(0).isInPaymentPlan());
assertNull(debts.get(0).getNextPaymentDueDate());
assertTrue(debt.getAmount().equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with PaymentPlan exist but completed as the amountToPay is fully paid off.
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithFullyPaidPaymentPlan() throws PaymentServiceClientException, JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build(),
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 15)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertFalse(debts.get(0).isInPaymentPlan());
assertNull(debts.get(0).getNextPaymentDueDate());
assertTrue(BigDecimal.ZERO.equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with PaymentPlan exist and completed but the total amount paid is more than paymentPlan's amountToPay.
* Debt amount = 10$; PaymentPlan's amountToPay = 10$; Total payments done for the paymentPlan = 55$
* making 45$ over payment
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithOverPaidPaymentPlan() throws PaymentServiceClientException, JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build(),
Payment.builder()
.amount(BigDecimal.valueOf(50))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 15)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertFalse(debts.get(0).isInPaymentPlan());
assertNull(debts.get(0).getNextPaymentDueDate());
assertTrue(BigDecimal.valueOf(-45).equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with paymentPlan with pending amount and weekly installmentFrequency.
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithInProgressAndWeeklyPaymentPlan() throws PaymentServiceClientException,
JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertTrue(debts.get(0).isInPaymentPlan());
assertTrue("2021-05-15".equals(debts.get(0).getNextPaymentDueDate()));
assertTrue(BigDecimal.valueOf(5).equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with paymentPlan with pending amount and biWeekly installmentFrequency.
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithInProgressAndBiWeeklyPaymentPlan() throws PaymentServiceClientException,
JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.TEN).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.BI_WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = Arrays.asList(
Payment.builder()
.amount(BigDecimal.valueOf(5))
.paymentPlanId(11)
.date(LocalDate.of(2021, 5, 8)).build());
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertTrue(debts.get(0).isInPaymentPlan());
assertTrue("2021-05-22".equals(debts.get(0).getNextPaymentDueDate()));
assertTrue(BigDecimal.valueOf(5).equals(debts.get(0).getRemainingAmount()));
}
/**
* Debt with active paymentPlan but no payments done till date.
* Remaining amount is the paymentPlan's amountToPay; NextPaymentDueDate is the paymentPlan's startDate
* @throws PaymentServiceClientException
* @throws JsonProcessingException
*/
@Test
void testGetDebtWithInProgressPaymentPlanAndNoPaymentsMadeTillDate() throws PaymentServiceClientException,
JsonProcessingException {
int debtId = 1;
Debt debt = Debt.builder().id(debtId).amount(BigDecimal.valueOf(15)).build();
PaymentPlan paymentPlan =
PaymentPlan.builder()
.amountToPay(BigDecimal.TEN)
.debtId(debtId)
.id(11)
.installmentAmount(BigDecimal.valueOf(5))
.installmentFrequency(InstallmentFrequency.BI_WEEKLY.name())
.startDate(LocalDate.of(2021, 5, 1))
.build();
List<Payment> payments = null;
Mockito.when(paymentServiceClient.getAllDebts()).thenReturn(Arrays.asList(debt));
Mockito.when(paymentServiceClient.getAllPaymentPlans()).thenReturn(Arrays.asList(paymentPlan));
Mockito.when(paymentServiceClient.getAllPayments()).thenReturn(payments);
List<com.example.assignment.debt.model.Debt> debts = debtService.getAllDebts();
//Verification
assertEquals(1, debts.size());
assertTrue(debts.get(0).isInPaymentPlan());
assertTrue("2021-05-15".equals(debts.get(0).getNextPaymentDueDate()));
assertTrue(paymentPlan.getAmountToPay().equals(debts.get(0).getRemainingAmount()));
}
} | 11,692 | 0.640096 | 0.62547 | 249 | 45.959839 | 30.037968 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.546185 | false | false | 12 |
5f3e77208404fc6916d47f8e938a95037f75ac58 | 31,250,182,057,010 | ef760c7e8ce2b88acc8ef21cfa9fc5f68f4fa325 | /Spring-Boot-WS/6-Boot-DATAJPA-Mappings/src/main/java/com/cts/employee/entity/Employee.java | cb600b55668759633132bae73a3881b1c715fffc | [] | no_license | tracksdata/Adm-boot-b4 | https://github.com/tracksdata/Adm-boot-b4 | 7bd812bddb5cf3f6b5605467fe0dde01cf5c0c67 | 60ae2a0629b602ce9d76e4a02dc2593026963f5a | refs/heads/master | 2023-04-09T16:20:00.070000 | 2021-04-27T05:08:45 | 2021-04-27T05:08:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cts.employee.entity;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Transient;
@Entity
public class Employee{
@Transient
private String info;
private String employeeName;
private double salary;
private String emailAddress;
@EmbeddedId
private EmployeeId employeeId;
public Employee() {
// TODO Auto-generated constructor stub
}
public Employee(String employeeName, double salary, String emailAddress, EmployeeId employeeId) {
super();
this.employeeName = employeeName;
this.salary = salary;
this.emailAddress = emailAddress;
this.employeeId = employeeId;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public EmployeeId getEmployeeId() {
return employeeId;
}
public void setEmployeeId(EmployeeId employeeId) {
this.employeeId = employeeId;
}
}
| UTF-8 | Java | 1,337 | java | Employee.java | Java | [] | null | [] | package com.cts.employee.entity;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Transient;
@Entity
public class Employee{
@Transient
private String info;
private String employeeName;
private double salary;
private String emailAddress;
@EmbeddedId
private EmployeeId employeeId;
public Employee() {
// TODO Auto-generated constructor stub
}
public Employee(String employeeName, double salary, String emailAddress, EmployeeId employeeId) {
super();
this.employeeName = employeeName;
this.salary = salary;
this.emailAddress = emailAddress;
this.employeeId = employeeId;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public EmployeeId getEmployeeId() {
return employeeId;
}
public void setEmployeeId(EmployeeId employeeId) {
this.employeeId = employeeId;
}
}
| 1,337 | 0.744951 | 0.744951 | 74 | 17.067568 | 18.357803 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.256757 | false | false | 12 |
a44f18d3fd8d3d1d51bf1e6b923d326f6dc5b498 | 10,892,037,093,784 | 6564322b54760207d7c7927c2e76951dd9ae72e7 | /src/main/java/life/wz/community/controller/PublishController.java | 3dade39d5b5dfff770eb734a4744ab1ff06f2ed7 | [] | no_license | wangzhen97/community | https://github.com/wangzhen97/community | e76985a9d57d72f177885817a493a9e72cc91d7c | d6b43423d605a8db9d8d99033df4711c31a845e3 | refs/heads/master | 2022-06-27T03:56:47.558000 | 2020-03-10T22:50:59 | 2020-03-10T22:50:59 | 242,684,979 | 0 | 0 | null | false | 2022-06-21T02:57:31 | 2020-02-24T08:37:12 | 2020-03-10T22:51:18 | 2022-06-21T02:57:30 | 81 | 0 | 0 | 3 | Java | false | false | package life.wz.community.controller;
import life.wz.community.dto.QuestionDTO;
import life.wz.community.mapper.QuestionMapper;
import life.wz.community.mapper.UserMapper;
import life.wz.community.model.Question;
import life.wz.community.model.User;
import life.wz.community.service.PublishService;
import life.wz.community.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.RequestMapping;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@Controller
public class PublishController {
@Autowired
private UserMapper userMapper;
@Autowired
private QuestionService questionService;
@GetMapping("/publish/{id}")
public String alertPublish(@PathVariable(name = "id") Integer id,
Model model){
QuestionDTO questionDTO=questionService.selectById(id);
System.out.println("ji1231231");
model.addAttribute("question",questionDTO);
return "publish";
}
@RequestMapping("/publish")
public String Publish(Model model) {
Question question = new Question();
model.addAttribute("question",question);
return "publish";
}
@PostMapping("/publish")
public String doPublish(Model model, Question question, HttpServletRequest request) {
User user=(User)request.getSession().getAttribute("user");
if(user==null){
return "redirect:/";
}
System.out.println("jinru111");
//model添加发布数据
model.addAttribute("question",question);
System.out.println(question);
//判断数据是否为空
if(question.getTitle()==null||"".equals(question.getTitle())){
model.addAttribute("msg","请输入标题");
return "publish";
}else if(question.getDescription()==null||"".equals(question.getDescription())){
model.addAttribute("msg","请输入问题");
return "publish";
}if(question.getTag()==null||"".equals(question.getTag())){
model.addAttribute("msg","请输入标签");
return "publish";
}
question.setCreator(user.getId());
questionService.insertOrUpdate(question);
return "redirect:/";
}
}
| UTF-8 | Java | 2,599 | java | PublishController.java | Java | [] | null | [] | package life.wz.community.controller;
import life.wz.community.dto.QuestionDTO;
import life.wz.community.mapper.QuestionMapper;
import life.wz.community.mapper.UserMapper;
import life.wz.community.model.Question;
import life.wz.community.model.User;
import life.wz.community.service.PublishService;
import life.wz.community.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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.RequestMapping;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
@Controller
public class PublishController {
@Autowired
private UserMapper userMapper;
@Autowired
private QuestionService questionService;
@GetMapping("/publish/{id}")
public String alertPublish(@PathVariable(name = "id") Integer id,
Model model){
QuestionDTO questionDTO=questionService.selectById(id);
System.out.println("ji1231231");
model.addAttribute("question",questionDTO);
return "publish";
}
@RequestMapping("/publish")
public String Publish(Model model) {
Question question = new Question();
model.addAttribute("question",question);
return "publish";
}
@PostMapping("/publish")
public String doPublish(Model model, Question question, HttpServletRequest request) {
User user=(User)request.getSession().getAttribute("user");
if(user==null){
return "redirect:/";
}
System.out.println("jinru111");
//model添加发布数据
model.addAttribute("question",question);
System.out.println(question);
//判断数据是否为空
if(question.getTitle()==null||"".equals(question.getTitle())){
model.addAttribute("msg","请输入标题");
return "publish";
}else if(question.getDescription()==null||"".equals(question.getDescription())){
model.addAttribute("msg","请输入问题");
return "publish";
}if(question.getTag()==null||"".equals(question.getTag())){
model.addAttribute("msg","请输入标签");
return "publish";
}
question.setCreator(user.getId());
questionService.insertOrUpdate(question);
return "redirect:/";
}
}
| 2,599 | 0.686344 | 0.682409 | 74 | 33.337837 | 22.513826 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.743243 | false | false | 12 |
a85187bd23d90f20c75a99fc1d7c9fa01972a4f2 | 18,502,719,167,522 | 2589067c1d90966515c27a988bec7193cd7acc9e | /com.sap.cloud.lm.sl.cf.core/src/main/java/com/sap/cloud/lm/sl/cf/core/security/serialization/model/ResourceSerializer.java | ff351fd038e4994d4d5526eb6a1752626825cc34 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | VaskoBozhurski/cf-mta-deploy-service | https://github.com/VaskoBozhurski/cf-mta-deploy-service | cd99f428902f5b34d1b43a613e7deaaaa5b1c26f | bdc048b780740de311902fc40ecb4d196cbb0d75 | refs/heads/master | 2020-03-19T03:05:07.890000 | 2020-01-08T08:51:50 | 2020-02-24T14:22:36 | 135,693,321 | 1 | 0 | Apache-2.0 | true | 2019-08-21T09:32:35 | 2018-06-01T08:52:49 | 2019-08-21T09:31:29 | 2019-08-21T09:32:34 | 12,254 | 1 | 0 | 0 | Java | false | false | package com.sap.cloud.lm.sl.cf.core.security.serialization.model;
import com.sap.cloud.lm.sl.cf.core.security.serialization.SecureJsonSerializer;
import com.sap.cloud.lm.sl.cf.core.security.serialization.SecureSerializerConfiguration;
import com.sap.cloud.lm.sl.cf.core.security.serialization.masking.ResourceMasker;
import com.sap.cloud.lm.sl.mta.model.Resource;
public class ResourceSerializer extends SecureJsonSerializer {
private final ResourceMasker masker = new ResourceMasker();
public ResourceSerializer(SecureSerializerConfiguration configuration) {
super(configuration);
}
@Override
public String serialize(Object object) {
Resource clonedResource = Resource.copyOf((Resource) object);
masker.mask(clonedResource);
return super.serialize(clonedResource);
}
}
| UTF-8 | Java | 851 | java | ResourceSerializer.java | Java | [] | null | [] | package com.sap.cloud.lm.sl.cf.core.security.serialization.model;
import com.sap.cloud.lm.sl.cf.core.security.serialization.SecureJsonSerializer;
import com.sap.cloud.lm.sl.cf.core.security.serialization.SecureSerializerConfiguration;
import com.sap.cloud.lm.sl.cf.core.security.serialization.masking.ResourceMasker;
import com.sap.cloud.lm.sl.mta.model.Resource;
public class ResourceSerializer extends SecureJsonSerializer {
private final ResourceMasker masker = new ResourceMasker();
public ResourceSerializer(SecureSerializerConfiguration configuration) {
super(configuration);
}
@Override
public String serialize(Object object) {
Resource clonedResource = Resource.copyOf((Resource) object);
masker.mask(clonedResource);
return super.serialize(clonedResource);
}
}
| 851 | 0.755582 | 0.755582 | 21 | 38.523811 | 31.299809 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false | 12 |
3209b75407f7d5f2e47a4f0066d90de7d63ccf7a | 15,934,328,729,015 | 694ebbb461dbfe755f70f101da56a8e6a2a19365 | /src/main/java/org/adams/roo/procon/service/impl/RoleServiceImpl.java | 1234102e715b77622cdfa1d2bc26d0ab30a70ce0 | [] | no_license | Thomas-Adams/project-controlling | https://github.com/Thomas-Adams/project-controlling | 64f05e97818ec899a76e789d69d3a8f513961265 | 3155268a0804c1743b149df007b4721ccf4c106d | refs/heads/master | 2016-09-06T18:00:13.317000 | 2014-10-12T12:45:31 | 2014-10-12T12:45:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.adams.roo.procon.service.impl;
import java.util.List;
import org.adams.roo.procon.persistence.entity.Role;
import org.adams.roo.procon.persistence.repository.RoleRepository;
import org.adams.roo.procon.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class RoleServiceImpl implements RoleService {
@Autowired
RoleRepository roleRepository;
@Override
public long countAllRoles() {
return roleRepository.count();
}
@Override
public void deleteRole(final Role role) {
roleRepository.delete(role);
}
@Override
public Role findRole(final Integer id) {
return roleRepository.findOne(id);
}
@Override
public List<Role> findAllRoles() {
return roleRepository.findAll();
}
@Override
public List<Role> findRoleEntries(final int firstResult,
final int maxResults) {
return roleRepository.findAll(
new org.springframework.data.domain.PageRequest(firstResult
/ maxResults, maxResults)).getContent();
}
@Override
public void saveRole(final Role role) {
roleRepository.save(role);
}
@Override
public Role updateRole(final Role role) {
return roleRepository.save(role);
}
@Override
public long countAll() {
return countAllRoles();
}
@Override
public void delete(final Role entity) {
deleteRole(entity);
}
@Override
public Role find(final Integer id) {
return findRole(id);
}
@Override
public List<Role> findAll() {
return findAllRoles();
}
@Override
public List<Role> findEntries(final int firstResult, final int maxResults) {
return findRoleEntries(firstResult, maxResults);
}
@Override
public void save(final Role entity) {
saveRole(entity);
}
@Override
public Role update(final Role entity) {
return updateRole(entity);
}
}
| UTF-8 | Java | 1,905 | java | RoleServiceImpl.java | Java | [] | null | [] | package org.adams.roo.procon.service.impl;
import java.util.List;
import org.adams.roo.procon.persistence.entity.Role;
import org.adams.roo.procon.persistence.repository.RoleRepository;
import org.adams.roo.procon.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class RoleServiceImpl implements RoleService {
@Autowired
RoleRepository roleRepository;
@Override
public long countAllRoles() {
return roleRepository.count();
}
@Override
public void deleteRole(final Role role) {
roleRepository.delete(role);
}
@Override
public Role findRole(final Integer id) {
return roleRepository.findOne(id);
}
@Override
public List<Role> findAllRoles() {
return roleRepository.findAll();
}
@Override
public List<Role> findRoleEntries(final int firstResult,
final int maxResults) {
return roleRepository.findAll(
new org.springframework.data.domain.PageRequest(firstResult
/ maxResults, maxResults)).getContent();
}
@Override
public void saveRole(final Role role) {
roleRepository.save(role);
}
@Override
public Role updateRole(final Role role) {
return roleRepository.save(role);
}
@Override
public long countAll() {
return countAllRoles();
}
@Override
public void delete(final Role entity) {
deleteRole(entity);
}
@Override
public Role find(final Integer id) {
return findRole(id);
}
@Override
public List<Role> findAll() {
return findAllRoles();
}
@Override
public List<Role> findEntries(final int firstResult, final int maxResults) {
return findRoleEntries(firstResult, maxResults);
}
@Override
public void save(final Role entity) {
saveRole(entity);
}
@Override
public Role update(final Role entity) {
return updateRole(entity);
}
}
| 1,905 | 0.756955 | 0.756955 | 92 | 19.706522 | 20.091928 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.217391 | false | false | 12 |
adb890180c0d8b5d15d498472b62504636ff2845 | 24,910,810,363,386 | c608e86fd9d953de3afd13679a9d735fe1ba2b51 | /com/bloxomo/gametheory/cantstop/RuleOfN.java | d9b1fa31e45185d058bcd8f807ce45ebe8b3cc7f | [] | no_license | fatihcelikbas/cantstop_agent | https://github.com/fatihcelikbas/cantstop_agent | 4b6c8bbf31cd9d38431b3a3073bf0124edadcb74 | 2d641cafbd66baedd734d6ee5fb6043c6a66e31d | refs/heads/master | 2022-04-20T14:41:30.069000 | 2020-04-15T21:19:49 | 2020-04-15T21:19:49 | 256,039,090 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bloxomo.gametheory.cantstop;
import com.bloxomo.gametheory.*;
import java.util.*;
import com.sirmapsalot.combinatorics.*;
/**
* Implements a generalized version of the Rule of 28 Strategy from
* Michael Keller (http://www.solitairelaboratory.com/cantstop.html).
*/
public class RuleOfN
extends WeightedSpacesWithBasicPenaltyGroupsStrategy
{
public static final int ODD_PENALTY = 2;
public static final int EVEN_BONUS = -2;
public static final int HIGH_PENALTY = 4;
public static final int LOW_PENALTY = 4;
public static final int USED_MARKER_PENALTY = 6;
public RuleOfN(CantStopState g, int n)
{
super(g, n, new ColumnWeights(g), ODD_PENALTY, EVEN_BONUS, HIGH_PENALTY, LOW_PENALTY, USED_MARKER_PENALTY);
}
public RuleOfN(CantStopState g,
int[] columnWeights,
int oddPenalty,
int evenPenalty,
int highPenalty,
int lowPenalty,
int usedMarkerPenalty,
int threshold)
{
super(g, threshold, new ColumnWeightsArray(columnWeights), oddPenalty, evenPenalty, highPenalty, lowPenalty, usedMarkerPenalty);
}
public RuleOfN(CantStopState g,
int[] progressWeights,
int[] choiceWeights,
int oddPenalty,
int evenPenalty,
int highPenalty,
int lowPenalty,
int usedMarkerPenalty,
int threshold)
{
super(g, threshold, new ColumnWeightsArray(progressWeights, choiceWeights), oddPenalty, evenPenalty, highPenalty, lowPenalty, usedMarkerPenalty);
}
private static class ColumnWeightsArray implements Weights
{
private int[] progressWeights;
private int[] choiceWeights;
private ColumnWeightsArray(int[] p)
{
progressWeights = new int[p.length];
System.arraycopy(p, 0, progressWeights, 0, p.length);
choiceWeights = progressWeights;
}
private ColumnWeightsArray(int[] p, int[] c)
{
progressWeights = new int[p.length];
System.arraycopy(p, 0, progressWeights, 0, p.length);
choiceWeights = new int[c.length];
System.arraycopy(c, 0, choiceWeights, 0, c.length);
}
public int advancedProgressPoints(int col, int neutral)
{
if (col - 2 < progressWeights.length)
return progressWeights[col - 2];
else
return progressWeights[2 * progressWeights.length - col];
}
public int markedProgressPoints(int col, int neutral)
{
return advancedProgressPoints(col, neutral);
}
public int advancedChoicePoints(int col, int neutral)
{
if (col - 2 < choiceWeights.length)
return choiceWeights[col - 2];
else
return choiceWeights[2 * choiceWeights.length - col];
}
public int markedChoicePoints(int col, int neutral)
{
return advancedChoicePoints(col, neutral);
}
}
private static class ColumnWeights implements Weights
{
private CantStopState game;
private ColumnWeights(CantStopState g)
{
game = g;
}
/**
* Returns the progress points for advancement in a single column.
* The progress points can vary based on the position of the
* colored marker and the position of the neutral marker.
*
* @param neutral the position of the neutral marker in the column to score
* @param colored the position of the colored marker in the column to score
* @param col the column to score
* @return the progress point for advancement
*/
public int advancedProgressPoints(int col, int neutral)
{
return columnValue(col);
}
/**
* Returns the progress points for first marking a column.
* The progress points can vary based on the position of the
* colored marker. This implementation returns 0.
*
* @param colored the position of the colored marker in the column to score
* @param col the column to score
* @return the progress point for marking
*/
public int markedProgressPoints(int col, int colored)
{
return columnValue(col);
}
/**
* Returns the choice points for first placing a neutral marker
* in a column with the colored marker at the given position.
*
* @param col a column label
* @param space the index of a space in that column
*
* @return the points for marking that space
*/
public int markedChoicePoints(int col, int space)
{
return columnValue(col);
}
/**
* Returns the choice points for moving a neutral marker to
* a space.
*
* @param col a column label
* @param space the index of a space in that column
*/
public int advancedChoicePoints(int col, int space)
{
return columnValue(col);
}
/**
* Returns the value of a given column. The middle column's value
* is 1 and values increase by 1 os you move outward.
*
* @return the value of a given column
*/
private int columnValue(int col)
{
int middleColumn = (game.getHighestRoll() + game.getLowestRoll()) / 2;
return (Math.abs(col - middleColumn) + 1);
}
}
public static void main(String[] args)
{
new RuleOfN(new CantStopState(), 28);
}
}
| UTF-8 | Java | 4,904 | java | RuleOfN.java | Java | [
{
"context": "ralized version of the Rule of 28 Strategy from\n * Michael Keller (http://www.solitairelaboratory.com/cantstop.html",
"end": 225,
"score": 0.949967086315155,
"start": 211,
"tag": "NAME",
"value": "Michael Keller"
}
] | null | [] | package com.bloxomo.gametheory.cantstop;
import com.bloxomo.gametheory.*;
import java.util.*;
import com.sirmapsalot.combinatorics.*;
/**
* Implements a generalized version of the Rule of 28 Strategy from
* <NAME> (http://www.solitairelaboratory.com/cantstop.html).
*/
public class RuleOfN
extends WeightedSpacesWithBasicPenaltyGroupsStrategy
{
public static final int ODD_PENALTY = 2;
public static final int EVEN_BONUS = -2;
public static final int HIGH_PENALTY = 4;
public static final int LOW_PENALTY = 4;
public static final int USED_MARKER_PENALTY = 6;
public RuleOfN(CantStopState g, int n)
{
super(g, n, new ColumnWeights(g), ODD_PENALTY, EVEN_BONUS, HIGH_PENALTY, LOW_PENALTY, USED_MARKER_PENALTY);
}
public RuleOfN(CantStopState g,
int[] columnWeights,
int oddPenalty,
int evenPenalty,
int highPenalty,
int lowPenalty,
int usedMarkerPenalty,
int threshold)
{
super(g, threshold, new ColumnWeightsArray(columnWeights), oddPenalty, evenPenalty, highPenalty, lowPenalty, usedMarkerPenalty);
}
public RuleOfN(CantStopState g,
int[] progressWeights,
int[] choiceWeights,
int oddPenalty,
int evenPenalty,
int highPenalty,
int lowPenalty,
int usedMarkerPenalty,
int threshold)
{
super(g, threshold, new ColumnWeightsArray(progressWeights, choiceWeights), oddPenalty, evenPenalty, highPenalty, lowPenalty, usedMarkerPenalty);
}
private static class ColumnWeightsArray implements Weights
{
private int[] progressWeights;
private int[] choiceWeights;
private ColumnWeightsArray(int[] p)
{
progressWeights = new int[p.length];
System.arraycopy(p, 0, progressWeights, 0, p.length);
choiceWeights = progressWeights;
}
private ColumnWeightsArray(int[] p, int[] c)
{
progressWeights = new int[p.length];
System.arraycopy(p, 0, progressWeights, 0, p.length);
choiceWeights = new int[c.length];
System.arraycopy(c, 0, choiceWeights, 0, c.length);
}
public int advancedProgressPoints(int col, int neutral)
{
if (col - 2 < progressWeights.length)
return progressWeights[col - 2];
else
return progressWeights[2 * progressWeights.length - col];
}
public int markedProgressPoints(int col, int neutral)
{
return advancedProgressPoints(col, neutral);
}
public int advancedChoicePoints(int col, int neutral)
{
if (col - 2 < choiceWeights.length)
return choiceWeights[col - 2];
else
return choiceWeights[2 * choiceWeights.length - col];
}
public int markedChoicePoints(int col, int neutral)
{
return advancedChoicePoints(col, neutral);
}
}
private static class ColumnWeights implements Weights
{
private CantStopState game;
private ColumnWeights(CantStopState g)
{
game = g;
}
/**
* Returns the progress points for advancement in a single column.
* The progress points can vary based on the position of the
* colored marker and the position of the neutral marker.
*
* @param neutral the position of the neutral marker in the column to score
* @param colored the position of the colored marker in the column to score
* @param col the column to score
* @return the progress point for advancement
*/
public int advancedProgressPoints(int col, int neutral)
{
return columnValue(col);
}
/**
* Returns the progress points for first marking a column.
* The progress points can vary based on the position of the
* colored marker. This implementation returns 0.
*
* @param colored the position of the colored marker in the column to score
* @param col the column to score
* @return the progress point for marking
*/
public int markedProgressPoints(int col, int colored)
{
return columnValue(col);
}
/**
* Returns the choice points for first placing a neutral marker
* in a column with the colored marker at the given position.
*
* @param col a column label
* @param space the index of a space in that column
*
* @return the points for marking that space
*/
public int markedChoicePoints(int col, int space)
{
return columnValue(col);
}
/**
* Returns the choice points for moving a neutral marker to
* a space.
*
* @param col a column label
* @param space the index of a space in that column
*/
public int advancedChoicePoints(int col, int space)
{
return columnValue(col);
}
/**
* Returns the value of a given column. The middle column's value
* is 1 and values increase by 1 os you move outward.
*
* @return the value of a given column
*/
private int columnValue(int col)
{
int middleColumn = (game.getHighestRoll() + game.getLowestRoll()) / 2;
return (Math.abs(col - middleColumn) + 1);
}
}
public static void main(String[] args)
{
new RuleOfN(new CantStopState(), 28);
}
}
| 4,896 | 0.698817 | 0.693515 | 186 | 25.365591 | 26.52602 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.33871 | false | false | 12 |
c0d5b48cc42abc819e2003aab5edcbf12ea7d88c | 343,597,391,918 | 1bdeadcdac381fe3f2b7eb92e0fae0bd6805d002 | /LocadoraDeVeiculos/src/teste/TesteJOptionPane.java | 0cfd961eef09584d452b2226a91e44755afc2781 | [] | no_license | vinydev/Projeto-de-POO-com-Java-e-JOption-Pane | https://github.com/vinydev/Projeto-de-POO-com-Java-e-JOption-Pane | 837c8221ac7a29c4c2f4a0b08735c60041ec7f31 | e3493d7461a5bd8ec6316c4b914490811f8c4ea5 | refs/heads/master | 2020-10-02T02:16:58.723000 | 2019-12-12T19:12:28 | 2019-12-12T19:12:28 | 227,678,104 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 teste;
import armazenamentoDeDados.ArraysLists;
import classesbasicas.Cliente;
import classesbasicas.ClientePessoaFisica;
import classesbasicas.ClientePessoaJuridica;
import classesbasicas.FormaDePagamento;
import classesbasicas.Funcionario;
import classesbasicas.Locacao;
import classesbasicas.Veiculo;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author Vinicius
*/
public class TesteJOptionPane {
public static void main(String[] args) throws ParseException {
cadastrarLocacao();
}
public static void cadastrarFucionario() throws ParseException {
/*Cadastrando funcionário com iteração com o usuário*/
Funcionario f = new Funcionario();
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
try {
f.setId();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros para o campo Id");
f.setId();
}
f.setNome(JOptionPane.showInputDialog("Digite o nome do funcionário"));
try {
f.setDtNascimento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
f.setDtNascimento();
}
f.setCpf(JOptionPane.showInputDialog("Digite o cpf do funcionário " + f.getNome()));
int reply = JOptionPane.showConfirmDialog(null, "A cnh de " + f.getNome() + " é Provisória?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
f.setCnhProvisoria(true);
} else {
f.setCnhProvisoria(false);
}
f.setCnh(JOptionPane.showInputDialog("Digite a cnh do funcionário " + f.getNome()));
f.seteMail(JOptionPane.showInputDialog("Digite o e-mail do funcionário " + f.getNome()));
try {
f.setSalario();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números reais");
}
f.setAtivo(true);
ArraysLists.getInstance().setarFuncionario(f);
f = null;
}
public static void cadastrarClientePessoaFisica() throws ParseException {
/*Cadastrando Cliente Pessoa Física*/
ClientePessoaFisica cpf = new ClientePessoaFisica();
try {
cpf.setId();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros para o campo Id");
cpf.setId();
}
cpf.setNome(JOptionPane.showInputDialog("Digite o nome do cliente"));
try {
cpf.setDtNascimento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
cpf.setDtNascimento();
}
cpf.setCpf(JOptionPane.showInputDialog("Digite o cpf do cliente " + cpf.getNome()));
int reply2 = JOptionPane.showConfirmDialog(null, "A cnh de " + cpf.getNome() + " é Provisória?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply2 == JOptionPane.YES_OPTION) {
cpf.setCnhProvisoria(true);
} else {
cpf.setCnhProvisoria(false);
}
cpf.setCnh(JOptionPane.showInputDialog("Digite a cnh do cliente " + cpf.getNome()));
cpf.seteMail(JOptionPane.showInputDialog("Digite o e-mail do cliente " + cpf.getNome()));
cpf.setAtivo(true);
ArraysLists.getInstance().setarCliente(cpf);
cpf = null;
}
public static void cadastrarPessoaJuridica() throws ParseException {
/*Cadastrando Cliente Pessoa Jurídica*/
ClientePessoaJuridica cpj = new ClientePessoaJuridica();
try {
cpj.setId();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros para o campo Id");
cpj.setId();
}
cpj.setNome(JOptionPane.showInputDialog("Digite o nome do cliente"));
try {
cpj.setDtNascimento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
cpj.setDtNascimento();
}
cpj.setCnpj(JOptionPane.showInputDialog("Digite o cnpj do cliente " + cpj.getNome()));
int reply = JOptionPane.showConfirmDialog(null, "A cnh de " + cpj.getNome() + " é Provisória?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
cpj.setCnhProvisoria(true);
} else {
cpj.setCnhProvisoria(false);
}
cpj.setCnh(JOptionPane.showInputDialog("Digite a cnh do condutor " + cpj.getNome()));
cpj.seteMail(JOptionPane.showInputDialog("Digite o e-mail do cliente " + cpj.getNome()));
cpj.setAtivo(true);
ArraysLists.getInstance().setarCliente(cpj);
cpj = null;
}
public static void cadastrarVeiculo() {
/*Cadastrando Veículo*/
Veiculo v = new Veiculo();
try {
v.setIdVeiculo();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
v.setIdVeiculo();
}
int reply = JOptionPane.showConfirmDialog(null, "O veículo de id = " + v.getIdVeiculo() + " está disponível?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
v.setDisponivel(true);
} else {
v.setDisponivel(false);
}
int reply2 = JOptionPane.showConfirmDialog(null, "O veículo de id = " + v.getIdVeiculo() + " está com o seguro pago?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply2 == JOptionPane.YES_OPTION) {
v.setSeguroPago(true);
} else {
v.setSeguroPago(false);
}
try {
v.setValorDiaria();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números reais");
v.setValorDiaria();
}
int reply3 = JOptionPane.showConfirmDialog(null, "O veículo de id = " + v.getIdVeiculo() + " está com o ipva pago?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply3 == JOptionPane.YES_OPTION) {
v.setIpva(true);
} else {
v.setIpva(false);
}
try {
v.setQuilometragem();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
v.setQuilometragem();
}
v.setnChassi(JOptionPane.showInputDialog("Informe o número do chassi do carro de id = " + v.getIdVeiculo()));
v.setMarca(JOptionPane.showInputDialog("Informe a marca do veículo de id = " + v.getIdVeiculo()));
v.setModelo(JOptionPane.showInputDialog("Informe o medo do carro de id = " + v.getIdVeiculo()));
v.setAno(JOptionPane.showInputDialog("Informe o ano do carro de id = " + v.getIdVeiculo()));
v.setCategoria(JOptionPane.showInputDialog("Informe a categoria do carro de id = " + v.getIdVeiculo()));
v.setCor(JOptionPane.showInputDialog("Informe a cor do carro de id = " + v.getIdVeiculo()));
ArraysLists.getInstance().setarVeiculo(v);
v = null;
}
public static FormaDePagamento cadastrarFormadePagamento() {
FormaDePagamento f = new FormaDePagamento();
try {
f.setIdPagamento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
f.setIdPagamento();
}
f.setDescricao(JOptionPane.showInputDialog("Informe a descrição da forma de pagamento de id = " + f.getIdPagamento()));
try {
f.setValor();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números reais");
f.setValor();
}
return f;
}
public static void cadastrarLocacao() throws ParseException {
Locacao l = new Locacao();
try {
l.setIdLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setIdLocacao();
}
try {
l.setDataLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
l.setDataLocacao();
}
cadastrarVeiculo();
l.setVeiculo(ArraysLists.getInstance().retornarVeiculoAcabouDeRegistrar());
l.setValorDiaria(ArraysLists.getInstance().retornarVeiculoAcabouDeRegistrar().getValorDiaria());
try {
l.setQuantidadeDeDias();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setQuantidadeDeDias();
}
try {
l.setDataInicioLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
l.setDataInicioLocacao();
}
try {
l.setDataEntregaLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
l.setDataEntregaLocacao();
}
try {
l.setQuilometragemInicial();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setQuilometragemInicial();
}
try {
l.setQuilometragemFinal();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setQuilometragemFinal();
}
cadastrarClientePessoaFisica();
l.setCliente(ArraysLists.getInstance().retornarClienteAcabouDeRegistrar());
cadastrarFucionario();
l.setFuncionario(ArraysLists.getInstance().retornarFuncionarioAcabouDeRegistrar());
int i;
try {
i = Integer.parseInt(JOptionPane.showInputDialog("Deseja cadastrar Quantas formas de pagamento?"));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe Apenas numeros inteiros");
i = Integer.parseInt(JOptionPane.showInputDialog("Deseja cadastrar Quantas formas de pagamento?"));
}
for (int x = 1; x <= i; x++) {
l.setFormasDePagamento(cadastrarFormadePagamento());
}
int reply = JOptionPane.showConfirmDialog(null, "Deseja mostrar a locação que acabou de fazer?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
l.mostrarLocacao();
} else {
}
}
}
| UTF-8 | Java | 11,362 | java | TesteJOptionPane.java | Java | [
{
"context": "rt javax.swing.JOptionPane;\r\n\r\n/**\r\n *\r\n * @author Vinicius\r\n */\r\npublic class TesteJOptionPane {\r\n\r\n public",
"end": 705,
"score": 0.995730996131897,
"start": 697,
"tag": "NAME",
"value": "Vinicius"
}
] | null | [] | /*
* 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 teste;
import armazenamentoDeDados.ArraysLists;
import classesbasicas.Cliente;
import classesbasicas.ClientePessoaFisica;
import classesbasicas.ClientePessoaJuridica;
import classesbasicas.FormaDePagamento;
import classesbasicas.Funcionario;
import classesbasicas.Locacao;
import classesbasicas.Veiculo;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.swing.JOptionPane;
/**
*
* @author Vinicius
*/
public class TesteJOptionPane {
public static void main(String[] args) throws ParseException {
cadastrarLocacao();
}
public static void cadastrarFucionario() throws ParseException {
/*Cadastrando funcionário com iteração com o usuário*/
Funcionario f = new Funcionario();
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
try {
f.setId();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros para o campo Id");
f.setId();
}
f.setNome(JOptionPane.showInputDialog("Digite o nome do funcionário"));
try {
f.setDtNascimento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
f.setDtNascimento();
}
f.setCpf(JOptionPane.showInputDialog("Digite o cpf do funcionário " + f.getNome()));
int reply = JOptionPane.showConfirmDialog(null, "A cnh de " + f.getNome() + " é Provisória?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
f.setCnhProvisoria(true);
} else {
f.setCnhProvisoria(false);
}
f.setCnh(JOptionPane.showInputDialog("Digite a cnh do funcionário " + f.getNome()));
f.seteMail(JOptionPane.showInputDialog("Digite o e-mail do funcionário " + f.getNome()));
try {
f.setSalario();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números reais");
}
f.setAtivo(true);
ArraysLists.getInstance().setarFuncionario(f);
f = null;
}
public static void cadastrarClientePessoaFisica() throws ParseException {
/*Cadastrando Cliente Pessoa Física*/
ClientePessoaFisica cpf = new ClientePessoaFisica();
try {
cpf.setId();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros para o campo Id");
cpf.setId();
}
cpf.setNome(JOptionPane.showInputDialog("Digite o nome do cliente"));
try {
cpf.setDtNascimento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
cpf.setDtNascimento();
}
cpf.setCpf(JOptionPane.showInputDialog("Digite o cpf do cliente " + cpf.getNome()));
int reply2 = JOptionPane.showConfirmDialog(null, "A cnh de " + cpf.getNome() + " é Provisória?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply2 == JOptionPane.YES_OPTION) {
cpf.setCnhProvisoria(true);
} else {
cpf.setCnhProvisoria(false);
}
cpf.setCnh(JOptionPane.showInputDialog("Digite a cnh do cliente " + cpf.getNome()));
cpf.seteMail(JOptionPane.showInputDialog("Digite o e-mail do cliente " + cpf.getNome()));
cpf.setAtivo(true);
ArraysLists.getInstance().setarCliente(cpf);
cpf = null;
}
public static void cadastrarPessoaJuridica() throws ParseException {
/*Cadastrando Cliente Pessoa Jurídica*/
ClientePessoaJuridica cpj = new ClientePessoaJuridica();
try {
cpj.setId();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros para o campo Id");
cpj.setId();
}
cpj.setNome(JOptionPane.showInputDialog("Digite o nome do cliente"));
try {
cpj.setDtNascimento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
cpj.setDtNascimento();
}
cpj.setCnpj(JOptionPane.showInputDialog("Digite o cnpj do cliente " + cpj.getNome()));
int reply = JOptionPane.showConfirmDialog(null, "A cnh de " + cpj.getNome() + " é Provisória?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
cpj.setCnhProvisoria(true);
} else {
cpj.setCnhProvisoria(false);
}
cpj.setCnh(JOptionPane.showInputDialog("Digite a cnh do condutor " + cpj.getNome()));
cpj.seteMail(JOptionPane.showInputDialog("Digite o e-mail do cliente " + cpj.getNome()));
cpj.setAtivo(true);
ArraysLists.getInstance().setarCliente(cpj);
cpj = null;
}
public static void cadastrarVeiculo() {
/*Cadastrando Veículo*/
Veiculo v = new Veiculo();
try {
v.setIdVeiculo();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
v.setIdVeiculo();
}
int reply = JOptionPane.showConfirmDialog(null, "O veículo de id = " + v.getIdVeiculo() + " está disponível?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
v.setDisponivel(true);
} else {
v.setDisponivel(false);
}
int reply2 = JOptionPane.showConfirmDialog(null, "O veículo de id = " + v.getIdVeiculo() + " está com o seguro pago?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply2 == JOptionPane.YES_OPTION) {
v.setSeguroPago(true);
} else {
v.setSeguroPago(false);
}
try {
v.setValorDiaria();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números reais");
v.setValorDiaria();
}
int reply3 = JOptionPane.showConfirmDialog(null, "O veículo de id = " + v.getIdVeiculo() + " está com o ipva pago?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply3 == JOptionPane.YES_OPTION) {
v.setIpva(true);
} else {
v.setIpva(false);
}
try {
v.setQuilometragem();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
v.setQuilometragem();
}
v.setnChassi(JOptionPane.showInputDialog("Informe o número do chassi do carro de id = " + v.getIdVeiculo()));
v.setMarca(JOptionPane.showInputDialog("Informe a marca do veículo de id = " + v.getIdVeiculo()));
v.setModelo(JOptionPane.showInputDialog("Informe o medo do carro de id = " + v.getIdVeiculo()));
v.setAno(JOptionPane.showInputDialog("Informe o ano do carro de id = " + v.getIdVeiculo()));
v.setCategoria(JOptionPane.showInputDialog("Informe a categoria do carro de id = " + v.getIdVeiculo()));
v.setCor(JOptionPane.showInputDialog("Informe a cor do carro de id = " + v.getIdVeiculo()));
ArraysLists.getInstance().setarVeiculo(v);
v = null;
}
public static FormaDePagamento cadastrarFormadePagamento() {
FormaDePagamento f = new FormaDePagamento();
try {
f.setIdPagamento();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
f.setIdPagamento();
}
f.setDescricao(JOptionPane.showInputDialog("Informe a descrição da forma de pagamento de id = " + f.getIdPagamento()));
try {
f.setValor();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números reais");
f.setValor();
}
return f;
}
public static void cadastrarLocacao() throws ParseException {
Locacao l = new Locacao();
try {
l.setIdLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setIdLocacao();
}
try {
l.setDataLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
l.setDataLocacao();
}
cadastrarVeiculo();
l.setVeiculo(ArraysLists.getInstance().retornarVeiculoAcabouDeRegistrar());
l.setValorDiaria(ArraysLists.getInstance().retornarVeiculoAcabouDeRegistrar().getValorDiaria());
try {
l.setQuantidadeDeDias();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setQuantidadeDeDias();
}
try {
l.setDataInicioLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
l.setDataInicioLocacao();
}
try {
l.setDataEntregaLocacao();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe a data no formato: dd/MM/yyyy");
l.setDataEntregaLocacao();
}
try {
l.setQuilometragemInicial();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setQuilometragemInicial();
}
try {
l.setQuilometragemFinal();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe apenas números inteiros");
l.setQuilometragemFinal();
}
cadastrarClientePessoaFisica();
l.setCliente(ArraysLists.getInstance().retornarClienteAcabouDeRegistrar());
cadastrarFucionario();
l.setFuncionario(ArraysLists.getInstance().retornarFuncionarioAcabouDeRegistrar());
int i;
try {
i = Integer.parseInt(JOptionPane.showInputDialog("Deseja cadastrar Quantas formas de pagamento?"));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Informe Apenas numeros inteiros");
i = Integer.parseInt(JOptionPane.showInputDialog("Deseja cadastrar Quantas formas de pagamento?"));
}
for (int x = 1; x <= i; x++) {
l.setFormasDePagamento(cadastrarFormadePagamento());
}
int reply = JOptionPane.showConfirmDialog(null, "Deseja mostrar a locação que acabou de fazer?", "Informação", JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
l.mostrarLocacao();
} else {
}
}
}
| 11,362 | 0.601681 | 0.601061 | 263 | 40.984791 | 34.92915 | 168 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.711027 | false | false | 12 |
5b63bcb0b4e7f4038f2d2114cd45d2ccaef87c99 | 15,169,824,495,885 | eefe93a265ff2bf4c773fbf026baa035d3674ea7 | /tracker-core/src/main/java/jdev/tracker/TrackerMain.java | 91b027aeaaf3a5d555c79371a7b375d36839cfea | [] | no_license | khvat-ea/Toll | https://github.com/khvat-ea/Toll | 3bbebd90c8502c604d131e559614d5dadabd7e51 | be224e2277cc74fb959ec0fae51d829204cf3d98 | refs/heads/main | 2023-02-07T05:39:21.681000 | 2020-12-30T05:59:48 | 2020-12-30T05:59:48 | 307,143,515 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package jdev.tracker;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class TrackerMain {
public static void main(String[] args) {
new SpringApplicationBuilder(TrackerMain.class)
.profiles("Test", "Prod")
.run(args);
}
}
| UTF-8 | Java | 389 | java | TrackerMain.java | Java | [] | null | [] | package jdev.tracker;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class TrackerMain {
public static void main(String[] args) {
new SpringApplicationBuilder(TrackerMain.class)
.profiles("Test", "Prod")
.run(args);
}
}
| 389 | 0.714653 | 0.714653 | 14 | 26.785715 | 23.607441 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 12 |
8a838cd7d8620b0583728fbe127ec89188943a18 | 18,528,488,922,307 | c3400165d6d3f6b7fd508ffbce5b0320b652834f | /BsApp.java | 5e3e64ea23f11ac8f7b2b9ea863001e3e5169296 | [] | no_license | adamrparsons/battleships | https://github.com/adamrparsons/battleships | aba92fb43396bfdcb9f5885d4f226b90b502f935 | be3133c4039a61f52569a562fa8beec0328d8bf3 | refs/heads/master | 2021-05-27T16:52:31.541000 | 2014-10-07T17:39:18 | 2014-10-07T17:39:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import io.*;
public class BsApp
{
public static void main (String [] args) //Main method, first asks for the name of the map file, then creates the relevant
//objects and calls the significant methods of BattleShips object bsObject
{
char elementTest;
int size;
TextFile theMapFile;
theMapFile = readMap();
size = theMapFile.readInt();
theMapFile.clearRestOfLine();
System.out.println("maps is " + size + " in both dimensions");
BattleShips bsObject = new BattleShips(size);
bsObject.populateMap(theMapFile);
theMapFile.closeFile();
bsObject.play();
}
public static TextFile readMap () //Method for reading data file into memory
{
String fileNameInput;
TextFile theMapFile;
do{
fileNameInput = ConsoleInput.readWord("enter map filename");
theMapFile = new TextFile (fileNameInput, "r");
} while (theMapFile.openFile() == false);
return theMapFile;
}
}
| UTF-8 | Java | 995 | java | BsApp.java | Java | [] | null | [] | import io.*;
public class BsApp
{
public static void main (String [] args) //Main method, first asks for the name of the map file, then creates the relevant
//objects and calls the significant methods of BattleShips object bsObject
{
char elementTest;
int size;
TextFile theMapFile;
theMapFile = readMap();
size = theMapFile.readInt();
theMapFile.clearRestOfLine();
System.out.println("maps is " + size + " in both dimensions");
BattleShips bsObject = new BattleShips(size);
bsObject.populateMap(theMapFile);
theMapFile.closeFile();
bsObject.play();
}
public static TextFile readMap () //Method for reading data file into memory
{
String fileNameInput;
TextFile theMapFile;
do{
fileNameInput = ConsoleInput.readWord("enter map filename");
theMapFile = new TextFile (fileNameInput, "r");
} while (theMapFile.openFile() == false);
return theMapFile;
}
}
| 995 | 0.653266 | 0.653266 | 44 | 20.613636 | 28.305328 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.431818 | false | false | 12 |
3218fdfe4d0c575b3f046a02759060cee8e64e9c | 29,515,015,263,742 | da9157b809dbca1fa4754258396ea92e174f05ca | /net.sourceforge.vrapper.core/src/net/sourceforge/vrapper/vim/LocalConfigurationListener.java | 20a9e83bf02382efdccd0ba3506a77e29c0e1492 | [] | no_license | keforbes/vrapper | https://github.com/keforbes/vrapper | c5477c641c6e6fe3a107ca1969ce78f02e5bfaa0 | 95dca4cdc896a65f6e4f27cc7db63591d4cf5903 | refs/heads/master | 2021-01-15T22:57:24.656000 | 2013-01-29T19:53:51 | 2013-01-29T19:53:51 | 1,818,684 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package net.sourceforge.vrapper.vim;
import net.sourceforge.vrapper.platform.Configuration.Option;
/** Listener which gets called when configuration changes in currently active editor. */
public interface LocalConfigurationListener {
public <T> void optionChanged(Option<T> option, T oldValue, T newValue);
}
| UTF-8 | Java | 316 | java | LocalConfigurationListener.java | Java | [] | null | [] | package net.sourceforge.vrapper.vim;
import net.sourceforge.vrapper.platform.Configuration.Option;
/** Listener which gets called when configuration changes in currently active editor. */
public interface LocalConfigurationListener {
public <T> void optionChanged(Option<T> option, T oldValue, T newValue);
}
| 316 | 0.794304 | 0.794304 | 8 | 38.5 | 33.275368 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false | 12 |
7580ce71e7ced90340a62f5505bed68aab92cf93 | 31,731,218,389,783 | 08b20e786c4fc59cd860794f2cb5f2407988691b | /PersonalInformation.java | fca01234614eba3ed4edbc53603f930fa23e1653 | [] | no_license | tyellu/FlightApp | https://github.com/tyellu/FlightApp | 768b3718b094ccab0bd25773c8ed2bb4dd62a69b | 3d25472459e090d1c3d41e7390afcdcbf5940270 | refs/heads/master | 2021-01-15T11:29:55.752000 | 2017-02-12T18:05:54 | 2017-02-12T18:05:54 | 99,620,811 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package information;
import java.io.Serializable;
/**
* A representation of the personal information of a client.
*/
public class PersonalInformation implements Serializable {
/**
* Serialization.
*/
private static final long serialVersionUID = -5457724858278349036L;
private String lastName;
private String firstName;
private String email;
private String address;
/**
* Creates a personal information object given lastName, firstName, email and
* address.
*
* @param lastName
* The lastName of the user.
* @param firstName
* The firstName of the user.
* @param email
* The email address of the user.
* @param address
* The address of residence of the user.
*/
public PersonalInformation(String lastName, String firstName, String email, String address) {
super();
this.lastName = lastName;
this.firstName = firstName;
this.email = email;
this.address = address;
}
/**
* Returns the lastName of this user.
*
* @return the lastName of the user
*/
public String getLastName() {
return lastName;
}
/**
* Sets the new lastName for the user given a new lastName.
*
* @param lastName
* the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* Returns the firstName of this user.
*
* @return the firstName of the user.
*/
public String getFirstName() {
return firstName;
}
/**
* sets the new firstName for this user given a new firstName.
*
* @param firstName
* the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* Returns the email for this user.
*
* @return the email of the user.
*/
public String getEmail() {
return email;
}
/**
* Sets the new email for this user given a new email.
*
* @param email
* the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Returns the address for this user.
*
* @return the address of the user.
*/
public String getAddress() {
return address;
}
/**
* Sets the new address for this user given the new email.
*
* @param address
* the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PersonalInformation)) {
return false;
}
PersonalInformation other = (PersonalInformation) obj;
if (address == null) {
if (other.address != null) {
return false;
}
} else if (!address.equals(other.address)) {
return false;
}
if (email == null) {
if (other.email != null) {
return false;
}
} else if (!email.equals(other.email)) {
return false;
}
if (firstName == null) {
if (other.firstName != null) {
return false;
}
} else if (!firstName.equals(other.firstName)) {
return false;
}
if (lastName == null) {
if (other.lastName != null) {
return false;
}
} else if (!lastName.equals(other.lastName)) {
return false;
}
return true;
}
}
| UTF-8 | Java | 3,972 | java | PersonalInformation.java | Java | [
{
"context": " this.lastName = lastName;\n this.firstName = firstName;\n this.email = email;\n this.address = addre",
"end": 934,
"score": 0.8084890246391296,
"start": 925,
"tag": "NAME",
"value": "firstName"
}
] | null | [] | package information;
import java.io.Serializable;
/**
* A representation of the personal information of a client.
*/
public class PersonalInformation implements Serializable {
/**
* Serialization.
*/
private static final long serialVersionUID = -5457724858278349036L;
private String lastName;
private String firstName;
private String email;
private String address;
/**
* Creates a personal information object given lastName, firstName, email and
* address.
*
* @param lastName
* The lastName of the user.
* @param firstName
* The firstName of the user.
* @param email
* The email address of the user.
* @param address
* The address of residence of the user.
*/
public PersonalInformation(String lastName, String firstName, String email, String address) {
super();
this.lastName = lastName;
this.firstName = firstName;
this.email = email;
this.address = address;
}
/**
* Returns the lastName of this user.
*
* @return the lastName of the user
*/
public String getLastName() {
return lastName;
}
/**
* Sets the new lastName for the user given a new lastName.
*
* @param lastName
* the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* Returns the firstName of this user.
*
* @return the firstName of the user.
*/
public String getFirstName() {
return firstName;
}
/**
* sets the new firstName for this user given a new firstName.
*
* @param firstName
* the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* Returns the email for this user.
*
* @return the email of the user.
*/
public String getEmail() {
return email;
}
/**
* Sets the new email for this user given a new email.
*
* @param email
* the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* Returns the address for this user.
*
* @return the address of the user.
*/
public String getAddress() {
return address;
}
/**
* Sets the new address for this user given the new email.
*
* @param address
* the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PersonalInformation)) {
return false;
}
PersonalInformation other = (PersonalInformation) obj;
if (address == null) {
if (other.address != null) {
return false;
}
} else if (!address.equals(other.address)) {
return false;
}
if (email == null) {
if (other.email != null) {
return false;
}
} else if (!email.equals(other.email)) {
return false;
}
if (firstName == null) {
if (other.firstName != null) {
return false;
}
} else if (!firstName.equals(other.firstName)) {
return false;
}
if (lastName == null) {
if (other.lastName != null) {
return false;
}
} else if (!lastName.equals(other.lastName)) {
return false;
}
return true;
}
}
| 3,972 | 0.592145 | 0.585599 | 177 | 21.440678 | 19.853365 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.254237 | false | false | 12 |
c315060a212516a348792ea3e1963fbd3e614272 | 31,928,786,886,733 | 891de328dcba0625d0de89007cfac625f438162d | /src/cbs/LoginForm.java | 6828371a76f5b0ec1e916a90380ec58e0ffac509 | [] | no_license | kzcortes07/cbs | https://github.com/kzcortes07/cbs | fcc24ffbea5013313b39f5daa80ce05940abab54 | 726bc47656d68b723f6b84cf64bbbaa9c1c54216 | refs/heads/master | 2021-02-09T12:05:17.955000 | 2020-03-10T03:14:14 | 2020-03-10T03:14:14 | 244,193,574 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 cbs;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
/**
*
* @author Ken Zedric Cortes
*/
public class LoginForm extends javax.swing.JFrame {
/**
* Creates new form LoginForm
*/
public LoginForm() {
initComponents();
this.setLocationRelativeTo(null);
ImageIcon myimage = new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("csclogo.png")));
Image img1= myimage.getImage();
Image img2=img1.getScaledInstance(StudInfo.getWidth(),StudInfo.getHeight(),Image.SCALE_SMOOTH);
ImageIcon i=new ImageIcon(img2);
StudInfo.setIcon(i);
}
/**
* 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() {
button1 = new java.awt.Button();
jButton1 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
StudInfo = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
username = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
password = new javax.swing.JPasswordField();
jLabel4 = new javax.swing.JLabel();
jButtonLogin = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jButton2 = new javax.swing.JButton();
button1.setLabel("button1");
jButton1.setText("jButton1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 255, 255));
setLocation(new java.awt.Point(500, 500));
setLocationByPlatform(true);
setUndecorated(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBackground(new java.awt.Color(255, 255, 255));
jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(126, 14, 9));
jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
jPanel1.setForeground(new java.awt.Color(255, 255, 255));
jPanel1.setAlignmentX(10.0F);
jPanel1.setFont(new java.awt.Font("Agency FB", 0, 13)); // NOI18N
jPanel1.setInheritsPopupMenu(true);
jPanel1.setMaximumSize(new java.awt.Dimension(500, 500));
jPanel1.setLayout(null);
jLabel3.setFont(new java.awt.Font("Cambria", 0, 24)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("CSC BORROWING SYSTEM");
jPanel1.add(jLabel3);
jLabel3.setBounds(110, 390, 274, 56);
StudInfo.setBackground(new java.awt.Color(255, 255, 255));
StudInfo.setMaximumSize(new java.awt.Dimension(1129, 152));
StudInfo.setMinimumSize(new java.awt.Dimension(1129, 152));
StudInfo.setPreferredSize(new java.awt.Dimension(1129, 152));
jPanel1.add(StudInfo);
StudInfo.setBounds(140, 170, 214, 211);
jPanel2.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 500, 672));
jPanel4.setBackground(new java.awt.Color(255, 255, 255));
jPanel4.setPreferredSize(new java.awt.Dimension(500, 650));
username.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
username.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
usernameActionPerformed(evt);
}
});
jLabel2.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
jLabel2.setText("Username");
password.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
jLabel4.setText("Password");
jButtonLogin.setBackground(new java.awt.Color(126, 14, 9));
jButtonLogin.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
jButtonLogin.setForeground(new java.awt.Color(255, 255, 255));
jButtonLogin.setText("Sign In");
jButtonLogin.setAutoscrolls(true);
jButtonLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonLoginActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Cambria", 1, 48)); // NOI18N
jLabel5.setText("Sign In");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(73, 73, 73)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4)
.addComponent(jLabel2)
.addComponent(password, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
.addComponent(username)))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(131, 131, 131)
.addComponent(jButtonLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(27, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel5)
.addGap(114, 114, 114))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap(116, Short.MAX_VALUE)
.addComponent(jLabel5)
.addGap(63, 63, 63)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(username, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(60, 60, 60)
.addComponent(jButtonLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(146, 146, 146))
);
jPanel2.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(507, 0, 428, 663));
jPanel3.setBackground(new java.awt.Color(255, 255, 255));
jButton2.setBackground(new java.awt.Color(126, 14, 9));
jButton2.setFont(new java.awt.Font("Berlin Sans FB", 1, 24)); // NOI18N
jButton2.setForeground(new java.awt.Color(255, 255, 255));
jButton2.setText("X");
jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel2.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(951, 0, -1, -1));
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1000, 670));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLoginActionPerformed
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/cbs_db", "root", "");
String sql = "SELECT * FROM users WHERE username=? and password=?";
String pass = password.getText();
PreparedStatement pst = con.prepareStatement(sql);
pst.setString(1, username.getText());
pst.setString(2, password.getText());
ResultSet rs = pst.executeQuery();
if(rs.next()){
String passwordd = rs.getString("password");
if(pass.equals(passwordd))
{
Check check = new Check();
check.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(null,"Invalid Username or Password","Error",JOptionPane.ERROR_MESSAGE);
}
// JOptionPane.showMessageDialog(null, "Successfully Login!");
// CSCTables myobj = new CSCTables();
// myobj.setVisible(true);
//// dispose();
}
else{
JOptionPane.showMessageDialog(null, "Invalid Username or Password","Error",JOptionPane.ERROR_MESSAGE);
username.setText("");
password.setText("");
}
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
}//GEN-LAST:event_jButtonLoginActionPerformed
private void usernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usernameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_usernameActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
System.exit(0);
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoginForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel StudInfo;
private java.awt.Button button1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButtonLogin;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPasswordField password;
private javax.swing.JTextField username;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 14,145 | java | LoginForm.java | Java | [
{
"context": "con;\nimport javax.swing.JFrame;\n\n/**\n *\n * @author Ken Zedric Cortes\n */\npublic class LoginForm extends javax.swing.JF",
"end": 496,
"score": 0.9998758435249329,
"start": 479,
"tag": "NAME",
"value": "Ken Zedric Cortes"
},
{
"context": "= new javax.swing.JLabel()... | null | [] | /*
* 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 cbs;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
/**
*
* @author <NAME>
*/
public class LoginForm extends javax.swing.JFrame {
/**
* Creates new form LoginForm
*/
public LoginForm() {
initComponents();
this.setLocationRelativeTo(null);
ImageIcon myimage = new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("csclogo.png")));
Image img1= myimage.getImage();
Image img2=img1.getScaledInstance(StudInfo.getWidth(),StudInfo.getHeight(),Image.SCALE_SMOOTH);
ImageIcon i=new ImageIcon(img2);
StudInfo.setIcon(i);
}
/**
* 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() {
button1 = new java.awt.Button();
jButton1 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
StudInfo = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
username = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
password = new <PASSWORD>();
jLabel4 = new javax.swing.JLabel();
jButtonLogin = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jButton2 = new javax.swing.JButton();
button1.setLabel("button1");
jButton1.setText("jButton1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 255, 255));
setLocation(new java.awt.Point(500, 500));
setLocationByPlatform(true);
setUndecorated(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel2.setBackground(new java.awt.Color(255, 255, 255));
jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(126, 14, 9));
jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
jPanel1.setForeground(new java.awt.Color(255, 255, 255));
jPanel1.setAlignmentX(10.0F);
jPanel1.setFont(new java.awt.Font("Agency FB", 0, 13)); // NOI18N
jPanel1.setInheritsPopupMenu(true);
jPanel1.setMaximumSize(new java.awt.Dimension(500, 500));
jPanel1.setLayout(null);
jLabel3.setFont(new java.awt.Font("Cambria", 0, 24)); // NOI18N
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText("CSC BORROWING SYSTEM");
jPanel1.add(jLabel3);
jLabel3.setBounds(110, 390, 274, 56);
StudInfo.setBackground(new java.awt.Color(255, 255, 255));
StudInfo.setMaximumSize(new java.awt.Dimension(1129, 152));
StudInfo.setMinimumSize(new java.awt.Dimension(1129, 152));
StudInfo.setPreferredSize(new java.awt.Dimension(1129, 152));
jPanel1.add(StudInfo);
StudInfo.setBounds(140, 170, 214, 211);
jPanel2.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 500, 672));
jPanel4.setBackground(new java.awt.Color(255, 255, 255));
jPanel4.setPreferredSize(new java.awt.Dimension(500, 650));
username.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
username.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
usernameActionPerformed(evt);
}
});
jLabel2.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
jLabel2.setText("Username");
password.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel4.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
jLabel4.setText("<PASSWORD>");
jButtonLogin.setBackground(new java.awt.Color(126, 14, 9));
jButtonLogin.setFont(new java.awt.Font("Cambria", 0, 18)); // NOI18N
jButtonLogin.setForeground(new java.awt.Color(255, 255, 255));
jButtonLogin.setText("Sign In");
jButtonLogin.setAutoscrolls(true);
jButtonLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonLoginActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Cambria", 1, 48)); // NOI18N
jLabel5.setText("Sign In");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(73, 73, 73)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4)
.addComponent(jLabel2)
.addComponent(password, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
.addComponent(username)))
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(131, 131, 131)
.addComponent(jButtonLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(27, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel5)
.addGap(114, 114, 114))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap(116, Short.MAX_VALUE)
.addComponent(jLabel5)
.addGap(63, 63, 63)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(username, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(60, 60, 60)
.addComponent(jButtonLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(146, 146, 146))
);
jPanel2.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(507, 0, 428, 663));
jPanel3.setBackground(new java.awt.Color(255, 255, 255));
jButton2.setBackground(new java.awt.Color(126, 14, 9));
jButton2.setFont(new java.awt.Font("Berlin Sans FB", 1, 24)); // NOI18N
jButton2.setForeground(new java.awt.Color(255, 255, 255));
jButton2.setText("X");
jButton2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
jPanel2.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(951, 0, -1, -1));
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1000, 670));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLoginActionPerformed
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/cbs_db", "root", "");
String sql = "SELECT * FROM users WHERE username=? and password=?";
String pass = password.getText();
PreparedStatement pst = con.prepareStatement(sql);
pst.setString(1, username.getText());
pst.setString(2, password.getText());
ResultSet rs = pst.executeQuery();
if(rs.next()){
String passwordd = rs.getString("password");
if(pass.equals(passwordd))
{
Check check = new Check();
check.setVisible(true);
}
else
{
JOptionPane.showMessageDialog(null,"Invalid Username or Password","Error",JOptionPane.ERROR_MESSAGE);
}
// JOptionPane.showMessageDialog(null, "Successfully Login!");
// CSCTables myobj = new CSCTables();
// myobj.setVisible(true);
//// dispose();
}
else{
JOptionPane.showMessageDialog(null, "Invalid Username or Password","Error",JOptionPane.ERROR_MESSAGE);
username.setText("");
password.setText("");
}
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
}//GEN-LAST:event_jButtonLoginActionPerformed
private void usernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usernameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_usernameActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
System.exit(0);
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoginForm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel StudInfo;
private java.awt.Button button1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButtonLogin;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPasswordField password;
private javax.swing.JTextField username;
// End of variables declaration//GEN-END:variables
}
| 14,120 | 0.63549 | 0.605514 | 321 | 43.065422 | 33.951019 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.88785 | false | false | 12 |
4131484fa05c2881cfb758c919ab53e7ea0af37c | 21,019,569,966,029 | 53472591a78ba9bb763ba7e6a82fe632ff20690f | /src/main/java/com/hannaford/elogex/actions/InvoiceListAction.java | f83faf3618254086151e2fa8706a29d793d7585e | [] | no_license | mohitdhingra01/elogex_1 | https://github.com/mohitdhingra01/elogex_1 | a27162d1a6c18b252b162191b6cdf564f4fd3292 | 511cb1169ee0d8b396300056857a597ea06b88bb | refs/heads/master | 2020-11-29T21:47:12.413000 | 2019-12-26T08:06:13 | 2019-12-26T08:06:13 | 230,222,255 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.hannaford.elogex.actions;
import java.util.Hashtable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import com.hannaford.elogex.constants.Constants;
import com.hannaford.elogex.dao.ElogexDAO;
import com.hannaford.elogex.entity.DocumentBean;
import com.hannaford.elogex.entity.ElogexSessionBean;
import com.hannaford.elogex.entity.InvoiceListBean;
import com.hannaford.elogex.entity.PagingBean;
import com.hannaford.elogex.exception.BusinessLogicException;
import com.hannaford.elogex.exception.CriticalException;
import com.hannaford.elogex.forms.ElogexFormBean;
/******************************************************************************
*<p><strong>Title: </strong>InvoiceListAction</p>
*<p><strong>Description: </strong>This class is used to get the Invoice list
* for the filter criteria entered by the user in
* Main page.</p>
*
*
*@author Infosys
*@version 1.00
*
*<pre><p><strong>Modification Log:</strong></p>
*
*<p>Version Date Author Description</p>
*<p>1.00 03/09/2003 Infosys Original Version</p></pre>
******************************************************************************/
public class InvoiceListAction extends ElogexBaseAction {
/**
* This method is used to obtain the Invoice List according to the filter
* criteria entered by the user on the Main page.
*
* @param ActionMapping
* @param ActionForm
* @param HttpServletRequest
* @param HttpServletResponse
* @param ActionMessages
* @exception CriticalException
* @exception Exception
* @return String
*/
public String executeLogic(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
ActionMessages objActionMessages)
throws CriticalException, Exception {
HttpSession session = request.getSession();
String strNextPage = Constants.SUCCESS;
String strFromWhere = mapping.getParameter();
//In the case where the Hold/Release button was pressed, isTokenValid(request) was
//false, so it was returning SUCCESS. In this particular case, we were going from
//a jsp to an action to this action.
/*if (strFromWhere.equals(Constants.VIVIEW_INVC_MAIN_JSP)) {
if (!(isTokenValid(request))){
return Constants.SUCCESS;
}
}
*/
ElogexSessionBean objElogexSessionBean =
(ElogexSessionBean) session.getAttribute(Constants.ELOGEX_SESSION);
DocumentBean objDocumentBean = new DocumentBean();
// Obtaining objDocumentBean from the session bean if it is
// already populated
if (!(objElogexSessionBean.getObjDocumentBean() == null)) {
objDocumentBean = objElogexSessionBean.getObjDocumentBean();
}
// strFromWhere is assigned the value from where the action is invoked
//String strFromWhere = mapping.getInput();
ElogexFormBean objElogexFormBean = (ElogexFormBean) form;
InvoiceListBean objInvoiceListBean = new InvoiceListBean();
Hashtable htbSearchCriteria = new Hashtable();
String[] strArrInvoiceHoldRelease = new String[1];
boolean bOtherThanMain = false;
//checking for where the action is being invoked from
//If the action is invoked from VIview_invc_main.jsp
if (strFromWhere.equals(Constants.VIVIEW_INVC_MAIN_JSP)) {
/* call for function extractForm that extracts the
* information from the form and adds them to hashtable
* to return the search criteria.
*/
htbSearchCriteria = extractForm(form, objDocumentBean);
objElogexSessionBean.setHtbSearchCritirea(htbSearchCriteria);
//reset page to null to view from beginning since coming in from main page
objElogexSessionBean.setObjPagingData(null);
}else{
bOtherThanMain = true;
}
htbSearchCriteria = objElogexSessionBean.getHtbSearchCritirea();
try {
//Invoke the DAO to search the details from the table
//based on the search criteria obtained from the main page
PagingBean objPageKey = objElogexSessionBean.getObjPagingData();
if (objPageKey == null){
objPageKey = new PagingBean();
}
objPageKey.setStrNavigateTo(Constants.CURRENT);
objElogexSessionBean.setObjPagingData(objPageKey);
System.out.println("----------------######################################################################################");
strNextPage =
ElogexDAO.currentInvoice(htbSearchCriteria, objInvoiceListBean,objPageKey);
//if not coming in from main page, check to see if there is a previous page
//since returning to listing. Note: Invoking currentInvoice above will check for
//next page and set appropriate result set. checkPrev() does not set objInvoiceListBean.
if (bOtherThanMain){
objPageKey.setStrNavigateTo(Constants.PREVIOUS);
ElogexDAO.checkPrev(htbSearchCriteria,objPageKey);
objPageKey.setStrNavigateTo(Constants.CURRENT);
}
} catch (BusinessLogicException objEx) {
objActionMessages.add(
Constants.ERROR_MESSAGE,
new ActionMessage(objEx.getMessage()));
strNextPage = Constants.FAILURE;
}
objElogexSessionBean.setObjDocumentBean(objDocumentBean);
objElogexFormBean.setStrArrInvoiceHoldRelease(strArrInvoiceHoldRelease);
//contains vecResults, i.e. vecINVLInvoiceBeanList
objElogexSessionBean.setObjInvoiceListBean(objInvoiceListBean);
session.setAttribute(Constants.ELOGEX_SESSION, objElogexSessionBean);
//save token such that on next entry it can be validated
saveToken(request);
// Forward control to the specified success URI
return strNextPage;
}
/**
*
* This method extracts the information from the form and
* adds them to hashtable to return the search criteria.
*
* @param ActionForm
* @param DocumentBean
* @return (Hashtable) htbSearchCriteria
*
*/
@SuppressWarnings("unchecked")
public static Hashtable extractForm(
ActionForm form,
DocumentBean objDocumentBean) {
ElogexFormBean objElogexFormBean = (ElogexFormBean) form;
String strFilterPOId = " ";
String strFilterCarrId = " ";
String strFilterSelection = " ";
String strFilterShipmentId = " ";
Hashtable htbSearchCriteria = new Hashtable();
strFilterPOId = objElogexFormBean.getStrFilterPOId() != null ? (objElogexFormBean.getStrFilterPOId()).trim() : "";
strFilterCarrId = objElogexFormBean.getStrFilterCarrId() != null ? (objElogexFormBean.getStrFilterCarrId()).trim() : "";
strFilterSelection = objElogexFormBean.getStrFilterSelection() != null ? (objElogexFormBean.getStrFilterSelection()).trim() : "";
strFilterShipmentId = objElogexFormBean.getStrFilterShipmentId() != null ? (objElogexFormBean.getStrFilterShipmentId()).trim() : "";
objDocumentBean.setStrFilterSelection(strFilterSelection);
htbSearchCriteria.put(Constants.PO_ID, strFilterPOId);
htbSearchCriteria.put(Constants.CARR_ID, strFilterCarrId);
htbSearchCriteria.put(Constants.SELECTED_OPTION, strFilterSelection);
htbSearchCriteria.put(Constants.SHIPMENT_ID, strFilterShipmentId);
return htbSearchCriteria;
}
} | UTF-8 | Java | 7,287 | java | InvoiceListAction.java | Java | [
{
"context": " Main page.</p>\n *\n *\n *@author Infosys\n *@version 1.00\n *\n *<pre><p><strong>Modification",
"end": 1204,
"score": 0.9992997050285339,
"start": 1197,
"tag": "USERNAME",
"value": "Infosys"
}
] | null | [] | package com.hannaford.elogex.actions;
import java.util.Hashtable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import com.hannaford.elogex.constants.Constants;
import com.hannaford.elogex.dao.ElogexDAO;
import com.hannaford.elogex.entity.DocumentBean;
import com.hannaford.elogex.entity.ElogexSessionBean;
import com.hannaford.elogex.entity.InvoiceListBean;
import com.hannaford.elogex.entity.PagingBean;
import com.hannaford.elogex.exception.BusinessLogicException;
import com.hannaford.elogex.exception.CriticalException;
import com.hannaford.elogex.forms.ElogexFormBean;
/******************************************************************************
*<p><strong>Title: </strong>InvoiceListAction</p>
*<p><strong>Description: </strong>This class is used to get the Invoice list
* for the filter criteria entered by the user in
* Main page.</p>
*
*
*@author Infosys
*@version 1.00
*
*<pre><p><strong>Modification Log:</strong></p>
*
*<p>Version Date Author Description</p>
*<p>1.00 03/09/2003 Infosys Original Version</p></pre>
******************************************************************************/
public class InvoiceListAction extends ElogexBaseAction {
/**
* This method is used to obtain the Invoice List according to the filter
* criteria entered by the user on the Main page.
*
* @param ActionMapping
* @param ActionForm
* @param HttpServletRequest
* @param HttpServletResponse
* @param ActionMessages
* @exception CriticalException
* @exception Exception
* @return String
*/
public String executeLogic(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
ActionMessages objActionMessages)
throws CriticalException, Exception {
HttpSession session = request.getSession();
String strNextPage = Constants.SUCCESS;
String strFromWhere = mapping.getParameter();
//In the case where the Hold/Release button was pressed, isTokenValid(request) was
//false, so it was returning SUCCESS. In this particular case, we were going from
//a jsp to an action to this action.
/*if (strFromWhere.equals(Constants.VIVIEW_INVC_MAIN_JSP)) {
if (!(isTokenValid(request))){
return Constants.SUCCESS;
}
}
*/
ElogexSessionBean objElogexSessionBean =
(ElogexSessionBean) session.getAttribute(Constants.ELOGEX_SESSION);
DocumentBean objDocumentBean = new DocumentBean();
// Obtaining objDocumentBean from the session bean if it is
// already populated
if (!(objElogexSessionBean.getObjDocumentBean() == null)) {
objDocumentBean = objElogexSessionBean.getObjDocumentBean();
}
// strFromWhere is assigned the value from where the action is invoked
//String strFromWhere = mapping.getInput();
ElogexFormBean objElogexFormBean = (ElogexFormBean) form;
InvoiceListBean objInvoiceListBean = new InvoiceListBean();
Hashtable htbSearchCriteria = new Hashtable();
String[] strArrInvoiceHoldRelease = new String[1];
boolean bOtherThanMain = false;
//checking for where the action is being invoked from
//If the action is invoked from VIview_invc_main.jsp
if (strFromWhere.equals(Constants.VIVIEW_INVC_MAIN_JSP)) {
/* call for function extractForm that extracts the
* information from the form and adds them to hashtable
* to return the search criteria.
*/
htbSearchCriteria = extractForm(form, objDocumentBean);
objElogexSessionBean.setHtbSearchCritirea(htbSearchCriteria);
//reset page to null to view from beginning since coming in from main page
objElogexSessionBean.setObjPagingData(null);
}else{
bOtherThanMain = true;
}
htbSearchCriteria = objElogexSessionBean.getHtbSearchCritirea();
try {
//Invoke the DAO to search the details from the table
//based on the search criteria obtained from the main page
PagingBean objPageKey = objElogexSessionBean.getObjPagingData();
if (objPageKey == null){
objPageKey = new PagingBean();
}
objPageKey.setStrNavigateTo(Constants.CURRENT);
objElogexSessionBean.setObjPagingData(objPageKey);
System.out.println("----------------######################################################################################");
strNextPage =
ElogexDAO.currentInvoice(htbSearchCriteria, objInvoiceListBean,objPageKey);
//if not coming in from main page, check to see if there is a previous page
//since returning to listing. Note: Invoking currentInvoice above will check for
//next page and set appropriate result set. checkPrev() does not set objInvoiceListBean.
if (bOtherThanMain){
objPageKey.setStrNavigateTo(Constants.PREVIOUS);
ElogexDAO.checkPrev(htbSearchCriteria,objPageKey);
objPageKey.setStrNavigateTo(Constants.CURRENT);
}
} catch (BusinessLogicException objEx) {
objActionMessages.add(
Constants.ERROR_MESSAGE,
new ActionMessage(objEx.getMessage()));
strNextPage = Constants.FAILURE;
}
objElogexSessionBean.setObjDocumentBean(objDocumentBean);
objElogexFormBean.setStrArrInvoiceHoldRelease(strArrInvoiceHoldRelease);
//contains vecResults, i.e. vecINVLInvoiceBeanList
objElogexSessionBean.setObjInvoiceListBean(objInvoiceListBean);
session.setAttribute(Constants.ELOGEX_SESSION, objElogexSessionBean);
//save token such that on next entry it can be validated
saveToken(request);
// Forward control to the specified success URI
return strNextPage;
}
/**
*
* This method extracts the information from the form and
* adds them to hashtable to return the search criteria.
*
* @param ActionForm
* @param DocumentBean
* @return (Hashtable) htbSearchCriteria
*
*/
@SuppressWarnings("unchecked")
public static Hashtable extractForm(
ActionForm form,
DocumentBean objDocumentBean) {
ElogexFormBean objElogexFormBean = (ElogexFormBean) form;
String strFilterPOId = " ";
String strFilterCarrId = " ";
String strFilterSelection = " ";
String strFilterShipmentId = " ";
Hashtable htbSearchCriteria = new Hashtable();
strFilterPOId = objElogexFormBean.getStrFilterPOId() != null ? (objElogexFormBean.getStrFilterPOId()).trim() : "";
strFilterCarrId = objElogexFormBean.getStrFilterCarrId() != null ? (objElogexFormBean.getStrFilterCarrId()).trim() : "";
strFilterSelection = objElogexFormBean.getStrFilterSelection() != null ? (objElogexFormBean.getStrFilterSelection()).trim() : "";
strFilterShipmentId = objElogexFormBean.getStrFilterShipmentId() != null ? (objElogexFormBean.getStrFilterShipmentId()).trim() : "";
objDocumentBean.setStrFilterSelection(strFilterSelection);
htbSearchCriteria.put(Constants.PO_ID, strFilterPOId);
htbSearchCriteria.put(Constants.CARR_ID, strFilterCarrId);
htbSearchCriteria.put(Constants.SELECTED_OPTION, strFilterSelection);
htbSearchCriteria.put(Constants.SHIPMENT_ID, strFilterShipmentId);
return htbSearchCriteria;
}
} | 7,287 | 0.723755 | 0.721696 | 200 | 35.439999 | 29.268351 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.945 | false | false | 12 |
fa51abc8f718485d4b32d86425fae89c725f7b1a | 12,146,167,538,099 | d3c8168d90567d85167024f6fdc1bdbabc7eaa19 | /core/src/com/evansitzes/game/environment/EnhancedTile.java | e081659a61b5f12c219e4ab4a1be2c00f19af1c5 | [] | no_license | Sitzilla/citybuilder-game | https://github.com/Sitzilla/citybuilder-game | 54b275d2512052518ad5ec6ea6bc2bfbe34ef397 | bf0fabbfabeb2aa6cd06a460f9eb0a123720beb2 | refs/heads/master | 2021-01-12T08:13:49.620000 | 2017-02-18T21:41:10 | 2017-02-18T21:41:10 | 76,515,108 | 0 | 0 | null | false | 2017-01-10T19:41:57 | 2016-12-15T02:12:43 | 2016-12-15T02:16:38 | 2017-01-10T19:41:57 | 2,075 | 0 | 0 | 0 | Java | null | null | package com.evansitzes.game.environment;
import com.evansitzes.game.buildings.Building;
import com.evansitzes.game.state.Tile;
/**
* Same as the Tile class but with additional member variables
*/
public class EnhancedTile extends Tile {
private Building building;
private boolean hasBeenChecked;
public EnhancedTile(final Tile tile) {
this.setX(tile.getX());
this.setY(tile.getY());
this.setOccupied(tile.isOccupied());
}
public EnhancedTile(int x, int y) {
super(x, y);
}
public Building getBuilding() {
return building;
}
public void setBuilding(final Building building) {
this.building = building;
}
public boolean isHasBeenChecked() {
return hasBeenChecked;
}
public void setHasBeenChecked(boolean hasBeenChecked) {
this.hasBeenChecked = hasBeenChecked;
}
}
| UTF-8 | Java | 892 | java | EnhancedTile.java | Java | [] | null | [] | package com.evansitzes.game.environment;
import com.evansitzes.game.buildings.Building;
import com.evansitzes.game.state.Tile;
/**
* Same as the Tile class but with additional member variables
*/
public class EnhancedTile extends Tile {
private Building building;
private boolean hasBeenChecked;
public EnhancedTile(final Tile tile) {
this.setX(tile.getX());
this.setY(tile.getY());
this.setOccupied(tile.isOccupied());
}
public EnhancedTile(int x, int y) {
super(x, y);
}
public Building getBuilding() {
return building;
}
public void setBuilding(final Building building) {
this.building = building;
}
public boolean isHasBeenChecked() {
return hasBeenChecked;
}
public void setHasBeenChecked(boolean hasBeenChecked) {
this.hasBeenChecked = hasBeenChecked;
}
}
| 892 | 0.669282 | 0.669282 | 38 | 22.473684 | 19.855713 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.394737 | false | false | 12 |
59669399fc5756d643c4d081e1dd8dc901bc28a6 | 24,266,565,223,069 | ec24830266729c724ab717fbdaf907dfa4f3f881 | /src/algs/dfs/Graph.java | 1fac6e59ca142dc174fe57df80ff719472970090 | [] | no_license | luoxunhao/what_a_fucking_day12 | https://github.com/luoxunhao/what_a_fucking_day12 | 39b7e50f2e3e618f3dc07518ea8daddc4ac80ca3 | 146e76258d59ed1be334cbc0f93246a529b0c37a | refs/heads/master | 2021-01-23T04:34:18.386000 | 2017-06-19T07:39:17 | 2017-06-19T07:39:17 | 86,212,004 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package algs.dfs;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
/**
* Created by lxh on 2017/3/18.
*/
public class Graph {
private static int number = 9;
private static boolean[] visited;
private static String[] vertexs = { "A", "B", "C", "D", "E", "F", "G", "H", "I" };
private static int[][] edges = {
{ 0, 1, 0, 0, 0, 1, 1, 0, 0 },
{ 1, 0, 1, 0, 0, 0, 1, 0, 1 },
{ 0, 1, 0, 1, 0, 0, 0, 0, 1 },
{ 0, 0, 1, 0, 1, 0, 1, 1, 1 },
{ 0, 0, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 0, 0, 1, 0, 1, 0, 0 },
{ 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 0, 0, 0, 1, 1, 0, 1, 0, 0 },
{ 0, 1, 1, 1, 0, 0, 0, 0, 0 }
};
/**
* DFS递归版本
*/
public static void DFSTraverse(){
visited = new boolean[number]; //初始化所有顶点状态为未访问
for (int i = 0; i < number; i++){
if (!visited[i]){ // 当前顶点没有被访问
DFS(i);
}
}
}
/**
* DFS核心
* 思想就是树的前序遍历
* @param i 第i个顶点
*/
public static void DFS(int i){
visited[i] = true; // 第i个顶点被访问
System.out.print(vertexs[i] + " ");
for (int j = 0; j < number; j++){
if (!visited[j] && edges[i][j] == 1){ //第j个顶点没有被访问并且与i邻接
DFS(j); //递归访问第j个顶点
}
}
}
/**
* DFS非递归版本
* 利用栈来实现树的前序遍历
*/
public static void DFSMap(){
visited = new boolean[number];
Stack<Integer> stack = new Stack<>();
for (int i = 0; i < number; i++){
if (!visited[i]){
visited[i] = true;
System.out.print(vertexs[i] + " ");
stack.push(i);
}
while (!stack.isEmpty()){
int k = stack.pop();
for (int j = 0; j < number; j++){
if (!visited[j] && edges[k][j] == 1){
visited[j] = true;
System.out.print(vertexs[j] + " ");
stack.push(j);
break;
}
}
}
}
}
/**
* BFS核心
* 思想就是树的层序遍历
* 区别:广度优先看起来和深度优先很相似,但是深度优先搜索是遇到一个满足条件的邻边元素就将其入栈,接着去判断该邻边元素的上下左右。
* 而广度优先搜索是判断完某元素的上下左右四个元素并入队列以后才进行下一轮判断的。
* 广度优先搜索就像波纹一样,以入口元素为中心,逐层搜索路径长度为1、为2、为3...的所有元素,从而最先出来的路径就是最短路径。
*/
public static void BFSMap(){
visited = new boolean[number];
Queue<Integer> queue = new LinkedList<>();
for (int i = 0; i < number; i++){
if (!visited[i]){
visited[i] = true;
System.out.print(vertexs[i] + " ");
queue.offer(i);
}
while (!queue.isEmpty()){
int k = queue.poll();
for (int j = 0; j < number; j++){
if (!visited[j] && edges[k][j] == 1){
visited[j] = true;
System.out.print(vertexs[j] + " ");
queue.offer(j); //所有邻接顶点都要入列
}
}
}
}
}
public static void main(String[] args){
DFSTraverse();
System.out.println();
DFSMap();
System.out.println();
BFSMap();
}
}
| UTF-8 | Java | 3,863 | java | Graph.java | Java | [
{
"context": ".Queue;\nimport java.util.Stack;\n\n/**\n * Created by lxh on 2017/3/18.\n */\npublic class Graph {\n privat",
"end": 118,
"score": 0.9995418190956116,
"start": 115,
"tag": "USERNAME",
"value": "lxh"
}
] | null | [] | package algs.dfs;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
/**
* Created by lxh on 2017/3/18.
*/
public class Graph {
private static int number = 9;
private static boolean[] visited;
private static String[] vertexs = { "A", "B", "C", "D", "E", "F", "G", "H", "I" };
private static int[][] edges = {
{ 0, 1, 0, 0, 0, 1, 1, 0, 0 },
{ 1, 0, 1, 0, 0, 0, 1, 0, 1 },
{ 0, 1, 0, 1, 0, 0, 0, 0, 1 },
{ 0, 0, 1, 0, 1, 0, 1, 1, 1 },
{ 0, 0, 0, 1, 0, 1, 0, 1, 0 },
{ 1, 0, 0, 0, 1, 0, 1, 0, 0 },
{ 0, 1, 0, 1, 0, 1, 0, 1, 0 },
{ 0, 0, 0, 1, 1, 0, 1, 0, 0 },
{ 0, 1, 1, 1, 0, 0, 0, 0, 0 }
};
/**
* DFS递归版本
*/
public static void DFSTraverse(){
visited = new boolean[number]; //初始化所有顶点状态为未访问
for (int i = 0; i < number; i++){
if (!visited[i]){ // 当前顶点没有被访问
DFS(i);
}
}
}
/**
* DFS核心
* 思想就是树的前序遍历
* @param i 第i个顶点
*/
public static void DFS(int i){
visited[i] = true; // 第i个顶点被访问
System.out.print(vertexs[i] + " ");
for (int j = 0; j < number; j++){
if (!visited[j] && edges[i][j] == 1){ //第j个顶点没有被访问并且与i邻接
DFS(j); //递归访问第j个顶点
}
}
}
/**
* DFS非递归版本
* 利用栈来实现树的前序遍历
*/
public static void DFSMap(){
visited = new boolean[number];
Stack<Integer> stack = new Stack<>();
for (int i = 0; i < number; i++){
if (!visited[i]){
visited[i] = true;
System.out.print(vertexs[i] + " ");
stack.push(i);
}
while (!stack.isEmpty()){
int k = stack.pop();
for (int j = 0; j < number; j++){
if (!visited[j] && edges[k][j] == 1){
visited[j] = true;
System.out.print(vertexs[j] + " ");
stack.push(j);
break;
}
}
}
}
}
/**
* BFS核心
* 思想就是树的层序遍历
* 区别:广度优先看起来和深度优先很相似,但是深度优先搜索是遇到一个满足条件的邻边元素就将其入栈,接着去判断该邻边元素的上下左右。
* 而广度优先搜索是判断完某元素的上下左右四个元素并入队列以后才进行下一轮判断的。
* 广度优先搜索就像波纹一样,以入口元素为中心,逐层搜索路径长度为1、为2、为3...的所有元素,从而最先出来的路径就是最短路径。
*/
public static void BFSMap(){
visited = new boolean[number];
Queue<Integer> queue = new LinkedList<>();
for (int i = 0; i < number; i++){
if (!visited[i]){
visited[i] = true;
System.out.print(vertexs[i] + " ");
queue.offer(i);
}
while (!queue.isEmpty()){
int k = queue.poll();
for (int j = 0; j < number; j++){
if (!visited[j] && edges[k][j] == 1){
visited[j] = true;
System.out.print(vertexs[j] + " ");
queue.offer(j); //所有邻接顶点都要入列
}
}
}
}
}
public static void main(String[] args){
DFSTraverse();
System.out.println();
DFSMap();
System.out.println();
BFSMap();
}
}
| 3,863 | 0.406316 | 0.37594 | 116 | 27.663794 | 18.582502 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.181034 | false | false | 12 |
123a071a2b7d1f81ec761b66045fa4b46e677a62 | 3,753,801,440,673 | 4df6d98e8fb4725d1efc31c4d3532a10995b6738 | /aid/core/src/main/java/com/luckypeng/interview/core/model/Content.java | ca3687a4b4ce0423f6cb18da53fd2f0716007829 | [] | no_license | coalchan/interview-aid | https://github.com/coalchan/interview-aid | 32ffd7a9a4ac50254e9bcebacdd8c5f4c6d806cc | 75d9faadfe1a610baa495904b44f639fcbedd8de | refs/heads/master | 2022-06-30T20:50:12.911000 | 2019-05-31T15:28:58 | 2019-05-31T15:28:58 | 189,357,938 | 0 | 0 | null | false | 2022-05-20T20:58:39 | 2019-05-30T06:25:21 | 2019-05-31T15:29:18 | 2022-05-20T20:58:38 | 96 | 0 | 0 | 2 | Java | false | false | package com.luckypeng.interview.core.model;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author coalchan
* @since 1.0
*/
@Data
@NoArgsConstructor
public class Content {
public static final String FILE_KEY_TITLE = "title";
public static final String FILE_KEY_DESC = "desc";
public static final String FILE_KEY_TAGS = "tags";
/**
* 内容类型
*/
private ContentType type;
/**
* 序号
*/
private String id;
/**
* 路径,唯一标识
*/
private String path;
/**
* 标题
*/
private String title;
/**
* 介绍
*/
private String desc;
/**
* 标签
*/
private List<String> tags;
/**
* 原文
*/
private String rawText;
/**
* 答案
*/
private String solution;
/**
* 下级
*/
private Map<String, Content> children = new HashMap<>(16);
public Content(ContentType type, String id, String path, String title) {
this.type = type;
this.id = id;
this.path = path;
this.title = title;
}
public String prettyTitle() {
return path + "\n" + title;
}
public String pretty() {
return path + "\n" + title + "\n\n答案:\n" + solution + "\n";
}
}
| UTF-8 | Java | 1,383 | java | Content.java | Java | [
{
"context": "a.util.List;\nimport java.util.Map;\n\n/**\n * @author coalchan\n * @since 1.0\n */\n@Data\n@NoArgsConstructor\npublic",
"end": 194,
"score": 0.9996725916862488,
"start": 186,
"tag": "USERNAME",
"value": "coalchan"
}
] | null | [] | package com.luckypeng.interview.core.model;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author coalchan
* @since 1.0
*/
@Data
@NoArgsConstructor
public class Content {
public static final String FILE_KEY_TITLE = "title";
public static final String FILE_KEY_DESC = "desc";
public static final String FILE_KEY_TAGS = "tags";
/**
* 内容类型
*/
private ContentType type;
/**
* 序号
*/
private String id;
/**
* 路径,唯一标识
*/
private String path;
/**
* 标题
*/
private String title;
/**
* 介绍
*/
private String desc;
/**
* 标签
*/
private List<String> tags;
/**
* 原文
*/
private String rawText;
/**
* 答案
*/
private String solution;
/**
* 下级
*/
private Map<String, Content> children = new HashMap<>(16);
public Content(ContentType type, String id, String path, String title) {
this.type = type;
this.id = id;
this.path = path;
this.title = title;
}
public String prettyTitle() {
return path + "\n" + title;
}
public String pretty() {
return path + "\n" + title + "\n\n答案:\n" + solution + "\n";
}
}
| 1,383 | 0.544084 | 0.54107 | 80 | 15.5875 | 16.837231 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false | 12 |
ec782e7429c91e6653d88ba20f044d74fd12a1e8 | 3,753,801,444,692 | d8a001d85f6547cd307f5320dac9c69f8a3aef9e | /horse/src/com/sltunion/cloudy/service/ChannelService.java | 75cdca61adef5ae942519dd52415cd4a5b5f21aa | [] | no_license | lg-norron/Loki | https://github.com/lg-norron/Loki | a3db6a4d1509102b38d04ceb2727f0a99e4bcc93 | 01a08dfc259362ec526e7fb532392de81c1baf29 | refs/heads/master | 2020-04-07T20:31:12.883000 | 2014-08-11T01:10:25 | 2014-08-11T01:10:25 | 22,780,640 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sltunion.cloudy.service;
import java.util.List;
import com.sltunion.cloudy.persistent.model.TChannel;
public interface ChannelService{
List<TChannel> findAll();
}
| UTF-8 | Java | 179 | java | ChannelService.java | Java | [] | null | [] | package com.sltunion.cloudy.service;
import java.util.List;
import com.sltunion.cloudy.persistent.model.TChannel;
public interface ChannelService{
List<TChannel> findAll();
}
| 179 | 0.798883 | 0.798883 | 9 | 18.888889 | 18.495913 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 12 |
2fcb7d26be17594391596a56141622d63f5e316a | 8,675,833,958,164 | 9f333e631f0079306e0dbd3f5574b28e9aefe20f | /src/android/lk/pluspro/cordova/plugins/Payhere.java | 6b9f67933db358dd0ae5298fcfb47774e8d0239e | [] | no_license | shandanjay/cordova-client-plugin-for-payhere.lk | https://github.com/shandanjay/cordova-client-plugin-for-payhere.lk | 7125ecc465863200d44b0c6a9b2665c3d57d560a | c8dea9ce96865ea12d2531c4f707e8546e3addfd | refs/heads/master | 2021-04-26T22:55:48.369000 | 2020-05-24T08:03:44 | 2020-05-24T08:03:44 | 123,898,133 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package lk.pluspro.cordova.plugins;
import org.apache.cordova.CordovaPlugin;
import com.google.gson.JsonObject;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Intent;
import org.apache.cordova.LOG;
/**
* Payhere imports.
*/
import lk.payhere.androidsdk.*;
import lk.payhere.androidsdk.model.*;
import lk.payhere.androidsdk.util.*;
public class Payhere extends CordovaPlugin {
private final static int PAYHERE_REQUEST = 111010;
protected CallbackContext callbackContext;
private static final String TAG = "PAYHERE_PLUGIN";
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("checkout")) {
String message = args.getString(0);
this.checkout(message, callbackContext);
return true;
}
return false;
}
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
}
private void checkout(String message, CallbackContext callbackContext) {
// if (message != null && message.length() > 0) {
// callbackContext.success(message);
// } else {
// callbackContext.error("Expected one non-empty string argument.");
// }
LOG.d(TAG, message);
this.callbackContext = callbackContext;
InitRequest req = new InitRequest();
try {
JSONObject data = new JSONObject(message);
req.setMerchantId(data.getString("merchantId")); // Your Merchant ID
req.setMerchantSecret(data.getString("merchantSecret")); // Your Merchant secret
req.setAmount(data.getDouble("amount")); // Amount which the customer should pay
req.setCurrency(data.getString("currency")); // Currency
req.setOrderId(data.getString("orderId")); // Unique ID for your payment transaction
req.setItemsDescription(data.getString("itemsDescription")); // Item title or Order/Invoice number
req.setCustom1(data.getString("custom1"));
req.setCustom2(data.getString("custom2"));
req.getCustomer().setFirstName(data.getJSONObject("customer").getString("firstName"));
req.getCustomer().setLastName(data.getJSONObject("customer").getString("lastName"));
req.getCustomer().setEmail(data.getJSONObject("customer").getString("email"));
req.getCustomer().setPhone(data.getJSONObject("customer").getString("phone"));
req.getCustomer().getAddress().setAddress(data.getJSONObject("billing").getString("address"));
req.getCustomer().getAddress().setCity(data.getJSONObject("billing").getString("city"));
req.getCustomer().getAddress().setCountry(data.getJSONObject("billing").getString("country"));
req.getCustomer().getDeliveryAddress().setAddress(data.getJSONObject("shipping").getString("address"));
req.getCustomer().getDeliveryAddress().setCity(data.getJSONObject("shipping").getString("city"));
req.getCustomer().getDeliveryAddress().setCountry(data.getJSONObject("shipping").getString("country"));
req.getItems().add(new Item(null, "Door bell wireless", 1));
} catch (JSONException $je) {
callbackContext.error("Invalid data!");
}
Intent intent = new Intent(cordova.getActivity(), PHMainActivity.class);
intent.putExtra(PHConstants.INTENT_EXTRA_DATA, req);
PHConfigs.setBaseUrl(PHConfigs.SANDBOX_URL);
if (this.cordova != null) {
this.cordova.startActivityForResult((CordovaPlugin) this, intent, PAYHERE_REQUEST); //unique request ID like private final static int PAYHERE_REQUEST = 11010;
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//TODO process response
if (requestCode == PAYHERE_REQUEST && data != null && data.hasExtra(PHConstants.INTENT_EXTRA_RESULT)) {
PHResponse<StatusResponse> response = (PHResponse<StatusResponse>) data
.getSerializableExtra(PHConstants.INTENT_EXTRA_RESULT);
String msg;
if (response.isSuccess()) {
msg = "Activity result:" + response.getData().toString();
this.callbackContext.success(msg);
} else {
msg = "Result:" + response.toString();
this.callbackContext.success(msg);
}
LOG.d(TAG, msg);
//textView.setText(msg);
}
}
}
| UTF-8 | Java | 4,839 | java | Payhere.java | Java | [] | null | [] | package lk.pluspro.cordova.plugins;
import org.apache.cordova.CordovaPlugin;
import com.google.gson.JsonObject;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaInterface;
import org.apache.cordova.CordovaWebView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Intent;
import org.apache.cordova.LOG;
/**
* Payhere imports.
*/
import lk.payhere.androidsdk.*;
import lk.payhere.androidsdk.model.*;
import lk.payhere.androidsdk.util.*;
public class Payhere extends CordovaPlugin {
private final static int PAYHERE_REQUEST = 111010;
protected CallbackContext callbackContext;
private static final String TAG = "PAYHERE_PLUGIN";
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("checkout")) {
String message = args.getString(0);
this.checkout(message, callbackContext);
return true;
}
return false;
}
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
super.initialize(cordova, webView);
}
private void checkout(String message, CallbackContext callbackContext) {
// if (message != null && message.length() > 0) {
// callbackContext.success(message);
// } else {
// callbackContext.error("Expected one non-empty string argument.");
// }
LOG.d(TAG, message);
this.callbackContext = callbackContext;
InitRequest req = new InitRequest();
try {
JSONObject data = new JSONObject(message);
req.setMerchantId(data.getString("merchantId")); // Your Merchant ID
req.setMerchantSecret(data.getString("merchantSecret")); // Your Merchant secret
req.setAmount(data.getDouble("amount")); // Amount which the customer should pay
req.setCurrency(data.getString("currency")); // Currency
req.setOrderId(data.getString("orderId")); // Unique ID for your payment transaction
req.setItemsDescription(data.getString("itemsDescription")); // Item title or Order/Invoice number
req.setCustom1(data.getString("custom1"));
req.setCustom2(data.getString("custom2"));
req.getCustomer().setFirstName(data.getJSONObject("customer").getString("firstName"));
req.getCustomer().setLastName(data.getJSONObject("customer").getString("lastName"));
req.getCustomer().setEmail(data.getJSONObject("customer").getString("email"));
req.getCustomer().setPhone(data.getJSONObject("customer").getString("phone"));
req.getCustomer().getAddress().setAddress(data.getJSONObject("billing").getString("address"));
req.getCustomer().getAddress().setCity(data.getJSONObject("billing").getString("city"));
req.getCustomer().getAddress().setCountry(data.getJSONObject("billing").getString("country"));
req.getCustomer().getDeliveryAddress().setAddress(data.getJSONObject("shipping").getString("address"));
req.getCustomer().getDeliveryAddress().setCity(data.getJSONObject("shipping").getString("city"));
req.getCustomer().getDeliveryAddress().setCountry(data.getJSONObject("shipping").getString("country"));
req.getItems().add(new Item(null, "Door bell wireless", 1));
} catch (JSONException $je) {
callbackContext.error("Invalid data!");
}
Intent intent = new Intent(cordova.getActivity(), PHMainActivity.class);
intent.putExtra(PHConstants.INTENT_EXTRA_DATA, req);
PHConfigs.setBaseUrl(PHConfigs.SANDBOX_URL);
if (this.cordova != null) {
this.cordova.startActivityForResult((CordovaPlugin) this, intent, PAYHERE_REQUEST); //unique request ID like private final static int PAYHERE_REQUEST = 11010;
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//TODO process response
if (requestCode == PAYHERE_REQUEST && data != null && data.hasExtra(PHConstants.INTENT_EXTRA_RESULT)) {
PHResponse<StatusResponse> response = (PHResponse<StatusResponse>) data
.getSerializableExtra(PHConstants.INTENT_EXTRA_RESULT);
String msg;
if (response.isSuccess()) {
msg = "Activity result:" + response.getData().toString();
this.callbackContext.success(msg);
} else {
msg = "Result:" + response.toString();
this.callbackContext.success(msg);
}
LOG.d(TAG, msg);
//textView.setText(msg);
}
}
}
| 4,839 | 0.660054 | 0.656334 | 105 | 45.085712 | 36.338123 | 178 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.761905 | false | false | 12 |
d6f5630d8c9fa0e5a172301426ea840e158908f7 | 14,259,291,450,188 | 4ae6e10ffd746a0e817ce51ffb3deaec13c49313 | /src/main/java/com/webank/webase/node/mgr/alert/mail/server/config/entity/TbMailServerConfig.java | ae324519fe6c5770bf8049ba4d351e7a4c44bc06 | [
"Apache-2.0"
] | permissive | dwusiq/WeBASE-Node-Manager | https://github.com/dwusiq/WeBASE-Node-Manager | ded6c2f38faee2271fbfdc92d31245f87e9b0001 | 0f5fd234499fa436f13ed133e9dac09aca4f5ed6 | refs/heads/master | 2023-03-16T13:00:58.335000 | 2022-02-22T08:06:57 | 2022-02-22T08:06:57 | 216,986,856 | 1 | 0 | Apache-2.0 | true | 2019-10-23T06:44:41 | 2019-10-23T06:44:41 | 2019-10-10T08:49:49 | 2019-10-23T03:33:20 | 3,779 | 0 | 0 | 0 | null | false | false | /**
* Copyright 2014-2021 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.webank.webase.node.mgr.alert.mail.server.config.entity;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* entity for table tb_mail_server_config
* 存储mail server的配置内容,存在表中;
* 表为空时,读取yml中的配置内容;
* 非空时,不同的alertRule以指定不同的mail server
*/
@Data
@NoArgsConstructor
public class TbMailServerConfig {
/**
* primary key ID
*/
private Integer serverId;
private String serverName;
/**
* 邮箱服务器地址
*/
private String host;
private Integer port;
/**
* 邮箱服务器地址
*/
private String username;
/**
* 邮箱授权码
*/
private String password;
/**
* 邮箱协议:smtp, pop3, imap
*/
private String protocol;
/**
* 默认编码
*/
private String defaultEncoding;
private LocalDateTime createTime;
private LocalDateTime modifyTime;
/**
* 以下均为SMTP的properties安全配置项 与 默认值
* @param authentication 是否需要验证 默认true 0-off, 1-on
* @param starttlsEnable 支持STARTTLS时则启用 默认true 0-off, 1-on
* @param starttlsRequired 默认false, 开启则需要配置端口、SSL类等,需保证端口可用
* @param socketFactory.port 不同的邮箱服务器的TLS端口,发件邮箱465, 收件IMAP为993, POP3为995
* @param socketFactory.class 默认javax.net.ssl.SSLSocketFactory
* @param socketFactory.fallback 默认false 0-off, 1-on
*/
private Integer authentication;
private Integer starttlsEnable;
/**
* STARTTLS 具体配置
*/
private Integer starttlsRequired;
private Integer socketFactoryPort;
private String socketFactoryClass;
private Integer socketFactoryFallback;
/**
* 0-off, 1-on
* if edited and done, status is 1, else is 0
* if not done, cannot send mails
*/
private Integer enable;
/**
* time out config
* @timeout: read timeout, read from host;
* @connectionTimeout: connect to host timeout;
* @writeTimeout: write timeout
*/
private Integer timeout;
private Integer connectionTimeout;
private Integer writeTimeout;
}
| UTF-8 | Java | 2,925 | java | TbMailServerConfig.java | Java | [] | null | [] | /**
* Copyright 2014-2021 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.webank.webase.node.mgr.alert.mail.server.config.entity;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* entity for table tb_mail_server_config
* 存储mail server的配置内容,存在表中;
* 表为空时,读取yml中的配置内容;
* 非空时,不同的alertRule以指定不同的mail server
*/
@Data
@NoArgsConstructor
public class TbMailServerConfig {
/**
* primary key ID
*/
private Integer serverId;
private String serverName;
/**
* 邮箱服务器地址
*/
private String host;
private Integer port;
/**
* 邮箱服务器地址
*/
private String username;
/**
* 邮箱授权码
*/
private String password;
/**
* 邮箱协议:smtp, pop3, imap
*/
private String protocol;
/**
* 默认编码
*/
private String defaultEncoding;
private LocalDateTime createTime;
private LocalDateTime modifyTime;
/**
* 以下均为SMTP的properties安全配置项 与 默认值
* @param authentication 是否需要验证 默认true 0-off, 1-on
* @param starttlsEnable 支持STARTTLS时则启用 默认true 0-off, 1-on
* @param starttlsRequired 默认false, 开启则需要配置端口、SSL类等,需保证端口可用
* @param socketFactory.port 不同的邮箱服务器的TLS端口,发件邮箱465, 收件IMAP为993, POP3为995
* @param socketFactory.class 默认javax.net.ssl.SSLSocketFactory
* @param socketFactory.fallback 默认false 0-off, 1-on
*/
private Integer authentication;
private Integer starttlsEnable;
/**
* STARTTLS 具体配置
*/
private Integer starttlsRequired;
private Integer socketFactoryPort;
private String socketFactoryClass;
private Integer socketFactoryFallback;
/**
* 0-off, 1-on
* if edited and done, status is 1, else is 0
* if not done, cannot send mails
*/
private Integer enable;
/**
* time out config
* @timeout: read timeout, read from host;
* @connectionTimeout: connect to host timeout;
* @writeTimeout: write timeout
*/
private Integer timeout;
private Integer connectionTimeout;
private Integer writeTimeout;
}
| 2,925 | 0.681248 | 0.668695 | 100 | 25.290001 | 21.622347 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44 | false | false | 12 |
4c5cc88ce448196177ac83a0a1d9a79b42407175 | 25,065,429,169,225 | 92cdfd06f990585ceb824725fd98b57ae58df23e | /app/src/main/java/edu/byu/cs/imageeditor/studentCode/reorderPixels.java | debdb5c93fcdc6cf0b6932677d63750ddd46a5bc | [] | no_license | Audakel/image-edit | https://github.com/Audakel/image-edit | 1389bd4886a5ff76f3083a2e80cfb2888f2ed024 | 632640f14cb7ff935db8acd87397085a9b9819ae | refs/heads/master | 2021-01-20T16:28:50.751000 | 2016-06-12T23:36:57 | 2016-06-12T23:36:57 | 57,421,816 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.byu.cs.imageeditor.studentCode;
public class reorderPixels {
}
| UTF-8 | Java | 76 | java | reorderPixels.java | Java | [] | null | [] | package edu.byu.cs.imageeditor.studentCode;
public class reorderPixels {
}
| 76 | 0.802632 | 0.802632 | 4 | 18 | 18.289341 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 12 |
bb96d7cf8f88bef975f75ab25ca87a30c8eeff35 | 10,574,209,519,393 | bc656344748ee820d0ff80896e71a056305f5d7f | /src/com/cm55/depDetect/gui/cyclic/ToPkgsPanel.java | 0aed7227c5ba03b83fdeab761d1d68c575e97145 | [
"MIT"
] | permissive | ysugimura/depDetectGui | https://github.com/ysugimura/depDetectGui | 9d59059b1928068b0c034227404312fda72e1e3d | caf5e2b5b877b365b131b138c9484185c0cd6f1d | refs/heads/master | 2021-07-08T01:49:19.822000 | 2019-07-07T06:03:36 | 2019-07-07T06:03:36 | 141,020,125 | 0 | 1 | null | false | 2020-07-04T16:42:55 | 2018-07-15T11:00:46 | 2019-07-07T06:04:06 | 2019-07-07T06:04:05 | 142 | 0 | 1 | 1 | Java | false | false | package com.cm55.depDetect.gui.cyclic;
import com.cm55.depDetect.*;
import com.cm55.depDetect.gui.common.*;
import com.cm55.depDetect.gui.i18n.*;
import com.cm55.fx.*;
import com.google.inject.*;
/**
* 指定された循環依存パッケージ(From)についての全循環依存先パッケージ(Tos)を表示する
* いずれかが選択された場合には、toPkgNode選択イベントを発行する
* @author ysugimura
*/
public class ToPkgsPanel implements FxNode {
private FxTitledBorder titledBorder;
private PackagesPanel packagesPanel;
@Inject
public ToPkgsPanel(CyclicModel cyclicModel, Msg msg, PackagesPanel packagesPanel) {
cyclicModel.bus.listen(CyclicModel.FromPkgEvent.class, this::fromPkgSelection);
this.packagesPanel = packagesPanel;
packagesPanel.setSelectionCallback(node->cyclicModel.setToPkgNode(node));
titledBorder = new FxTitledBorder(msg.get(Msg.循環依存先パッケージ一覧), new FxJustBox(packagesPanel));
}
void fromPkgSelection(CyclicModel.FromPkgEvent e) {
if (e.isEmpty()) {
packagesPanel.clearRows();
return;
}
// このパッケージの全循環依存先パッケージを取得する
Refs cyclics = e.fromPkgNode.getCyclics(e.fromPkgPruned);
packagesPanel.setRows(cyclics.stream());
}
public javafx.scene.Node node() {
return titledBorder.node();
}
}
| UTF-8 | Java | 1,442 | java | ToPkgsPanel.java | Java | [
{
"context": " * いずれかが選択された場合には、toPkgNode選択イベントを発行する\r\n * @author ysugimura\r\n */\r\npublic class ToPkgsPanel implements FxNode ",
"end": 322,
"score": 0.9996639490127563,
"start": 313,
"tag": "USERNAME",
"value": "ysugimura"
}
] | null | [] | package com.cm55.depDetect.gui.cyclic;
import com.cm55.depDetect.*;
import com.cm55.depDetect.gui.common.*;
import com.cm55.depDetect.gui.i18n.*;
import com.cm55.fx.*;
import com.google.inject.*;
/**
* 指定された循環依存パッケージ(From)についての全循環依存先パッケージ(Tos)を表示する
* いずれかが選択された場合には、toPkgNode選択イベントを発行する
* @author ysugimura
*/
public class ToPkgsPanel implements FxNode {
private FxTitledBorder titledBorder;
private PackagesPanel packagesPanel;
@Inject
public ToPkgsPanel(CyclicModel cyclicModel, Msg msg, PackagesPanel packagesPanel) {
cyclicModel.bus.listen(CyclicModel.FromPkgEvent.class, this::fromPkgSelection);
this.packagesPanel = packagesPanel;
packagesPanel.setSelectionCallback(node->cyclicModel.setToPkgNode(node));
titledBorder = new FxTitledBorder(msg.get(Msg.循環依存先パッケージ一覧), new FxJustBox(packagesPanel));
}
void fromPkgSelection(CyclicModel.FromPkgEvent e) {
if (e.isEmpty()) {
packagesPanel.clearRows();
return;
}
// このパッケージの全循環依存先パッケージを取得する
Refs cyclics = e.fromPkgNode.getCyclics(e.fromPkgPruned);
packagesPanel.setRows(cyclics.stream());
}
public javafx.scene.Node node() {
return titledBorder.node();
}
}
| 1,442 | 0.714744 | 0.705128 | 41 | 28.439024 | 25.715183 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512195 | false | false | 12 |
5db6a6b90e82f6442cd6d545bf00c37eac750355 | 24,438,363,939,439 | 7ff06d884e49f963f3d8c8d50767f94a91e79ae4 | /src/main/java/com/demo/action/config/ExecutorConfig.java | 9f60d8ce56267a03498fd6f5cd3dd7a1b905a0ff | [] | no_license | jinglv/java-action | https://github.com/jinglv/java-action | 557eb48fbb9062fdff03071002780fffeb8ec3d9 | 4580a75782a5de53097f1700004146b3d318fe25 | refs/heads/main | 2023-03-23T10:27:22.535000 | 2021-03-04T09:37:15 | 2021-03-04T09:37:15 | 314,206,994 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.demo.action.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 线程池配置
*
* @author jingLv
* @date 2020/11/27
*/
@Slf4j
@Configuration
@EnableAsync
public class ExecutorConfig {
/**
* 导出服务线程池
*
* @return
*/
@Bean("exportServiceExecutor")
public Executor exportServiceExecutor() {
final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// 核心线程数量,:当前机器的核心数
executor.setCorePoolSize(Runtime.getRuntime().availableProcessors() * 2);
// 队列大小
executor.setQueueCapacity(Integer.MAX_VALUE);
// 设置线程池中线程名前缀
executor.setThreadNamePrefix("export--");
// 设置拒绝策略:直接拒绝
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
// 执行初始化
executor.initialize();
return executor;
}
}
| UTF-8 | Java | 1,297 | java | ExecutorConfig.java | Java | [
{
"context": "nt.ThreadPoolExecutor;\n\n/**\n * 线程池配置\n *\n * @author jingLv\n * @date 2020/11/27\n */\n@Slf4j\n@Configuration\n@En",
"end": 436,
"score": 0.99948650598526,
"start": 430,
"tag": "USERNAME",
"value": "jingLv"
}
] | null | [] | package com.demo.action.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 线程池配置
*
* @author jingLv
* @date 2020/11/27
*/
@Slf4j
@Configuration
@EnableAsync
public class ExecutorConfig {
/**
* 导出服务线程池
*
* @return
*/
@Bean("exportServiceExecutor")
public Executor exportServiceExecutor() {
final ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
// 核心线程数量,:当前机器的核心数
executor.setCorePoolSize(Runtime.getRuntime().availableProcessors() * 2);
// 队列大小
executor.setQueueCapacity(Integer.MAX_VALUE);
// 设置线程池中线程名前缀
executor.setThreadNamePrefix("export--");
// 设置拒绝策略:直接拒绝
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
// 执行初始化
executor.initialize();
return executor;
}
}
| 1,297 | 0.71162 | 0.701442 | 42 | 27.071428 | 23.846127 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 12 |
ce96ffedf142be37d070c2aaefe111633d5c03f3 | 15,075,335,241,311 | 6f16d76ac4361aec9ccd964beab666a440c84708 | /src/main/java/org/alan/asdk/common/_FailOrderSelector.java | 732cee8fa59b9c00a9111b3bae3ed7f43c569fac | [] | no_license | ymw520369/asdk | https://github.com/ymw520369/asdk | 9af6b4a6912e4f3b19f889fdbf8535c4cc0f4145 | 676fd301087b9af35ea4ca4fcf29a7ac1ad01ae7 | refs/heads/master | 2021-01-16T17:37:34.827000 | 2017-08-16T17:43:15 | 2017-08-16T17:43:15 | 100,009,527 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.alan.asdk.common;
import org.alan.asdk.entity.TFailOrderInfo;
import org.alan.asdk.entity.UOrder;
import org.alan.asdk.service._FailOrdeNoticeThread;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
/**
* 失败订单筛选器
*
* @author Lance Chow
* @create 2015-12-21 16:19
*/
public class _FailOrderSelector implements Runnable{
/**
* 最大订单失败数
*/
private static int failOrderCount = 100000;
private static _FailOrderSelector instance;
private Set<TFailOrderInfo> failOrders;
/**
* 通知线程
*/
private _FailOrdeNoticeThread noticeThread;
public void loadFailOrders(List<UOrder> orders , _FailOrdeNoticeThread thread){
//如果orders里面有内容则return;
if (noticeThread==null){
noticeThread = thread;
}
if (failOrders!=null&&!failOrders.isEmpty()){
return;
}
failOrders = new CopyOnWriteArraySet<>();
for (UOrder order : orders){
TFailOrderInfo info = new TFailOrderInfo();
info.setOrder(order);
info.setCount(1);
info.setNext(new Date().getTime());
failOrders.add(info);
}
}
public void addOrder(UOrder order){
int size = failOrders.size();
if (size == failOrderCount){
Log.i("错误订单超过最大限额:"+failOrderCount);
}
TFailOrderInfo orderInfo = new TFailOrderInfo();
/**
* 第一次是延时3分钟后执行
*/
orderInfo.setNext(new Date().getTime() + 3 * 60 * 1000);
orderInfo.setOrder(order);
orderInfo.setCount(1);
if(failOrders.contains(orderInfo))
failOrders.add(orderInfo);
}
public static _FailOrderSelector getInstance(){
if ( instance == null){
instance = new _FailOrderSelector();
}
return instance;
}
public void romeve(TFailOrderInfo info){
failOrders.remove(info);
}
private boolean isRun = true;
public void shutDown(){
isRun = false;
}
@Override
public void run() {
while (isRun){
Iterator<TFailOrderInfo> it = failOrders.iterator();
while (it.hasNext()){
TFailOrderInfo info = it.next();
//判断是否该删除
if(info.getCount()>7){
Log.i("侦测到重复订单["+info.getOrder().getOrderID()+"]已过期删除...");
failOrders.remove(info);
}
//判断是否到时间当前时间
long now = new Date().getTime();
if (info.getNext() < now && !info.isRuning()){
info.setRuning(true);
noticeThread.sendCallback(info);
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| UTF-8 | Java | 3,130 | java | _FailOrderSelector.java | Java | [
{
"context": "CopyOnWriteArraySet;\n\n/**\n * 失败订单筛选器\n *\n * @author Lance Chow\n * @create 2015-12-21 16:19\n */\npublic class _Fai",
"end": 348,
"score": 0.999771773815155,
"start": 338,
"tag": "NAME",
"value": "Lance Chow"
}
] | null | [] | package org.alan.asdk.common;
import org.alan.asdk.entity.TFailOrderInfo;
import org.alan.asdk.entity.UOrder;
import org.alan.asdk.service._FailOrdeNoticeThread;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
/**
* 失败订单筛选器
*
* @author <NAME>
* @create 2015-12-21 16:19
*/
public class _FailOrderSelector implements Runnable{
/**
* 最大订单失败数
*/
private static int failOrderCount = 100000;
private static _FailOrderSelector instance;
private Set<TFailOrderInfo> failOrders;
/**
* 通知线程
*/
private _FailOrdeNoticeThread noticeThread;
public void loadFailOrders(List<UOrder> orders , _FailOrdeNoticeThread thread){
//如果orders里面有内容则return;
if (noticeThread==null){
noticeThread = thread;
}
if (failOrders!=null&&!failOrders.isEmpty()){
return;
}
failOrders = new CopyOnWriteArraySet<>();
for (UOrder order : orders){
TFailOrderInfo info = new TFailOrderInfo();
info.setOrder(order);
info.setCount(1);
info.setNext(new Date().getTime());
failOrders.add(info);
}
}
public void addOrder(UOrder order){
int size = failOrders.size();
if (size == failOrderCount){
Log.i("错误订单超过最大限额:"+failOrderCount);
}
TFailOrderInfo orderInfo = new TFailOrderInfo();
/**
* 第一次是延时3分钟后执行
*/
orderInfo.setNext(new Date().getTime() + 3 * 60 * 1000);
orderInfo.setOrder(order);
orderInfo.setCount(1);
if(failOrders.contains(orderInfo))
failOrders.add(orderInfo);
}
public static _FailOrderSelector getInstance(){
if ( instance == null){
instance = new _FailOrderSelector();
}
return instance;
}
public void romeve(TFailOrderInfo info){
failOrders.remove(info);
}
private boolean isRun = true;
public void shutDown(){
isRun = false;
}
@Override
public void run() {
while (isRun){
Iterator<TFailOrderInfo> it = failOrders.iterator();
while (it.hasNext()){
TFailOrderInfo info = it.next();
//判断是否该删除
if(info.getCount()>7){
Log.i("侦测到重复订单["+info.getOrder().getOrderID()+"]已过期删除...");
failOrders.remove(info);
}
//判断是否到时间当前时间
long now = new Date().getTime();
if (info.getNext() < now && !info.isRuning()){
info.setRuning(true);
noticeThread.sendCallback(info);
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
| 3,126 | 0.554771 | 0.543683 | 113 | 25.336283 | 19.83231 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.389381 | false | false | 12 |
7669d460087b7959d26ef1fdab76d7558a6d0460 | 4,148,938,443,020 | 68daf3b43a74ddf56ea01f7ebc383e9022b16f47 | /rh-spring/src/main/java/br/eti/hmagalhaes/rh/model/service/ColaboradorServiceImpl.java | a849efa2d8c819f2a8f7a60fa49e3275a6f105e1 | [
"MIT"
] | permissive | kleopatra999/exemplo-rh | https://github.com/kleopatra999/exemplo-rh | 39121cb14e7aa052a3ca5fda548deea66fa3c009 | b7e4fe6f7eec60e8a0c6fc3b7a0b34500e192680 | refs/heads/master | 2021-01-18T00:39:04.085000 | 2014-03-09T00:37:38 | 2014-03-09T00:37:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.eti.hmagalhaes.rh.model.service;
import br.eti.hmagalhaes.rh.model.dto.ColaboradorFormDTO;
import br.eti.hmagalhaes.rh.model.entity.Colaborador;
import br.eti.hmagalhaes.rh.model.repository.ColaboradoresRepository;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.ConversionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
*
* @author Hudson P. Magalhães <hudson@hmagalhaes.eti.br>
* @since 28-Feb-2014
*/
@Service
public class ColaboradorServiceImpl implements ColaboradorService {
private ColaboradoresRepository colaboradorRepository;
private ConversionService conversionService;
@Transactional
@Override
public Colaborador atualizar(ColaboradorFormDTO form) {
return colaboradorRepository.atualizar(conversionService.
convert(form, Colaborador.class));
}
@Transactional
@Override
public Colaborador inserir(ColaboradorFormDTO form) {
return colaboradorRepository.inserir(conversionService.
convert(form, Colaborador.class));
}
@Transactional
@Override
public Collection<Colaborador> buscar() {
return colaboradorRepository.buscar();
}
@Transactional
@Override
public Colaborador buscar(Long id) {
return colaboradorRepository.buscar(id);
}
@Transactional
@Override
public Collection<Colaborador> buscarPorDepartamento(long id) {
return colaboradorRepository.buscarPorDepartamento(id);
}
@Transactional
@Override
public Colaborador inserir(Colaborador entity) {
return colaboradorRepository.inserir(entity);
}
@Transactional
@Override
public Colaborador atualizar(Colaborador entity) {
return colaboradorRepository.atualizar(entity);
}
@Transactional
@Override
public void remover(Long id) {
colaboradorRepository.remover(id);
}
@Autowired
public void setColaboradorRepository(ColaboradoresRepository colaboradorRepository) {
this.colaboradorRepository = colaboradorRepository;
}
@Autowired
public void setConversionService(ConversionService conversionService) {
this.conversionService = conversionService;
}
} | UTF-8 | Java | 2,170 | java | ColaboradorServiceImpl.java | Java | [
{
"context": "ction.annotation.Transactional;\n\n/**\n *\n * @author Hudson P. Magalhães <hudson@hmagalhaes.eti.br>\n * @since 28-Feb-2014\n",
"end": 528,
"score": 0.9998873472213745,
"start": 509,
"tag": "NAME",
"value": "Hudson P. Magalhães"
},
{
"context": "actional;\n\n/**\n *\n ... | null | [] | package br.eti.hmagalhaes.rh.model.service;
import br.eti.hmagalhaes.rh.model.dto.ColaboradorFormDTO;
import br.eti.hmagalhaes.rh.model.entity.Colaborador;
import br.eti.hmagalhaes.rh.model.repository.ColaboradoresRepository;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.ConversionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
*
* @author <NAME> <<EMAIL>>
* @since 28-Feb-2014
*/
@Service
public class ColaboradorServiceImpl implements ColaboradorService {
private ColaboradoresRepository colaboradorRepository;
private ConversionService conversionService;
@Transactional
@Override
public Colaborador atualizar(ColaboradorFormDTO form) {
return colaboradorRepository.atualizar(conversionService.
convert(form, Colaborador.class));
}
@Transactional
@Override
public Colaborador inserir(ColaboradorFormDTO form) {
return colaboradorRepository.inserir(conversionService.
convert(form, Colaborador.class));
}
@Transactional
@Override
public Collection<Colaborador> buscar() {
return colaboradorRepository.buscar();
}
@Transactional
@Override
public Colaborador buscar(Long id) {
return colaboradorRepository.buscar(id);
}
@Transactional
@Override
public Collection<Colaborador> buscarPorDepartamento(long id) {
return colaboradorRepository.buscarPorDepartamento(id);
}
@Transactional
@Override
public Colaborador inserir(Colaborador entity) {
return colaboradorRepository.inserir(entity);
}
@Transactional
@Override
public Colaborador atualizar(Colaborador entity) {
return colaboradorRepository.atualizar(entity);
}
@Transactional
@Override
public void remover(Long id) {
colaboradorRepository.remover(id);
}
@Autowired
public void setColaboradorRepository(ColaboradoresRepository colaboradorRepository) {
this.colaboradorRepository = colaboradorRepository;
}
@Autowired
public void setConversionService(ConversionService conversionService) {
this.conversionService = conversionService;
}
} | 2,139 | 0.809129 | 0.806362 | 81 | 25.790123 | 24.342066 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.148148 | false | false | 12 |
357edbab7e7676ad881bb3a4b0db0700c1458f08 | 28,552,942,613,149 | 336e49c66ee912ac1d9815c5d719a7519883a5fd | /src/main/java/com/wandae/deviceClient/rest/RestApi.java | aa38380e9c6324a5e88506a9256e88633f28655e | [] | no_license | dermoritz/wandae_deviceClient | https://github.com/dermoritz/wandae_deviceClient | bcb7351480f64f36e6e6fa3bfd4c2183088fb837 | f9330a00aa4fa09dd397874d85697629b4a355a9 | refs/heads/master | 2020-06-05T00:45:41.116000 | 2015-07-26T18:23:45 | 2015-07-26T18:23:45 | 39,736,383 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.wandae.deviceClient.rest;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.slf4j.Logger;
import com.wandae.deviceClient.device.IdentifiableDevice;
@Path("/check")
@RequestScoped
public class RestApi {
/**
* Logger.
*/
@Inject
private Logger log;
/**
* Produces device info on demand.
*/
@Inject
private Provider<IdentifiableDevice> deviceInfo;
@GET
@Path("/alive")
@Produces({ MediaType.APPLICATION_JSON })
public Response amIalive(@Context HttpServletRequest request) {
log.debug(request.getRemoteHost() + "(ip: " + request.getRemoteAddr() + ")" + " requested alive status.");
return Response.ok(deviceInfo.get()).build();
}
}
| UTF-8 | Java | 964 | java | RestApi.java | Java | [] | null | [] | package com.wandae.deviceClient.rest;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.slf4j.Logger;
import com.wandae.deviceClient.device.IdentifiableDevice;
@Path("/check")
@RequestScoped
public class RestApi {
/**
* Logger.
*/
@Inject
private Logger log;
/**
* Produces device info on demand.
*/
@Inject
private Provider<IdentifiableDevice> deviceInfo;
@GET
@Path("/alive")
@Produces({ MediaType.APPLICATION_JSON })
public Response amIalive(@Context HttpServletRequest request) {
log.debug(request.getRemoteHost() + "(ip: " + request.getRemoteAddr() + ")" + " requested alive status.");
return Response.ok(deviceInfo.get()).build();
}
}
| 964 | 0.744813 | 0.743776 | 42 | 21.952381 | 22.406368 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false | 12 |
afcec81775be09ac606ad96f7b37466d114092f9 | 32,160,715,144,137 | 2737af17c3a0948b138fe730eb684508d14eb044 | /fsmis/src/main/java/com/systop/fsmis/fscase/task/service/TaskManager.java | 62680fa83dfb18bb1421d2ef46ba09150c98736d | [] | no_license | PabloRPalma/systop | https://github.com/PabloRPalma/systop | fc5729bef220454309f27359bf5358ced3e25034 | ca186722c1098b14169232a1b08b2dc595a62e95 | refs/heads/master | 2016-08-12T15:14:24.406000 | 2012-01-06T02:05:05 | 2012-01-06T02:05:05 | 43,034,213 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.systop.fsmis.fscase.task.service;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import com.opensymphony.xwork2.util.ArrayUtils;
import com.systop.common.modules.dept.model.Dept;
import com.systop.common.modules.security.user.model.User;
import com.systop.core.service.BaseGenericsManager;
import com.systop.fsmis.FsConstants;
import com.systop.fsmis.fscase.CaseConstants;
import com.systop.fsmis.fscase.task.TaskConstants;
import com.systop.fsmis.model.FsCase;
import com.systop.fsmis.model.SendType;
import com.systop.fsmis.model.SmsSend;
import com.systop.fsmis.model.Task;
import com.systop.fsmis.model.TaskAtt;
import com.systop.fsmis.model.TaskDetail;
import com.systop.fsmis.sms.SmsConstants;
import com.systop.fsmis.sms.SmsSendManager;
/**
* 任务service层类
*
* @author WorkShopers
*
*/
@Service
public class TaskManager extends BaseGenericsManager<Task> {
@Autowired
private SmsSendManager smsSendManager;
/**
* 保存派遣任务方法
*
* @param task 任务实体实例
* @param deptIds 部门id集合
* @param taskAtts 任务附件实体集合
*/
@Transactional
public void save(Task task, String[] deptIds, List<TaskAtt> taskAtts,
Integer sendTypeId) {
Assert.notNull(task);
Assert.notNull(task.getFsCase());
Assert.notNull(task.getFsCase().getId());
Assert.notEmpty(deptIds);
// 得到任务关联事件实体
FsCase fsCase = getDao().get(FsCase.class, task.getFsCase().getId());
// 更新食品安全案件状态,正在处理,并保存
fsCase.setStatus(CaseConstants.CASE_PROCESSING);
// 事件处理类型为"任务派遣"
fsCase.setProcessType(CaseConstants.PROCESS_TYPE_TASK);
// 如果选择的是既定派遣类型,则设定事件的派遣类型
if (sendTypeId != null) {
SendType st = getDao().get(SendType.class, sendTypeId);
fsCase.setSendType(st);
}
getDao().save(fsCase);
// 设置任务信息,为接收,并保存
task.setStatus(TaskConstants.TASK_UN_RECEIVE);
// 根据任务选择的部门集合,作任务明细信息操作
// 如果部门id集合不为空,遍历部门构建任务明细实例.
if (ArrayUtils.isNotEmpty(deptIds)) {
for (String id : deptIds) {
TaskDetail taskDetail = new TaskDetail();
Dept dept = getDao().get(Dept.class, Integer.valueOf(id));
// Dept dept= (Dept) getDao().findObject("from Dept d where d.id = ?",
// Integer.valueOf(id));
taskDetail.setDept(dept);
// 任务明细状态属性,未接收
taskDetail.setStatus(TaskConstants.TASK_DETAIL_UN_RECEIVE);
// 设定任务明细关联的任务
taskDetail.setTask(task);
task.getTaskDetails().add(taskDetail);
getDao().save(taskDetail);
// 向该部门发送短信
sendTaskMessage(dept,fsCase,task);
}
}
// 设置任务附件实体和任务实体的关联并保存任务附件实体
if (CollectionUtils.isNotEmpty(taskAtts)) {
for (TaskAtt taskAtt : taskAtts) {
taskAtt.setTask(task);
task.getTaskAtts().add(taskAtt);
getDao().save(taskAtt);
}
}
// 置历史任务为"非当前任务"
markCurrentTask(fsCase);
// 设置新添加的任务实体实例为"当前任务"
task.setIsCurrentTask(FsConstants.Y);
save(task);
}
/**
* 将当前事件所对应的历史任务标记为非当前任务<br>
* 由于任务被退回后可以再次派发,所以通过一个isCurrent属性标示是否是当前任务<br>
* 当创建一个任务时,需要将该事件以前的所有任务的标示为非当前任务
*
* @param fsCase
*/
private void markCurrentTask(FsCase fsCase) {
if (fsCase != null) {
for (Task task : fsCase.getTaskses()) {
if (task != null) {
task.setIsCurrentTask(FsConstants.N);
}
}
}
}
/**
* 发送短信方法
*
* @param dept 任务明细关联的部门,短信的发送依据就是部门
*/
private void sendTaskMessage(Dept dept,FsCase fsCase,Task task) {
Set<User> users = dept.getUsers();
StringBuffer buf = new StringBuffer();
buf.append(dept.getName()).append(",你部门现有一条待处理任务,请及时登录系统处理.");
for (User u : users) {
// 如果是短信接收人,则向其发送短信
if (FsConstants.Y.equals(u.getIsSmsReceiver())) {
SmsSend smsSend = new SmsSend();
smsSend.setMobileNum(u.getMobile());
smsSend.setContent(buf.toString());
smsSend.setCreateTime(new Date());
smsSend.setIsNew(SmsConstants.SMS_SMS_SEND_IS_NEW);
smsSend.setFsCase(fsCase);
smsSend.setTask(task);
smsSend.setIsReceive(FsConstants.N);
smsSend.setName(u.getName());
fsCase.getSmsSendses().add(smsSend);
smsSendManager.addMessage(smsSend);
}
}
}
/**
* 删除任务方法<br>
* 本方法必须完成以下几项操作<br>
*
* <pre>
* 1.任务实体关联的多个任务明细实体
* 2.删除任务对应的各个附件文件
* 3.删除任务对应的附件实体
* 4.删除任务实体
* 5.修改任务对应的食品安全案件的状态
* </pre>
*
* @param task
*/
@Override
@Transactional
public void remove(Task task) {
if (task != null && task.getId() != null) {
// 删除本任务关联的任务明细实体
for (TaskDetail td : task.getTaskDetails()) {
getDao().delete(td);
}
for (TaskAtt taskAtt : task.getTaskAtts()) {
getDao().delete(taskAtt);
}
FsCase fsCase = task.getFsCase();
// 置相关联的案件状态为"未派遣"
fsCase.setStatus(CaseConstants.CASE_UN_RESOLVE);
// 保存案件实例
getDao().save(fsCase);
// 删除任务
super.remove(task);
}
}
}
| UTF-8 | Java | 6,391 | java | TaskManager.java | Java | [
{
"context": "ndManager;\r\n\r\n/**\r\n * 任务service层类\r\n * \r\n * @author WorkShopers\r\n * \r\n */\r\n@Service\r\npublic class TaskManager ext",
"end": 1127,
"score": 0.9993604421615601,
"start": 1116,
"tag": "USERNAME",
"value": "WorkShopers"
}
] | null | [] | package com.systop.fsmis.fscase.task.service;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import com.opensymphony.xwork2.util.ArrayUtils;
import com.systop.common.modules.dept.model.Dept;
import com.systop.common.modules.security.user.model.User;
import com.systop.core.service.BaseGenericsManager;
import com.systop.fsmis.FsConstants;
import com.systop.fsmis.fscase.CaseConstants;
import com.systop.fsmis.fscase.task.TaskConstants;
import com.systop.fsmis.model.FsCase;
import com.systop.fsmis.model.SendType;
import com.systop.fsmis.model.SmsSend;
import com.systop.fsmis.model.Task;
import com.systop.fsmis.model.TaskAtt;
import com.systop.fsmis.model.TaskDetail;
import com.systop.fsmis.sms.SmsConstants;
import com.systop.fsmis.sms.SmsSendManager;
/**
* 任务service层类
*
* @author WorkShopers
*
*/
@Service
public class TaskManager extends BaseGenericsManager<Task> {
@Autowired
private SmsSendManager smsSendManager;
/**
* 保存派遣任务方法
*
* @param task 任务实体实例
* @param deptIds 部门id集合
* @param taskAtts 任务附件实体集合
*/
@Transactional
public void save(Task task, String[] deptIds, List<TaskAtt> taskAtts,
Integer sendTypeId) {
Assert.notNull(task);
Assert.notNull(task.getFsCase());
Assert.notNull(task.getFsCase().getId());
Assert.notEmpty(deptIds);
// 得到任务关联事件实体
FsCase fsCase = getDao().get(FsCase.class, task.getFsCase().getId());
// 更新食品安全案件状态,正在处理,并保存
fsCase.setStatus(CaseConstants.CASE_PROCESSING);
// 事件处理类型为"任务派遣"
fsCase.setProcessType(CaseConstants.PROCESS_TYPE_TASK);
// 如果选择的是既定派遣类型,则设定事件的派遣类型
if (sendTypeId != null) {
SendType st = getDao().get(SendType.class, sendTypeId);
fsCase.setSendType(st);
}
getDao().save(fsCase);
// 设置任务信息,为接收,并保存
task.setStatus(TaskConstants.TASK_UN_RECEIVE);
// 根据任务选择的部门集合,作任务明细信息操作
// 如果部门id集合不为空,遍历部门构建任务明细实例.
if (ArrayUtils.isNotEmpty(deptIds)) {
for (String id : deptIds) {
TaskDetail taskDetail = new TaskDetail();
Dept dept = getDao().get(Dept.class, Integer.valueOf(id));
// Dept dept= (Dept) getDao().findObject("from Dept d where d.id = ?",
// Integer.valueOf(id));
taskDetail.setDept(dept);
// 任务明细状态属性,未接收
taskDetail.setStatus(TaskConstants.TASK_DETAIL_UN_RECEIVE);
// 设定任务明细关联的任务
taskDetail.setTask(task);
task.getTaskDetails().add(taskDetail);
getDao().save(taskDetail);
// 向该部门发送短信
sendTaskMessage(dept,fsCase,task);
}
}
// 设置任务附件实体和任务实体的关联并保存任务附件实体
if (CollectionUtils.isNotEmpty(taskAtts)) {
for (TaskAtt taskAtt : taskAtts) {
taskAtt.setTask(task);
task.getTaskAtts().add(taskAtt);
getDao().save(taskAtt);
}
}
// 置历史任务为"非当前任务"
markCurrentTask(fsCase);
// 设置新添加的任务实体实例为"当前任务"
task.setIsCurrentTask(FsConstants.Y);
save(task);
}
/**
* 将当前事件所对应的历史任务标记为非当前任务<br>
* 由于任务被退回后可以再次派发,所以通过一个isCurrent属性标示是否是当前任务<br>
* 当创建一个任务时,需要将该事件以前的所有任务的标示为非当前任务
*
* @param fsCase
*/
private void markCurrentTask(FsCase fsCase) {
if (fsCase != null) {
for (Task task : fsCase.getTaskses()) {
if (task != null) {
task.setIsCurrentTask(FsConstants.N);
}
}
}
}
/**
* 发送短信方法
*
* @param dept 任务明细关联的部门,短信的发送依据就是部门
*/
private void sendTaskMessage(Dept dept,FsCase fsCase,Task task) {
Set<User> users = dept.getUsers();
StringBuffer buf = new StringBuffer();
buf.append(dept.getName()).append(",你部门现有一条待处理任务,请及时登录系统处理.");
for (User u : users) {
// 如果是短信接收人,则向其发送短信
if (FsConstants.Y.equals(u.getIsSmsReceiver())) {
SmsSend smsSend = new SmsSend();
smsSend.setMobileNum(u.getMobile());
smsSend.setContent(buf.toString());
smsSend.setCreateTime(new Date());
smsSend.setIsNew(SmsConstants.SMS_SMS_SEND_IS_NEW);
smsSend.setFsCase(fsCase);
smsSend.setTask(task);
smsSend.setIsReceive(FsConstants.N);
smsSend.setName(u.getName());
fsCase.getSmsSendses().add(smsSend);
smsSendManager.addMessage(smsSend);
}
}
}
/**
* 删除任务方法<br>
* 本方法必须完成以下几项操作<br>
*
* <pre>
* 1.任务实体关联的多个任务明细实体
* 2.删除任务对应的各个附件文件
* 3.删除任务对应的附件实体
* 4.删除任务实体
* 5.修改任务对应的食品安全案件的状态
* </pre>
*
* @param task
*/
@Override
@Transactional
public void remove(Task task) {
if (task != null && task.getId() != null) {
// 删除本任务关联的任务明细实体
for (TaskDetail td : task.getTaskDetails()) {
getDao().delete(td);
}
for (TaskAtt taskAtt : task.getTaskAtts()) {
getDao().delete(taskAtt);
}
FsCase fsCase = task.getFsCase();
// 置相关联的案件状态为"未派遣"
fsCase.setStatus(CaseConstants.CASE_UN_RESOLVE);
// 保存案件实例
getDao().save(fsCase);
// 删除任务
super.remove(task);
}
}
}
| 6,391 | 0.636145 | 0.635038 | 188 | 26.813829 | 19.330618 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.515957 | false | false | 12 |
dd8e0b5e7314c42b6bf66be4cf60df8a293eede6 | 32,160,715,144,995 | 56a0ee2ed274bcb303d2360316eb53fbdfe6d2d5 | /client/src/main/java/cn/edu/shu/client/ui/ConnectPane.java | b38030c55894d17453a99394def7f1b17b1ce4e3 | [] | no_license | yzt1023/FTP | https://github.com/yzt1023/FTP | 83ae192d37e6d763aad87adc4d0cfa805a1318c5 | 86315ca58fe9f760caf750748df5a8753886de54 | refs/heads/master | 2022-07-22T12:09:46.757000 | 2019-07-24T03:12:41 | 2019-07-24T03:12:41 | 177,783,356 | 0 | 0 | null | false | 2022-06-21T01:02:54 | 2019-03-26T12:24:05 | 2019-07-24T03:12:43 | 2022-06-21T01:02:52 | 456 | 0 | 0 | 2 | Java | false | false | package cn.edu.shu.client.ui;
import cn.edu.shu.client.listener.ConnectListener;
import cn.edu.shu.common.util.Constants;
import cn.edu.shu.common.util.MessageUtils;
import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
class ConnectPane extends JPanel {
private static final String CONNECT = "Connect";
private static final String DISCONNECT = "Disconnect";
private JLabel lblUsername;
private JTextField txtUsername;
private JLabel lblPwd;
private JPasswordField txtPwd;
private JLabel lblHost;
private JTextField txtHost;
private JLabel lblPort;
private JTextField txtPort;
private JCheckBox cbAnonymous;
private JButton btnConnect;
private ConnectListener listener;
ConnectPane(ConnectListener listener) {
super();
this.listener = listener;
initComponents();
setGroupLayout();
}
private void initComponents() {
// new components
lblUsername = new JLabel("Username: ");
txtUsername = new JTextField();
lblPwd = new JLabel("Password: ");
txtPwd = new JPasswordField();
lblHost = new JLabel("Host: ");
txtHost = new JTextField();
lblPort = new JLabel("Port: ");
txtPort = new JTextField();
txtPort.setText(String.valueOf(Constants.DEFAULT_CONTROL_PORT));
cbAnonymous = new JCheckBox("Anonymous");
btnConnect = new JButton(CONNECT);
txtPwd.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyChar() == KeyEvent.VK_ENTER) {
btnConnect.doClick();
}
}
});
cbAnonymous.addChangeListener(e -> {
if (cbAnonymous.isSelected()) {
txtUsername.setEnabled(false);
txtPwd.setEnabled(false);
} else if (!isConnected()) {
txtUsername.setEnabled(true);
txtPwd.setEnabled(true);
}
});
btnConnect.addActionListener(e -> {
if (CONNECT.equals(btnConnect.getText()))
connect();
else {
listener.startDisconnect();
afterDisconnect();
}
});
}
private void connect() {
String host = txtHost.getText();
String port = txtPort.getText();
boolean anonymous = cbAnonymous.isSelected();
int portNum = Constants.DEFAULT_CONTROL_PORT;
String username = txtUsername.getText();
char[] password = txtPwd.getPassword();
if (host.isEmpty()) {
MessageUtils.showInfoMessage(Constants.EMPTY_HOST);
return;
}
if (!port.isEmpty()) {
try {
portNum = Integer.parseInt(txtPort.getText());
} catch (NumberFormatException exception) {
MessageUtils.showInfoMessage(Constants.INVALID_PORT);
return;
}
}
if (anonymous && listener.startConnect(host, portNum)) {
afterConnect();
return;
}
if (!anonymous) {
if (username.isEmpty()) {
MessageUtils.showInfoMessage(Constants.EMPTY_USER);
return;
}
if (password.length == 0) {
MessageUtils.showInfoMessage(Constants.EMPTY_PASSWORD);
return;
}
if (listener.startConnect(host, portNum, username, new String(password))) {
afterConnect();
return;
}
}
MessageUtils.showInfoMessage(Constants.CONNECT_FAILED);
}
private void afterConnect() {
btnConnect.setText(DISCONNECT);
setInputEnabled(false);
listener.connectCompleted();
}
private void afterDisconnect() {
btnConnect.setText(CONNECT);
setInputEnabled(true);
listener.disconnectCompleted();
}
private void setGroupLayout() {
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
GroupLayout.SequentialGroup sequentialGroup = layout.createSequentialGroup();
sequentialGroup.addContainerGap();
//host
sequentialGroup.addComponent(lblHost);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtHost, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//port
sequentialGroup.addComponent(lblPort);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtPort, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//username
sequentialGroup.addComponent(lblUsername);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtUsername, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//password
sequentialGroup.addComponent(lblPwd);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtPwd, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//button
sequentialGroup.addComponent(cbAnonymous);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
sequentialGroup.addComponent(btnConnect);
sequentialGroup.addContainerGap();
GroupLayout.ParallelGroup horizontalGroup = layout.createParallelGroup();
horizontalGroup.addGroup(sequentialGroup);
layout.setHorizontalGroup(horizontalGroup);
GroupLayout.ParallelGroup parallelGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
parallelGroup.addComponent(lblHost);
parallelGroup.addComponent(txtHost);
parallelGroup.addComponent(lblPort);
parallelGroup.addComponent(txtPort);
parallelGroup.addComponent(lblUsername);
parallelGroup.addComponent(txtUsername);
parallelGroup.addComponent(lblPwd);
parallelGroup.addComponent(txtPwd);
parallelGroup.addComponent(cbAnonymous);
parallelGroup.addComponent(btnConnect);
GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup();
verticalGroup.addContainerGap();
verticalGroup.addGroup(parallelGroup);
verticalGroup.addContainerGap();
layout.setVerticalGroup(verticalGroup);
}
private void setInputEnabled(boolean enabled) {
txtHost.setEnabled(enabled);
lblHost.setEnabled(enabled);
txtPort.setEnabled(enabled);
lblPort.setEnabled(enabled);
txtUsername.setEnabled(enabled);
lblUsername.setEnabled(enabled);
txtPwd.setEnabled(enabled);
lblPwd.setEnabled(enabled);
cbAnonymous.setEnabled(enabled);
}
private boolean isConnected() {
return DISCONNECT.equals(btnConnect.getText());
}
}
| UTF-8 | Java | 7,410 | java | ConnectPane.java | Java | [
{
"context": "= txtUsername.getText();\n char[] password = txtPwd.getPassword();\n if (host.isEmpty()) {\n ",
"end": 2620,
"score": 0.8188173174858093,
"start": 2617,
"tag": "PASSWORD",
"value": "txt"
},
{
"context": "outStyle.ComponentPlacement.UNRELATED);\n //u... | null | [] | package cn.edu.shu.client.ui;
import cn.edu.shu.client.listener.ConnectListener;
import cn.edu.shu.common.util.Constants;
import cn.edu.shu.common.util.MessageUtils;
import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
class ConnectPane extends JPanel {
private static final String CONNECT = "Connect";
private static final String DISCONNECT = "Disconnect";
private JLabel lblUsername;
private JTextField txtUsername;
private JLabel lblPwd;
private JPasswordField txtPwd;
private JLabel lblHost;
private JTextField txtHost;
private JLabel lblPort;
private JTextField txtPort;
private JCheckBox cbAnonymous;
private JButton btnConnect;
private ConnectListener listener;
ConnectPane(ConnectListener listener) {
super();
this.listener = listener;
initComponents();
setGroupLayout();
}
private void initComponents() {
// new components
lblUsername = new JLabel("Username: ");
txtUsername = new JTextField();
lblPwd = new JLabel("Password: ");
txtPwd = new JPasswordField();
lblHost = new JLabel("Host: ");
txtHost = new JTextField();
lblPort = new JLabel("Port: ");
txtPort = new JTextField();
txtPort.setText(String.valueOf(Constants.DEFAULT_CONTROL_PORT));
cbAnonymous = new JCheckBox("Anonymous");
btnConnect = new JButton(CONNECT);
txtPwd.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyChar() == KeyEvent.VK_ENTER) {
btnConnect.doClick();
}
}
});
cbAnonymous.addChangeListener(e -> {
if (cbAnonymous.isSelected()) {
txtUsername.setEnabled(false);
txtPwd.setEnabled(false);
} else if (!isConnected()) {
txtUsername.setEnabled(true);
txtPwd.setEnabled(true);
}
});
btnConnect.addActionListener(e -> {
if (CONNECT.equals(btnConnect.getText()))
connect();
else {
listener.startDisconnect();
afterDisconnect();
}
});
}
private void connect() {
String host = txtHost.getText();
String port = txtPort.getText();
boolean anonymous = cbAnonymous.isSelected();
int portNum = Constants.DEFAULT_CONTROL_PORT;
String username = txtUsername.getText();
char[] password = txtPwd.getPassword();
if (host.isEmpty()) {
MessageUtils.showInfoMessage(Constants.EMPTY_HOST);
return;
}
if (!port.isEmpty()) {
try {
portNum = Integer.parseInt(txtPort.getText());
} catch (NumberFormatException exception) {
MessageUtils.showInfoMessage(Constants.INVALID_PORT);
return;
}
}
if (anonymous && listener.startConnect(host, portNum)) {
afterConnect();
return;
}
if (!anonymous) {
if (username.isEmpty()) {
MessageUtils.showInfoMessage(Constants.EMPTY_USER);
return;
}
if (password.length == 0) {
MessageUtils.showInfoMessage(Constants.EMPTY_PASSWORD);
return;
}
if (listener.startConnect(host, portNum, username, new String(password))) {
afterConnect();
return;
}
}
MessageUtils.showInfoMessage(Constants.CONNECT_FAILED);
}
private void afterConnect() {
btnConnect.setText(DISCONNECT);
setInputEnabled(false);
listener.connectCompleted();
}
private void afterDisconnect() {
btnConnect.setText(CONNECT);
setInputEnabled(true);
listener.disconnectCompleted();
}
private void setGroupLayout() {
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
GroupLayout.SequentialGroup sequentialGroup = layout.createSequentialGroup();
sequentialGroup.addContainerGap();
//host
sequentialGroup.addComponent(lblHost);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtHost, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//port
sequentialGroup.addComponent(lblPort);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtPort, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//username
sequentialGroup.addComponent(lblUsername);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtUsername, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//password
sequentialGroup.addComponent(lblPwd);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
sequentialGroup.addComponent(txtPwd, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
//button
sequentialGroup.addComponent(cbAnonymous);
sequentialGroup.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
sequentialGroup.addComponent(btnConnect);
sequentialGroup.addContainerGap();
GroupLayout.ParallelGroup horizontalGroup = layout.createParallelGroup();
horizontalGroup.addGroup(sequentialGroup);
layout.setHorizontalGroup(horizontalGroup);
GroupLayout.ParallelGroup parallelGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE);
parallelGroup.addComponent(lblHost);
parallelGroup.addComponent(txtHost);
parallelGroup.addComponent(lblPort);
parallelGroup.addComponent(txtPort);
parallelGroup.addComponent(lblUsername);
parallelGroup.addComponent(txtUsername);
parallelGroup.addComponent(lblPwd);
parallelGroup.addComponent(txtPwd);
parallelGroup.addComponent(cbAnonymous);
parallelGroup.addComponent(btnConnect);
GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup();
verticalGroup.addContainerGap();
verticalGroup.addGroup(parallelGroup);
verticalGroup.addContainerGap();
layout.setVerticalGroup(verticalGroup);
}
private void setInputEnabled(boolean enabled) {
txtHost.setEnabled(enabled);
lblHost.setEnabled(enabled);
txtPort.setEnabled(enabled);
lblPort.setEnabled(enabled);
txtUsername.setEnabled(enabled);
lblUsername.setEnabled(enabled);
txtPwd.setEnabled(enabled);
lblPwd.setEnabled(enabled);
cbAnonymous.setEnabled(enabled);
}
private boolean isConnected() {
return DISCONNECT.equals(btnConnect.getText());
}
}
| 7,410 | 0.647368 | 0.645749 | 204 | 35.323528 | 24.598406 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.691176 | false | false | 12 |
2b66dfbb16a259e594ee9e43ab76d4f5aed4b922 | 12,850,542,178,753 | cc1b87a0d628d50b0d31fe73f28146baefd82483 | /AdvPro/src/main/java/com/example/demo/dto/CategoryDto.java | 5359337a76102a4c77d5ddfd75919aad7dc68094 | [] | no_license | haiduong07137/duAnRaTruong | https://github.com/haiduong07137/duAnRaTruong | 844227e2a13550770769be5ed73a1c6375ab3833 | 7a9e32baf4acd6d17832ba8c59122c960987b148 | refs/heads/master | 2023-01-27T19:21:13.785000 | 2020-12-07T01:55:00 | 2020-12-07T01:55:00 | 319,175,061 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.demo.dto;
import java.util.HashSet;
import java.util.Set;
import com.example.demo.domain.Category;
public class CategoryDto extends BaseObjectDto {
private String name;
private String code;
private Set<ProductDto> products;
/* Getters and Setters */
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Set<ProductDto> getProducts() {
return products;
}
public void setProducts(Set<ProductDto> products) {
this.products = products;
}
public CategoryDto() {
super();
}
public CategoryDto(Category entity) {
super();
if (entity != null) {
this.id = entity.getId();
this.name = entity.getName();
this.code = entity.getCode();
}
}
public CategoryDto(Category entity, boolean simple) {
super();
if (entity != null) {
this.id = entity.getId();
this.name = entity.getName();
this.code = entity.getCode();
}
}
}
| UTF-8 | Java | 1,058 | java | CategoryDto.java | Java | [] | null | [] | package com.example.demo.dto;
import java.util.HashSet;
import java.util.Set;
import com.example.demo.domain.Category;
public class CategoryDto extends BaseObjectDto {
private String name;
private String code;
private Set<ProductDto> products;
/* Getters and Setters */
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Set<ProductDto> getProducts() {
return products;
}
public void setProducts(Set<ProductDto> products) {
this.products = products;
}
public CategoryDto() {
super();
}
public CategoryDto(Category entity) {
super();
if (entity != null) {
this.id = entity.getId();
this.name = entity.getName();
this.code = entity.getCode();
}
}
public CategoryDto(Category entity, boolean simple) {
super();
if (entity != null) {
this.id = entity.getId();
this.name = entity.getName();
this.code = entity.getCode();
}
}
}
| 1,058 | 0.669187 | 0.669187 | 56 | 17.892857 | 15.165373 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.75 | false | false | 12 |
5d3eb463583099c4f1919e0d7ac8bc70a6bb8a08 | 33,913,061,779,069 | 2afc6e4a510733c269241d04b5f85675ec1c7b86 | /core/src/main/java/com/canu/dto/responses/CanIServiceDto.java | 1eacc751a0544e54cfdf69354e613f70327753a6 | [] | no_license | tule-steve/CanU | https://github.com/tule-steve/CanU | cd87cbb6dc6eb374b1a3e30461762a7f045acf0c | a607a07d13b2d68e352c845297669160f3b98653 | refs/heads/master | 2023-08-28T05:42:16.084000 | 2021-10-09T15:21:56 | 2021-10-09T15:21:56 | 324,982,498 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.canu.dto.responses;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class CanIServiceDto {
private Long serviceId;
private String title;
private Long count;
}
| UTF-8 | Java | 226 | java | CanIServiceDto.java | Java | [] | null | [] | package com.canu.dto.responses;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class CanIServiceDto {
private Long serviceId;
private String title;
private Long count;
}
| 226 | 0.765487 | 0.765487 | 14 | 15.142858 | 12.849998 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
5360e5ef026c36ccaf4f824565d4496f550a4950 | 34,875,134,447,120 | e7e82d4a6216204038b62d57172591dffa742175 | /2012_Main_Robot/src/frc2168/commands/LightIfBall.java | aa79be195d566c2083f18c6c11ebe9e98306a547 | [] | no_license | Team2168/FRC2012 | https://github.com/Team2168/FRC2012 | 9e7f10b4af80d2971a13f2ed46192218839feb3a | 837f63f9c92458afae878578508eaba7dd4fa28e | refs/heads/master | 2016-09-09T17:44:01.448000 | 2012-05-18T06:09:29 | 2012-05-18T06:09:29 | 3,264,238 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package frc2168.commands;
import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.DigitalOutput;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.command.Command;
import frc2168.RobotMap;
public class LightIfBall extends Command {
AnalogChannel ballLight = new AnalogChannel(RobotMap.ballLight);
Relay backLight= new Relay(RobotMap.backLight);
int LIGHT_CYCLES = 25; // Cycles to wait before turning off light
int prevState;
public LightIfBall(){
//System.out.println("LightIfBall Class Started");
}
protected void initialize() {
// TODO Auto-generated method stub
prevState = LIGHT_CYCLES;
}
protected void execute() {
if(ballLight.getVoltage() >= RobotMap.ballPresentVoltage
|| prevState<LIGHT_CYCLES && prevState>0){
backLight.set(Relay.Value.kForward);
//System.out.println("Set kForward");
prevState--;
} else {
backLight.set(Relay.Value.kOff);
//System.out.println("Set kOff");
prevState=LIGHT_CYCLES;
}
}
protected boolean isFinished() {
// TODO Auto-generated method stub
return false;
}
protected void end() {
// TODO Auto-generated method stub
}
protected void interrupted() {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 1,297 | java | LightIfBall.java | Java | [] | null | [] | package frc2168.commands;
import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.DigitalOutput;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.command.Command;
import frc2168.RobotMap;
public class LightIfBall extends Command {
AnalogChannel ballLight = new AnalogChannel(RobotMap.ballLight);
Relay backLight= new Relay(RobotMap.backLight);
int LIGHT_CYCLES = 25; // Cycles to wait before turning off light
int prevState;
public LightIfBall(){
//System.out.println("LightIfBall Class Started");
}
protected void initialize() {
// TODO Auto-generated method stub
prevState = LIGHT_CYCLES;
}
protected void execute() {
if(ballLight.getVoltage() >= RobotMap.ballPresentVoltage
|| prevState<LIGHT_CYCLES && prevState>0){
backLight.set(Relay.Value.kForward);
//System.out.println("Set kForward");
prevState--;
} else {
backLight.set(Relay.Value.kOff);
//System.out.println("Set kOff");
prevState=LIGHT_CYCLES;
}
}
protected boolean isFinished() {
// TODO Auto-generated method stub
return false;
}
protected void end() {
// TODO Auto-generated method stub
}
protected void interrupted() {
// TODO Auto-generated method stub
}
}
| 1,297 | 0.690054 | 0.681573 | 56 | 21.160715 | 19.677559 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.553571 | false | false | 12 |
f4cb50ae0158d38da4e5613165c75ce4e3d4b634 | 9,534,827,401,570 | 832bafbee74d268a97b7cdac91eff5ad6cc0155f | /L32-messagingSystem/springWebServer/src/main/java/ru/otus/controllers/ClientRestController.java | a4fb464df09534408e33737e554f5dd3671a7b34 | [] | no_license | blummock/otus_java_2020_12 | https://github.com/blummock/otus_java_2020_12 | da6b8b2d75cbc2d713804f5a48e8c2930a581ecf | effb48ba7732277ccabf9bc3aa850c62cdb4cf05 | refs/heads/main | 2023-06-25T06:47:18.573000 | 2021-07-24T09:18:50 | 2021-07-24T09:18:50 | 327,896,340 | 0 | 0 | null | false | 2021-07-25T06:40:17 | 2021-01-08T12:26:08 | 2021-07-24T09:18:53 | 2021-07-25T06:39:40 | 205 | 0 | 0 | 1 | Java | false | false | package ru.otus.controllers;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import ru.otus.crm.model.Client;
import ru.otus.crm.service.FrontendService;
@RestController
public class ClientRestController {
private final FrontendService frontendService;
public ClientRestController(FrontendService frontendService) {
this.frontendService = frontendService;
}
@PostMapping("/api/client")
public void saveClient(@RequestBody Client client) {
frontendService.putClientAsync(client, c -> frontendService.getClientsAsync());
}
@GetMapping("api/client/list")
public void getClients() {
frontendService.getClientsAsync();
}
}
| UTF-8 | Java | 878 | java | ClientRestController.java | Java | [] | null | [] | package ru.otus.controllers;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import ru.otus.crm.model.Client;
import ru.otus.crm.service.FrontendService;
@RestController
public class ClientRestController {
private final FrontendService frontendService;
public ClientRestController(FrontendService frontendService) {
this.frontendService = frontendService;
}
@PostMapping("/api/client")
public void saveClient(@RequestBody Client client) {
frontendService.putClientAsync(client, c -> frontendService.getClientsAsync());
}
@GetMapping("api/client/list")
public void getClients() {
frontendService.getClientsAsync();
}
}
| 878 | 0.769932 | 0.769932 | 28 | 30.357143 | 25.425261 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 12 |
8342382ec8d191d8c9c9169630008571fe91c7b4 | 34,763,465,303,796 | 255cf6f012dd3e200b9e4e021cfb40b394e4f2f3 | /src/main/java/com/trade_accounting/models/Acceptance.java | dffbda960454330eb568698ddb7d610fe60dae77 | [] | no_license | ArtemZaikovsky/Back | https://github.com/ArtemZaikovsky/Back | 28cbc4104e8f38d1a98175c7b06ecb2c009f8189 | de512acb694d9bae6e5fa2e852e6b1881157516c | refs/heads/main | 2023-07-17T11:46:43.612000 | 2021-08-20T13:53:09 | 2021-08-20T13:53:09 | 398,292,819 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.trade_accounting.models;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.ColumnDefault;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "acceptances")
public class Acceptance {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "incoming_number")
private String incomingNumber;
@Column(name = "comment")
private String comment;
@Column(name = "incoming_number_date", columnDefinition = "date default current_date")
private LocalDate incomingNumberDate;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Contractor contractor;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Warehouse warehouse;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Contract contract;
@Column(name = "is_sent")
@ColumnDefault("false")
Boolean isSent = false;
@Column(name = "is_print")
@ColumnDefault("false")
Boolean isPrint = false;
@OneToMany(fetch = FetchType.LAZY)
private List<AcceptanceProduction> acceptanceProduction;
}
| UTF-8 | Java | 1,618 | java | Acceptance.java | Java | [] | null | [] | package com.trade_accounting.models;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.ColumnDefault;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "acceptances")
public class Acceptance {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "incoming_number")
private String incomingNumber;
@Column(name = "comment")
private String comment;
@Column(name = "incoming_number_date", columnDefinition = "date default current_date")
private LocalDate incomingNumberDate;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Contractor contractor;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Warehouse warehouse;
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
private Contract contract;
@Column(name = "is_sent")
@ColumnDefault("false")
Boolean isSent = false;
@Column(name = "is_print")
@ColumnDefault("false")
Boolean isPrint = false;
@OneToMany(fetch = FetchType.LAZY)
private List<AcceptanceProduction> acceptanceProduction;
}
| 1,618 | 0.754017 | 0.754017 | 65 | 23.892307 | 17.697565 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446154 | false | false | 12 |
55d51a7c66776e3210a52f94148fb970de4b86e6 | 3,289,944,982,113 | 4d2dd56e49613b2e6eea34686085297b33d8fd2f | /src/Chapter3/MiddleNode.java | 0c8828f7251556a9e4d90e4dcda6e5443a0f5f62 | [] | no_license | curtislarson/algorithm-design-manual | https://github.com/curtislarson/algorithm-design-manual | c5270f1e431d141ec2bdfa71a5db8920f69824b6 | 3e89e062e89f3c9e36e0679d7cb56add1c90d170 | refs/heads/master | 2022-03-05T12:56:26.935000 | 2014-01-17T00:21:08 | 2014-01-17T00:21:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.LinkedList;
import java.util.ListIterator;
public class MiddleNode
{
public static void main(String[] args)
{
LinkedList<Integer> ll = new LinkedList<Integer>();
ll.add(10);
ll.add(20);
ll.add(2);
ll.add(73);
ll.add(39);
ll.add(21);
ll.add(8901);
System.out.println("The middle node is " + middleNode(ll));
}
public static Integer middleNode(LinkedList<Integer> ll)
{
// Since the built in linked list for Java makes this to easy,
// lets use the list iterator.
// Assume no duplicate values
// 1 2 3 4 5 6 7 8 9
// 1 1 2 2 3 3 4 4 5
boolean hasSize = false;
if (hasSize) {
ListIterator<Integer> iterator = ll.listIterator(0);
ListIterator<Integer> endIterator = ll.listIterator(ll.size());
while (iterator.hasNext() && endIterator.hasPrevious()) {
int first = iterator.next();
int second = endIterator.previous();
if (first == second) {
return first;
}
}
}
else {
// This is if we don't know about size.
ListIterator<Integer> iterator = ll.listIterator(0);
int prevIndexCount = 0;
int indexCount = 1;
int index = 1;
int currentMiddle = -1;
ListIterator<Integer> middleIterator = ll.listIterator(0);
while(iterator.hasNext()) {
index++;
int next = iterator.next();
if (index % 2 != 0) {
indexCount++;
}
if (prevIndexCount != indexCount) {
// We know that we need to update the currentMiddle
currentMiddle = middleIterator.next();
}
prevIndexCount = indexCount;
}
return currentMiddle;
}
return -1;
}
} | UTF-8 | Java | 2,016 | java | MiddleNode.java | Java | [] | null | [] | import java.util.LinkedList;
import java.util.ListIterator;
public class MiddleNode
{
public static void main(String[] args)
{
LinkedList<Integer> ll = new LinkedList<Integer>();
ll.add(10);
ll.add(20);
ll.add(2);
ll.add(73);
ll.add(39);
ll.add(21);
ll.add(8901);
System.out.println("The middle node is " + middleNode(ll));
}
public static Integer middleNode(LinkedList<Integer> ll)
{
// Since the built in linked list for Java makes this to easy,
// lets use the list iterator.
// Assume no duplicate values
// 1 2 3 4 5 6 7 8 9
// 1 1 2 2 3 3 4 4 5
boolean hasSize = false;
if (hasSize) {
ListIterator<Integer> iterator = ll.listIterator(0);
ListIterator<Integer> endIterator = ll.listIterator(ll.size());
while (iterator.hasNext() && endIterator.hasPrevious()) {
int first = iterator.next();
int second = endIterator.previous();
if (first == second) {
return first;
}
}
}
else {
// This is if we don't know about size.
ListIterator<Integer> iterator = ll.listIterator(0);
int prevIndexCount = 0;
int indexCount = 1;
int index = 1;
int currentMiddle = -1;
ListIterator<Integer> middleIterator = ll.listIterator(0);
while(iterator.hasNext()) {
index++;
int next = iterator.next();
if (index % 2 != 0) {
indexCount++;
}
if (prevIndexCount != indexCount) {
// We know that we need to update the currentMiddle
currentMiddle = middleIterator.next();
}
prevIndexCount = indexCount;
}
return currentMiddle;
}
return -1;
}
} | 2,016 | 0.502976 | 0.481647 | 65 | 30.030769 | 21.155809 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553846 | false | false | 12 |
b9a094e18c739e51e173849a3bdc828d024c72a2 | 9,165,460,228,917 | fc6e5de43d4447a79e70f88afc967a04e240ff65 | /SpringRestMongo/src/main/java/com/controller/RController.java | 4fc2d82529a22ad2ef2cb883b87b35fd375acfb7 | [] | no_license | Guvenir/Springilkornekler | https://github.com/Guvenir/Springilkornekler | 4cc0e0de897cdfa86cb5ee28b6140db21a7d20d7 | 1ad5830a55698e60c899a6f16a09f3b6b11ee50d | refs/heads/master | 2021-01-17T06:13:24.949000 | 2017-11-06T22:23:10 | 2017-11-06T22:23:10 | 51,061,697 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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.controller;
import com.dao.CustomerRepo;
import com.model.Customer;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author omer
*/
@RestController
@RequestMapping("/test")
public class RController {
@Autowired
private CustomerRepo cr;
@RequestMapping("/test")
public String test(){
return "deneme başarılı";
}
@RequestMapping("/customers")
public List<Customer> getAllCustomer(){
return cr.findAll();
}
@RequestMapping("/save")
public void saveCustomer(){
for(int i = 0; i < 1000;i++){
cr.save(new Customer("omer"+i, "guvenir"+i));
}
}
@RequestMapping("/delete")
public void deleteAllCustomer(){
cr.deleteAll();
}
}
| UTF-8 | Java | 1,238 | java | RController.java | Java | [
{
"context": "bind.annotation.RestController;\n\n/**\n *\n * @author omer\n */\n@RestController\n@RequestMapping(\"/test\")\npubl",
"end": 612,
"score": 0.9963300228118896,
"start": 608,
"tag": "USERNAME",
"value": "omer"
},
{
"context": " i < 1000;i++){\n cr.save(new Cust... | null | [] | /*
* 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.controller;
import com.dao.CustomerRepo;
import com.model.Customer;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
* @author omer
*/
@RestController
@RequestMapping("/test")
public class RController {
@Autowired
private CustomerRepo cr;
@RequestMapping("/test")
public String test(){
return "deneme başarılı";
}
@RequestMapping("/customers")
public List<Customer> getAllCustomer(){
return cr.findAll();
}
@RequestMapping("/save")
public void saveCustomer(){
for(int i = 0; i < 1000;i++){
cr.save(new Customer("omer"+i, "guvenir"+i));
}
}
@RequestMapping("/delete")
public void deleteAllCustomer(){
cr.deleteAll();
}
}
| 1,238 | 0.683401 | 0.679352 | 49 | 24.204082 | 20.502842 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.408163 | false | false | 12 |
85f092c3c6fd1bc3d29544a37abb7147bcbd0471 | 24,756,191,514,719 | 4509b1eeea66f12a5334f935a36ea92f1ab9de5f | /Sncf/src/Models/TOOLS/Ajaxmodels/OBJETS/TextAreaDAO.java | da0f9ad39aa820bd5c50b20d346a0c6dd486f07b | [] | no_license | rraballand/meehome-java | https://github.com/rraballand/meehome-java | bef14978f6fcc536f5389576fbc5d120fe33ff3b | 632503c39b413dd34e69ff42641c4502fdb7d180 | refs/heads/master | 2021-09-08T04:17:21.197000 | 2012-08-27T06:57:38 | 2012-08-27T06:57:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Models.TOOLS.Ajaxmodels.OBJETS;
import java.io.PrintWriter;
//RABALLAND Romain v3.0
public class TextAreaDAO {
static public void TextArea(PrintWriter out, String name, int row, int cols, String taille){
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"'></textarea>");
}
static public void TextArea(PrintWriter out, String name, int row, int cols, String taille, String value){
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"'>"+value+"</textarea>");
}
static public void TextArea(PrintWriter out, String name, int row, int cols, String taille, String value,boolean readonly){
if(readonly)
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"' readonly>"+value+"</textarea>");
else
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"'>"+value+"</textarea>");
}
}
| UTF-8 | Java | 1,030 | java | TextAreaDAO.java | Java | [
{
"context": "odels.OBJETS;\r\n\r\nimport java.io.PrintWriter;\r\n\r\n//RABALLAND Romain v3.0\r\n\r\npublic class TextAreaDAO {\r\n \r\n sta",
"end": 92,
"score": 0.993133544921875,
"start": 76,
"tag": "NAME",
"value": "RABALLAND Romain"
}
] | null | [] | package Models.TOOLS.Ajaxmodels.OBJETS;
import java.io.PrintWriter;
//<NAME> v3.0
public class TextAreaDAO {
static public void TextArea(PrintWriter out, String name, int row, int cols, String taille){
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"'></textarea>");
}
static public void TextArea(PrintWriter out, String name, int row, int cols, String taille, String value){
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"'>"+value+"</textarea>");
}
static public void TextArea(PrintWriter out, String name, int row, int cols, String taille, String value,boolean readonly){
if(readonly)
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"' readonly>"+value+"</textarea>");
else
out.println("<textarea name="+name+" rows="+row+" cols="+cols+" style='width:"+taille+"'>"+value+"</textarea>");
}
}
| 1,020 | 0.631068 | 0.629126 | 21 | 47.047619 | 51.10165 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 12 |
1ccb2171aa8b399b2208d19b676857fbe4b22499 | 35,459,250,003,736 | 7de9dcab7e55375b1467eb0ce2dcf957457fd5b2 | /jsp/BoardProject/src/main/java/controller/BoardWriteController.java | b969cddf87ea3eed00db2ac705448aa402f62ffb | [] | no_license | NamSangKyu/UXUIKOKI2106 | https://github.com/NamSangKyu/UXUIKOKI2106 | d171d4c7938c80d6e4e8ab8a2dc953b3782ef9e7 | f9882078a10b5e83b0dd639017476871929a6a0d | refs/heads/main | 2023-08-30T14:38:57.612000 | 2021-10-26T05:28:13 | 2021-10-26T05:28:13 | 378,817,436 | 3 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package controller;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dto.BoardDTO;
import service.BoardService;
import view.ModelAndView;
public class BoardWriteController implements Controller {
@Override
public ModelAndView execute(HttpServletRequest request, HttpServletResponse response) throws IOException {
String title = request.getParameter("title");
String content = request.getParameter("content");
String writer = request.getParameter("writer");
BoardDTO dto = new BoardDTO(title, content, writer);
BoardService.getInstance().InsertBoard(dto);
return new ModelAndView("boardList.do?pageNo=1", false);
}
}
| UTF-8 | Java | 751 | java | BoardWriteController.java | Java | [] | null | [] | package controller;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import dto.BoardDTO;
import service.BoardService;
import view.ModelAndView;
public class BoardWriteController implements Controller {
@Override
public ModelAndView execute(HttpServletRequest request, HttpServletResponse response) throws IOException {
String title = request.getParameter("title");
String content = request.getParameter("content");
String writer = request.getParameter("writer");
BoardDTO dto = new BoardDTO(title, content, writer);
BoardService.getInstance().InsertBoard(dto);
return new ModelAndView("boardList.do?pageNo=1", false);
}
}
| 751 | 0.789614 | 0.788282 | 27 | 26.814816 | 26.372034 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.37037 | false | false | 12 |
4b0ec93450ced28bf66bd08914bd48d059c9f302 | 5,703,716,608,422 | fb49a1014f72db6a81d1d0e8498f97bb2fe93576 | /app/src/main/java/test/ControllerTest.java | 9e6c4c11b56e9d6f0e09964137a05150ad3bce34 | [] | no_license | judylianhua/InjuryMonitoringSystem | https://github.com/judylianhua/InjuryMonitoringSystem | b5fba5513e91f4342c3a0ccae539c4f0c6250a93 | ba9a7b2567882e945fbf652a10ef574041281a81 | refs/heads/master | 2020-12-28T20:31:42.720000 | 2015-12-08T04:47:42 | 2015-12-08T04:47:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import controller.Controller;
import controller.ControllerRunner;
import sendable.DataType;
import sendable.Sendable;
import sendable.alarm.Alarm;
import sendable.alarm.PlayerCause;
import sendable.data.Acceleration;
import sendable.data.Position;
import exception.ThresholdException;
import org.junit.*;
import sendable.data.Request;
import sendable.data.Service;
import java.net.InetAddress;
import java.net.Socket;
import java.util.*;
import static java.lang.Math.pow;
import static org.junit.Assert.*;
/**
* Test cases to test the functionality of the Database Controller.
*
* @see controller.Controller
*/
public class ControllerTest {
private Controller controller;
private Position position1;
private Position position2;
private long t1;
private long t2;
@Before
public void setUp() {
controller = new Controller(35.0);
Calendar cal = Calendar.getInstance();
cal.set(2012, Calendar.JANUARY, 1, 1, 1, 0);
Date d1, d2;
d1 = cal.getTime();
t1 = d1.getTime();
cal.set(2012, Calendar.JANUARY, 1, 1, 1, 2);
d2 = cal.getTime();
t2 = d2.getTime();
}
@Test
public void testCalculateUnderThreshold() {
position1 = new Position(0, t1, 10, 10, 10);
position2 = new Position(0, t2, 20, 20, 20);
double ex = Math.sqrt(pow(position2.getxPos() - position1.getxPos(), 2) +
pow(position2.getyPos() - position1.getyPos(), 2) +
pow(position2.getzPos() - position1.getzPos(), 2));
int expected = (int) ex;
Acceleration acceleration = null;
try {
acceleration = controller.calculate(position1, position2);
} catch (ThresholdException e) {
fail("Threshold calculation threw unexpected exception during calculation: " +
e.getLocalizedMessage());
}
assertNotNull("Sensor Database Data was never initialized!", acceleration);
assertEquals("Acceleration sendable calculation was not equal!", expected, acceleration.getAccelMag());
}
@Test
public void testCalculateOverThreshold() {
position1 = new Position(0, t1, 10, 10, 10);
position2 = new Position(0, t2, 50, 50, 50);
Acceleration acceleration = null;
try {
acceleration = controller.calculate(position1, position2);
} catch (ThresholdException e) {
return;
}
fail("Controller should have thrown exception!");
}
@Test
public void testSendAndReceive() throws Exception {
// Run the main controller
ControllerRunner controllerRunner = new ControllerRunner(10, 9090, InetAddress.getLocalHost(), "127.0.0.1", 8008);
controllerRunner.run();
System.out.println("Controller running");
Random random = new Random();
int player = random.nextInt();
// Connect a new controller and send test alarm
Controller controller = new Controller(10);
Socket connection1 = controller.connectTo(InetAddress.getLocalHost().getHostAddress(), 9090);
Alarm alarm = new Alarm(player, System.currentTimeMillis(), new PlayerCause(player));
controller.send(alarm, connection1);
Controller controller2 = new Controller(10);
Socket connection2 = controller2.connectTo(InetAddress.getLocalHost().getHostAddress(), 9090);
long alarmtime = System.currentTimeMillis() + 500;
Position position1 = new Position(player, System.currentTimeMillis(), 1, 2, 3);
Position position2 = new Position(player, alarmtime, 100, 200, 300);
controller2.send(position1, connection2);
controller2.send(position2, connection2);
controller2.send(new Request(player, DataType.ACCEL, -1, -1), connection2);
controller2.send(new Request(player, DataType.POS, -1, -1), connection2);
Thread.sleep(15000);
List<Sendable> received = controller2.receive(connection2);
List<Alarm> alarms = new ArrayList<Alarm>();
List<Acceleration> accelerations = new ArrayList<Acceleration>();
List<Position> positions = new ArrayList<Position>();
// Distribute the sendable objects
for (Sendable sendable : received) {
if (sendable instanceof Alarm) {
alarms.add((Alarm) sendable);
} else if (sendable instanceof Service) {
Service service = (Service) sendable;
List<?> data = service.getData();
for (Object o : data) {
if (o instanceof Acceleration) {
accelerations.add((Acceleration) o);
} else if (o instanceof Position) {
positions.add((Position) o);
}
}
}
}
controller.disconnectFromClient(connection1);
controller2.disconnectFromClient(connection2);
assertTrue("Alarm was not sent from controller", alarms.size() >= 1);
assertTrue("Acceleration not received from controller", accelerations.size() >= 1);
assertTrue("Position 1 not contained in received positions", positions.contains(position1));
assertTrue("Position 2 not contained in received positions", positions.contains(position2));
}
}
| UTF-8 | Java | 5,388 | java | ControllerTest.java | Java | [
{
"context": "llerRunner(10, 9090, InetAddress.getLocalHost(), \"127.0.0.1\", 8008);\n controllerRunner.run();\n ",
"end": 2785,
"score": 0.9997711181640625,
"start": 2776,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
}
] | null | [] | package test;
import controller.Controller;
import controller.ControllerRunner;
import sendable.DataType;
import sendable.Sendable;
import sendable.alarm.Alarm;
import sendable.alarm.PlayerCause;
import sendable.data.Acceleration;
import sendable.data.Position;
import exception.ThresholdException;
import org.junit.*;
import sendable.data.Request;
import sendable.data.Service;
import java.net.InetAddress;
import java.net.Socket;
import java.util.*;
import static java.lang.Math.pow;
import static org.junit.Assert.*;
/**
* Test cases to test the functionality of the Database Controller.
*
* @see controller.Controller
*/
public class ControllerTest {
private Controller controller;
private Position position1;
private Position position2;
private long t1;
private long t2;
@Before
public void setUp() {
controller = new Controller(35.0);
Calendar cal = Calendar.getInstance();
cal.set(2012, Calendar.JANUARY, 1, 1, 1, 0);
Date d1, d2;
d1 = cal.getTime();
t1 = d1.getTime();
cal.set(2012, Calendar.JANUARY, 1, 1, 1, 2);
d2 = cal.getTime();
t2 = d2.getTime();
}
@Test
public void testCalculateUnderThreshold() {
position1 = new Position(0, t1, 10, 10, 10);
position2 = new Position(0, t2, 20, 20, 20);
double ex = Math.sqrt(pow(position2.getxPos() - position1.getxPos(), 2) +
pow(position2.getyPos() - position1.getyPos(), 2) +
pow(position2.getzPos() - position1.getzPos(), 2));
int expected = (int) ex;
Acceleration acceleration = null;
try {
acceleration = controller.calculate(position1, position2);
} catch (ThresholdException e) {
fail("Threshold calculation threw unexpected exception during calculation: " +
e.getLocalizedMessage());
}
assertNotNull("Sensor Database Data was never initialized!", acceleration);
assertEquals("Acceleration sendable calculation was not equal!", expected, acceleration.getAccelMag());
}
@Test
public void testCalculateOverThreshold() {
position1 = new Position(0, t1, 10, 10, 10);
position2 = new Position(0, t2, 50, 50, 50);
Acceleration acceleration = null;
try {
acceleration = controller.calculate(position1, position2);
} catch (ThresholdException e) {
return;
}
fail("Controller should have thrown exception!");
}
@Test
public void testSendAndReceive() throws Exception {
// Run the main controller
ControllerRunner controllerRunner = new ControllerRunner(10, 9090, InetAddress.getLocalHost(), "127.0.0.1", 8008);
controllerRunner.run();
System.out.println("Controller running");
Random random = new Random();
int player = random.nextInt();
// Connect a new controller and send test alarm
Controller controller = new Controller(10);
Socket connection1 = controller.connectTo(InetAddress.getLocalHost().getHostAddress(), 9090);
Alarm alarm = new Alarm(player, System.currentTimeMillis(), new PlayerCause(player));
controller.send(alarm, connection1);
Controller controller2 = new Controller(10);
Socket connection2 = controller2.connectTo(InetAddress.getLocalHost().getHostAddress(), 9090);
long alarmtime = System.currentTimeMillis() + 500;
Position position1 = new Position(player, System.currentTimeMillis(), 1, 2, 3);
Position position2 = new Position(player, alarmtime, 100, 200, 300);
controller2.send(position1, connection2);
controller2.send(position2, connection2);
controller2.send(new Request(player, DataType.ACCEL, -1, -1), connection2);
controller2.send(new Request(player, DataType.POS, -1, -1), connection2);
Thread.sleep(15000);
List<Sendable> received = controller2.receive(connection2);
List<Alarm> alarms = new ArrayList<Alarm>();
List<Acceleration> accelerations = new ArrayList<Acceleration>();
List<Position> positions = new ArrayList<Position>();
// Distribute the sendable objects
for (Sendable sendable : received) {
if (sendable instanceof Alarm) {
alarms.add((Alarm) sendable);
} else if (sendable instanceof Service) {
Service service = (Service) sendable;
List<?> data = service.getData();
for (Object o : data) {
if (o instanceof Acceleration) {
accelerations.add((Acceleration) o);
} else if (o instanceof Position) {
positions.add((Position) o);
}
}
}
}
controller.disconnectFromClient(connection1);
controller2.disconnectFromClient(connection2);
assertTrue("Alarm was not sent from controller", alarms.size() >= 1);
assertTrue("Acceleration not received from controller", accelerations.size() >= 1);
assertTrue("Position 1 not contained in received positions", positions.contains(position1));
assertTrue("Position 2 not contained in received positions", positions.contains(position2));
}
}
| 5,388 | 0.636229 | 0.606533 | 147 | 35.653061 | 28.942507 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false | 12 |
1d1396374acd203ec8c035cd5eca518337174b53 | 20,109,036,894,738 | bcc01979955c8f8a6e589d5d77fda5347e794dc7 | /proj-java/src/main/java/engine/TCD_Community.java | c73cd22f92656a9aa797499ae4d358cfee34a4f8 | [] | no_license | catarinamachado/LI3 | https://github.com/catarinamachado/LI3 | 0aefd2f44898c6197ba3d0f65bf74bb65609f9d3 | a82190ed8b35a639e7863590ee37acc091db13bd | refs/heads/master | 2021-07-14T00:03:17.479000 | 2019-03-11T22:21:37 | 2019-03-11T22:21:37 | 138,612,945 | 0 | 1 | null | false | 2018-10-17T19:52:08 | 2018-06-25T15:20:47 | 2018-07-19T08:34:55 | 2018-10-17T19:52:08 | 1,568 | 0 | 0 | 0 | Java | false | null | package engine;
/**
* Estrutura de dados principal do programa.
*
* @author A81047
* @author A34900
* @author A82339
* @version 20180519
*/
import java.util.*;
import java.util.stream.Collectors;
import java.util.function.Supplier;
import common.*;
import li3.TADCommunity;
import org.xml.sax.SAXException;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import java.time.LocalDate;
public class TCD_Community implements TADCommunity {
private Map<Long, Users> users;
private Map<Long, Posts> posts;
private Set<Question> questionsSet;
private Set<Users> usersSet;
private List<Long> usersPostList;
private Map<LocalDate, Day> days;
private Map<String, Long> tags;
/**
* Construtor vazio.
*
*/
public TCD_Community() {
users = new HashMap<>();
posts = new HashMap<>();
questionsSet = null;
usersSet = null;
usersPostList = null;
days = new HashMap<>();
tags = new HashMap<>();
}
/**
* Construtor parametrizado.
*
* @param users - HashMap que armazena os utilizadores.
* @param posts - HashMap que armazena os posts.
* @param questionsSet - Set que armazena perguntas.
* @param usersSet - Set que armazena utilizadores.
* @param usersPostList - Lista que armazena os identificadors dos Users.
* @param tags - HashMap que armazena as tags.
*/
public TCD_Community(Map<Long, Users> users, Map<Long, Posts> posts,
Set<Question> questionsSet,Set<Users> usersSet,
List<Long> usersPostList, Map<LocalDate,
Day> days, Map<String, Long> tags) {
setMapUsers(users);
setMapPosts(posts);
setQuestionsSet(questionsSet);
setUsersSet(usersSet);
setUsersPostList(usersPostList);
setDays(days);
setMapTags(tags);
}
/**
* Construtor cópia.
* @param community - Estrutra de dados TCD_Community
*/
public TCD_Community(TCD_Community community) {
this.users = community.getMapUsers();
this.posts = community.getMapPosts();
this.questionsSet = community.getQuestionsSet();
this.usersSet = community.getUsersSet();
this.usersPostList = community.getUsersPostList();
this.days = community.getDays();
this.tags = community.getMapTags();
}
/**
* Função que devolve o apontador para a HashMap users
*
* @returns Map<Long, Users> - a HashMap users
*/
public Map<Long, Users> getMapUsers() {
return users.entrySet().stream().collect(Collectors.toMap(k -> k.getKey(), u -> u.getValue().clone()));
}
/**
* Função que estabelece a HashMap users
*
* @param users - Map dos users
*/
public void setMapUsers(Map<Long, Users> users) {
this.users = users.entrySet().stream().collect(Collectors.toMap(k -> k.getKey(), u -> u.getValue().clone()));
}
/**
* Função que devolve o apontador para a HashMap posts
*
* @returns Map<Long, Posts> - a HashMap posts
*/
public Map<Long, Posts> getMapPosts() {
return posts.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), q -> q.getValue().clone()));
}
/**
* Função que estabelece a HashMap posts
*
* @param posts - Map das posts
*/
public void setMapPosts(Map<Long, Posts> posts) {
this.posts = posts.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), q -> q.getValue().clone()));
}
/**
* Função que devolve o apontador para o Set questionsSet
*
* @returns Set<Questions> - o set das perguntas
*/
public Set<Question> getQuestionsSet() {
return questionsSet.stream().map(Question :: clone).collect(Collectors.toSet());
}
/**
* Função que estabelece o apontador para o Set questionsSet
*
* @param questionsSet - o set das perguntas
*/
public void setQuestionsSet(Set<Question> questionsSet) {
this.questionsSet = questionsSet.stream().
map(Question :: clone).collect(Collectors.toSet());
}
/**
* Função que devolve o apontador para o Set usersSet
*
* @returns Set<Users> - o set dos users
*/
public Set<Users> getUsersSet() {
return usersSet.stream().
map(Users :: clone).collect(Collectors.toSet());
}
/**
* Função que estabelece o apontador para o Set usersSet
*
* @param usersSet - set dos utilizadores
*/
public void setUsersSet(Set<Users> usersSet) {
this.usersSet = usersSet.stream().
map(Users :: clone).collect(Collectors.toSet());
}
/**
* Função que devolve o apontador para a lista de usersPostList.
*
* @returns List<Long> - lista com os ids dos users.
*/
public List<Long> getUsersPostList() {
return usersPostList.stream().collect(Collectors.toCollection(ArrayList :: new));
}
/**
* Função que estabelece o apontador para a lista de usersPostList.
*
* @param usersPostList- lista dos ids dos utilizadores
*/
public void setUsersPostList(List<Long> usersPostList) {
this.usersPostList = usersPostList.stream().collect(Collectors.toList());
}
/**
* Função que devolve o apontador para a HashMap tags
*
* @returns Map<String, Long> - a HashMap tags
*/
public Map<String, Long> getMapTags() {
return tags.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), t -> t.getValue()));
}
/**
* Função que estabelece a HashMap tags
*
* @param tags - Map das tags
*/
public void setMapTags(Map<String, Long> tags) {
this.tags = tags.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), t -> t.getValue()));
}
/**
* Função que devolve o apontador para a HashMap days
*
* @returns Map<LocalDate, Day> - a HashMap days
*/
public Map<LocalDate, Day> getDays() {
return days; //por questões de performance
}
/**
* Função que estabelece a HashMap days
*
* @param days - Map days
*/
public void setDays(Map<LocalDate, Day> days) {
this.days = days.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), t -> t.getValue().clone()));
}
/**
* Método que faz uma cópia de TCD_Community
* Para tal invoca o construtor de cópia.
*
* @return cópia de TCD_Community
*/
public TCD_Community clone() {
return new TCD_Community (this);
}
/**
* Método que devolve a representação em String de TCD_Community.
*
* @return String que representa uma TCD_Community
*/
public String toString() {
return "TCD_Community{" +
", users = " + users +
", posts = " + posts +
", questionsSet = " + questionsSet.toString() +
", usersSet = " + usersSet.toString() +
", usersPostList = " + usersPostList.toString() +
", days = " + days.toString() +
", tags = " + tags +
'}';
}
/**
* Método que determina se dois TCD_Community objeto são iguais.
*
* @param object Objecto a ser usado como termo de comparação.
*
* @return Boolean indicando se os dois objetos são iguais
*/
public boolean equals(Object object) {
if (this == object)
return true;
if (object == null || (this.getClass() != object.getClass()))
return false;
TCD_Community com = (TCD_Community) object;
return (this.users.equals(com.getMapUsers()) &&
this.posts.equals(com.getMapPosts()) &&
this.questionsSet.equals(com.getQuestionsSet()) &&
this.usersSet.equals(com.getUsersSet()) &&
this.days.equals(com.getDays()) &&
this.tags.equals(com.getMapTags()));
}
/**
* Método que verifica se um post existe em posts.
*
* @return Posts um post
*/
public Posts lookPost(long id) {
return posts.get(id);
}
/**
* Método que verifica se um user existe em users.
*
* @return Users um user
*/
public Users lookUser(long id) {
return users.get(id);
}
/**
* Método que verifica se um day existe em days.
*
* @return Users um user
*/
public Day lookDay(LocalDate date) {
return days.get(date);
}
/**
* Método que insere um post na HashMap posts.
*
* @param p - Um post.
*
*/
public void insertPost(Posts p) {
posts.put(p.getPostId(), p);
}
/**
* Método que insere um user numa HashMap.
*
* @param u - Um user.
*
*/
public void insertUser(Users u) {
users.put(u.getUsersId(), u);
}
/**
* Método que insere um day numa HashMap.
*
* @param d Dia.
* @param ld LocalDate do dia.
*
*/
public void insertDay(Day d, LocalDate ld) {
days.put(ld, d);
}
/**
* Método que insere uma tag numa HashMap.
*
* @param name_tag - nome da Tag.
* @param id_tag - identificador da Tag.
*
*/
public void insertTag(String name_tag, long id_tag) {
tags.put(name_tag, id_tag);
}
/**
* Método que preenche o questionsSet (de perguntas) ordenado por data.
*
*/
public void initQSet() {
if (questionsSet == null) {
Supplier<TreeSet<Question>> supplier = () -> new TreeSet<Question>(new PostComparator());
questionsSet = posts.values().stream().filter(p -> (p.getPostType() == 1)).map( p -> (Question)p).
collect(Collectors.toCollection(supplier));
}
}
/**
* Método que preenche o usersSet (de users) ordenado por reputação.
*
*/
public void initUSet() {
if (usersSet == null) {
usersSet = new TreeSet<>(new UsersComparator());
Iterator<Users> it = users.values().iterator();
while (it.hasNext())
usersSet.add(it.next());
}
}
/**
* Método que preenche o usersPostsList (de identificadores de users)
* ordenado por número de posts.
*
*/
public void initUsersPostsList() {
if (usersPostList == null) {
usersPostList = users.values().stream().
sorted(new NumeroPostsComparador()).
map(u -> u.getUsersId()).
collect(Collectors.toCollection(ArrayList::new));
}
}
/**
* Método que faz o parser dos ficheiros xml.
*
* @param dumpPath - caminho para o ficheiro xml.
*/
public void load(String dumpPath) throws SAXException, ParserConfigurationException, IOException {
Load load = new Load();
load.lerFicheiros(this, dumpPath);
}
/**
* QUERY 1
*
* Dado o identificador de um post, o método retorna
* o título do post e o nome (não o ID) de utilizador do autor.
* Caso o post não possua título ou nome de utilizador, o resultado
* correspondente deverá ser NULL.
* Se o post for uma resposta, a função retorna informações
* (título e utilizador) da pergunta correspondente.
* Acresce que se o id passado como parametro não for id de nenhum post
* devolve NULL.
*
*
* @param id - id do post
*
* @returns Pair<String, String> - título e o nome do autor do pergunta
*
* @throws NoPostIdException
*/
public Pair<String,String> infoFromPost(long id) throws NoPostIdException {
long userId;
long parentId;
String title, username;
Answer resposta = null;
Question pergunta = null;
Posts post = lookPost(id);
if(post == null) {
throw new NoPostIdException(id + " não identifica uma pergunta nem uma resposta");
}
if (post.getPostType() == 2) {
resposta = (Answer) post;
parentId = resposta.getParentId();
pergunta = (Question) lookPost(parentId);
}
else {
pergunta = (Question) post;
}
userId = pergunta.getUserId();
Users user = lookUser(userId);
if (user == null) {
return new Pair<>("null","null");
}
title = pergunta.getTitle();
username = user.getUserName();
if (title != null && username != null) {
return new Pair<>(title, username);
}
return new Pair<>("null","null");
}
/**
* QUERY 2
*
* Método que devolve o top N utilizadores com maior número
* de posts de sempre. Para isto, são considerados tanto perguntas
* quanto respostas dadas pelo respectivo utilizador.
*
* @param N Número de utilizadores com mais posts.
*
* @returns List<Long> - lista com os ids dos N utilizadores com mais posts publicados
*/
public List<Long> topMostActive(int N) {
initUsersPostsList();
return usersPostList.stream().limit(N).collect(Collectors.toCollection(ArrayList::new));
}
/**
* QUERY 3
*
* Dado um intervalo de tempo arbitrário,
* obtem o nú́mero total de posts
* (identificando perguntas e respostas separadamente) neste período.
*
* @param begin - data inicial
* @param end - data final
*
* @returns Pair<Long,Long> - número de perguntas e número de respostas
*/
public Pair<Long,Long> totalPosts(LocalDate begin, LocalDate end) {
long number_q = 0;
long number_p = 0;
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
number_q += d.getN_questions();
number_p += d.getN_answers();
}
begin = begin.plusDays(1);
}
}
return new Pair<Long, Long>(number_q, number_p);
}
/**
* QUERY 4
*
* Dado um intervalo de tempo arbitrário, retorna todas
* as perguntas contendo uma determinada tag.
* O retorno do método é uma lista com os IDs
* das perguntas ordenadas em cronologia inversa
* (a pergunta mais recente no início da lista).
*
* @param tag - tag procurada
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - IDs das perguntas
*/
public List<Long> questionsWithTag(String tag, LocalDate begin, LocalDate end) {
List<Long> resp = new ArrayList<>();
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!end.equals(begin.plusDays(-1))){
d = days.get(end);
if(d != null){
for(Question q: d.getQuestions()){
if(q.getTags().contains(tag))
resp.add(q.getPostId());
}
}
end = end.plusDays(-1);
}
}
return resp;
}
/**
* QUERY 5
*
* Dado um ID de utilizador, devolver a informação do
* seu perfil (short bio) e os IDs dos seus 10 últimos posts,
* ordenados por cronologia inversa;
*
* @param id - User id
*
* @returns List<Long> - IDs das perguntas
*/
public Pair<String, List<Long>> getUserInfo(long id) throws NoUserIdException {
if(!users.containsKey(id))
throw new NoUserIdException(Long.toString(id));
Users u = users.get(id);
String shortBio = u.getUserBio();
List<Long> ids = u.getPosts()
.stream()
.sorted(new PostComparator())
.limit(10)
.map(q -> q.getPostId())
.collect(Collectors.toList());
return new Pair<>(shortBio,ids);
}
/**
* QUERY 6
*
* Dado um intervalo de tempo arbitrário,
* devolve os IDs das N respostas com mais votos,
* em ordem decrescente do número de votos.
*
* @param N - número de respostas procuradas
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - IDs das respostas
*/
public List<Long> mostVotedAnswers(int N, LocalDate begin, LocalDate end) throws IndexOutOfBoundsException {
List<Answer> as = new ArrayList<>();
List<Long> ids = new ArrayList<>();
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
for(Answer a: d.getAnswers())
as.add(a);
}
begin = begin.plusDays(1);
}
}
else
return ids;
as.sort(new NumeroVotosRespostas());
as = as.subList(0, N);
Iterator<Answer> it = as.iterator();
while (it.hasNext()) {
Answer a = it.next();
ids.add(a.getPostId());
}
return ids;
}
/**
* QUERY 7
*
* Dado um intervalo de tempo arbitrário,
* devolve as IDs das N perguntas com mais respostas,
* em ordem decrescente do nú́mero de respostas.
*
* @param N - número de perguntas procuradas
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - IDs das perguntas
*/
public List<Long> mostAnsweredQuestions(int N, LocalDate begin, LocalDate end) {
List<Question> qs = new ArrayList<>();
List<Long> ids = new ArrayList<>();
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
for(Question q: d.getQuestions())
qs.add(q);
}
begin = begin.plusDays(1);
}
}
else
return ids;
qs.sort(new NumeroRespostasPergunta());
qs = qs.subList(0, N);
Iterator<Question> it = qs.iterator();
while (it.hasNext()) {
Question q = it.next();
ids.add(q.getPostId());
}
return ids;
}
/**
* QUERY 8
*
* Dado uma palavra, devolver uma lista com os IDs de
* N perguntas cujos títulos a contenham, ordenados por cronologia inversa
*
* @param N - número de perguntas
* @param word - palavra a verificar
*
* @return List<Long> - IDs das perguntas
*/
public List<Long> containsWord(int N, String word) {
initQSet();
return questionsSet
.stream()
.filter(q -> q.getTitle().contains(word))
.limit(N)
.map(Question::getPostId)
.collect(Collectors.toList());
}
private boolean participateAnswers(Question q, long id) {
return q.getAnswers()
.stream()
.anyMatch(quest -> quest.getUserId() == id);
}
/**
* QUERY 9
*
* Dados os IDs de dois utilizadores, devolver as últimas
* N perguntas (cronologia inversa) em que participaram dois utilizadores
* específicos.
*
* @param N - número de ocorrências
* @param id1 - utilizador 1
* @param id2 - utilizador 2
*
* @return List<Long> - IDs das perguntas
*/
public List<Long> bothParticipated(int N, long id1, long id2) {
initQSet();
List<Long> ret = new ArrayList<>(N);
boolean id1P, id2P;
long uid;
Iterator<Question> it = questionsSet.iterator();
for (int i = 0; i < N && it.hasNext();) {
Question q = it.next();
uid = q.getUserId();
if(uid == id1)
id1P = true;
else
id1P = participateAnswers(q, id1);
if(id1P) {
if(uid == id2)
id2P = true;
else
id2P = participateAnswers(q, id2);
if(id2P) {
ret.add(q.getPostId());
i++;
}
}
}
return ret;
}
/**
* QUERY 10
*
* Dado o ID de uma pergunta, obtem a melhor resposta.
* Para isso, usa a função de média ponderada abaixo:
* (score da resposta × 0.45) + (reputação do utilizador × 0.25) +
* (número de votos recebidos pela resposta × 0.2) +
* (número de comentários recebidos pela resposta × 0.1)
*
* Caso a pergunta não tenha nenhuma resposta ou o id passado como
* parametro não identifique uma pergunta o método devolverá -1.
*
* @param id - id da pergunta
*
* @returns long - id da resposta
*
* @throws NoAnswersException, NoQuestionIdException
*/
public long betterAnswer(long id) throws NoAnswersException, NoQuestionIdException {
int i, total_answers, reputation, score, commentCount;
long answerId = -1;
double total, max = 0.0;
Question pergunta;
Answer resposta;
Posts post = lookPost(id);
if(post == null || (post.getPostType() != 1)) {
throw new NoQuestionIdException("O id " + id + " não pertence a uma pergunta.");
}
pergunta = (Question)post;
total_answers = pergunta.getNAnswers();
if(total_answers == 0) {
throw new NoAnswersException("A pergunta não tem nenhuma resposta.");
}
for(i = 0; i < total_answers; i++) {
resposta = pergunta.getAnswers().get(i);
Users user = lookUser(resposta.getUserId());
if(user == null) {
reputation = 0;
}
else {
reputation = user.getReputation();
}
score = resposta.getScore();
commentCount = resposta.getCommentCount();
total = score * 0.65 + reputation * 0.25 + commentCount * 0.1;
if(total > max) {
max = total;
answerId = resposta.getPostId();
}
}
return answerId;
}
/**
* QUERY 11
*
* Dado um intervalo arbitrário de tempo,
* devolve as N tags mais usadas pelos N utilizadores
* com melhor reputação, em ordem decrescente do
* nú́mero de vezes em que a tag foi usada.
*
* @param N - número de tags e utilizadores procurados
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - Identificadores das tags
* @throws IllegalArgumentException, IndexOutOfBoundsException
*/
public List<Long> mostUsedBestRep(int N, LocalDate begin, LocalDate end) throws IllegalArgumentException, IndexOutOfBoundsException {
initUSet();
List<Long> ident_tags = new ArrayList<>();
Day d;
Map<Long, Users> users_rep = usersSet.stream()
.limit(N)
.collect(Collectors.toMap(u -> u.getUsersId(), u -> u));
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
for(Question q: d.getQuestions()){
if(users_rep.get(q.getUserId()) != null){
String tag = q.getTags();
String[] parts = tag.split("[><]");
for(int i = 1; i < parts.length; i++){
if(tags.get(parts[i]) != null)
ident_tags.add(tags.get(parts[i]));
i++;
}
}
}
}
begin = begin.plusDays(1);
}
}
else
return ident_tags;
Map<Long, Long> maptags =
ident_tags.stream()
.collect(Collectors.groupingBy(e -> e, Collectors.counting()));
return maptags.entrySet().stream()
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
.map(Map.Entry::getKey)
.collect(Collectors.toList()).subList(0,N);
}
/**
* Limpa a memória utilizada.
*/
public void clear(){
}
}
| UTF-8 | Java | 25,542 | java | TCD_Community.java | Java | [
{
"context": "tura de dados principal do programa.\n *\n * @author A81047\n * @author A34900\n * @author A82339\n * @version 2",
"end": 86,
"score": 0.9996140599250793,
"start": 80,
"tag": "USERNAME",
"value": "A81047"
},
{
"context": "cipal do programa.\n *\n * @author A81047\n * @a... | null | [] | package engine;
/**
* Estrutura de dados principal do programa.
*
* @author A81047
* @author A34900
* @author A82339
* @version 20180519
*/
import java.util.*;
import java.util.stream.Collectors;
import java.util.function.Supplier;
import common.*;
import li3.TADCommunity;
import org.xml.sax.SAXException;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import java.time.LocalDate;
public class TCD_Community implements TADCommunity {
private Map<Long, Users> users;
private Map<Long, Posts> posts;
private Set<Question> questionsSet;
private Set<Users> usersSet;
private List<Long> usersPostList;
private Map<LocalDate, Day> days;
private Map<String, Long> tags;
/**
* Construtor vazio.
*
*/
public TCD_Community() {
users = new HashMap<>();
posts = new HashMap<>();
questionsSet = null;
usersSet = null;
usersPostList = null;
days = new HashMap<>();
tags = new HashMap<>();
}
/**
* Construtor parametrizado.
*
* @param users - HashMap que armazena os utilizadores.
* @param posts - HashMap que armazena os posts.
* @param questionsSet - Set que armazena perguntas.
* @param usersSet - Set que armazena utilizadores.
* @param usersPostList - Lista que armazena os identificadors dos Users.
* @param tags - HashMap que armazena as tags.
*/
public TCD_Community(Map<Long, Users> users, Map<Long, Posts> posts,
Set<Question> questionsSet,Set<Users> usersSet,
List<Long> usersPostList, Map<LocalDate,
Day> days, Map<String, Long> tags) {
setMapUsers(users);
setMapPosts(posts);
setQuestionsSet(questionsSet);
setUsersSet(usersSet);
setUsersPostList(usersPostList);
setDays(days);
setMapTags(tags);
}
/**
* Construtor cópia.
* @param community - Estrutra de dados TCD_Community
*/
public TCD_Community(TCD_Community community) {
this.users = community.getMapUsers();
this.posts = community.getMapPosts();
this.questionsSet = community.getQuestionsSet();
this.usersSet = community.getUsersSet();
this.usersPostList = community.getUsersPostList();
this.days = community.getDays();
this.tags = community.getMapTags();
}
/**
* Função que devolve o apontador para a HashMap users
*
* @returns Map<Long, Users> - a HashMap users
*/
public Map<Long, Users> getMapUsers() {
return users.entrySet().stream().collect(Collectors.toMap(k -> k.getKey(), u -> u.getValue().clone()));
}
/**
* Função que estabelece a HashMap users
*
* @param users - Map dos users
*/
public void setMapUsers(Map<Long, Users> users) {
this.users = users.entrySet().stream().collect(Collectors.toMap(k -> k.getKey(), u -> u.getValue().clone()));
}
/**
* Função que devolve o apontador para a HashMap posts
*
* @returns Map<Long, Posts> - a HashMap posts
*/
public Map<Long, Posts> getMapPosts() {
return posts.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), q -> q.getValue().clone()));
}
/**
* Função que estabelece a HashMap posts
*
* @param posts - Map das posts
*/
public void setMapPosts(Map<Long, Posts> posts) {
this.posts = posts.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), q -> q.getValue().clone()));
}
/**
* Função que devolve o apontador para o Set questionsSet
*
* @returns Set<Questions> - o set das perguntas
*/
public Set<Question> getQuestionsSet() {
return questionsSet.stream().map(Question :: clone).collect(Collectors.toSet());
}
/**
* Função que estabelece o apontador para o Set questionsSet
*
* @param questionsSet - o set das perguntas
*/
public void setQuestionsSet(Set<Question> questionsSet) {
this.questionsSet = questionsSet.stream().
map(Question :: clone).collect(Collectors.toSet());
}
/**
* Função que devolve o apontador para o Set usersSet
*
* @returns Set<Users> - o set dos users
*/
public Set<Users> getUsersSet() {
return usersSet.stream().
map(Users :: clone).collect(Collectors.toSet());
}
/**
* Função que estabelece o apontador para o Set usersSet
*
* @param usersSet - set dos utilizadores
*/
public void setUsersSet(Set<Users> usersSet) {
this.usersSet = usersSet.stream().
map(Users :: clone).collect(Collectors.toSet());
}
/**
* Função que devolve o apontador para a lista de usersPostList.
*
* @returns List<Long> - lista com os ids dos users.
*/
public List<Long> getUsersPostList() {
return usersPostList.stream().collect(Collectors.toCollection(ArrayList :: new));
}
/**
* Função que estabelece o apontador para a lista de usersPostList.
*
* @param usersPostList- lista dos ids dos utilizadores
*/
public void setUsersPostList(List<Long> usersPostList) {
this.usersPostList = usersPostList.stream().collect(Collectors.toList());
}
/**
* Função que devolve o apontador para a HashMap tags
*
* @returns Map<String, Long> - a HashMap tags
*/
public Map<String, Long> getMapTags() {
return tags.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), t -> t.getValue()));
}
/**
* Função que estabelece a HashMap tags
*
* @param tags - Map das tags
*/
public void setMapTags(Map<String, Long> tags) {
this.tags = tags.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), t -> t.getValue()));
}
/**
* Função que devolve o apontador para a HashMap days
*
* @returns Map<LocalDate, Day> - a HashMap days
*/
public Map<LocalDate, Day> getDays() {
return days; //por questões de performance
}
/**
* Função que estabelece a HashMap days
*
* @param days - Map days
*/
public void setDays(Map<LocalDate, Day> days) {
this.days = days.entrySet().stream().
collect(Collectors.toMap(k -> k.getKey(), t -> t.getValue().clone()));
}
/**
* Método que faz uma cópia de TCD_Community
* Para tal invoca o construtor de cópia.
*
* @return cópia de TCD_Community
*/
public TCD_Community clone() {
return new TCD_Community (this);
}
/**
* Método que devolve a representação em String de TCD_Community.
*
* @return String que representa uma TCD_Community
*/
public String toString() {
return "TCD_Community{" +
", users = " + users +
", posts = " + posts +
", questionsSet = " + questionsSet.toString() +
", usersSet = " + usersSet.toString() +
", usersPostList = " + usersPostList.toString() +
", days = " + days.toString() +
", tags = " + tags +
'}';
}
/**
* Método que determina se dois TCD_Community objeto são iguais.
*
* @param object Objecto a ser usado como termo de comparação.
*
* @return Boolean indicando se os dois objetos são iguais
*/
public boolean equals(Object object) {
if (this == object)
return true;
if (object == null || (this.getClass() != object.getClass()))
return false;
TCD_Community com = (TCD_Community) object;
return (this.users.equals(com.getMapUsers()) &&
this.posts.equals(com.getMapPosts()) &&
this.questionsSet.equals(com.getQuestionsSet()) &&
this.usersSet.equals(com.getUsersSet()) &&
this.days.equals(com.getDays()) &&
this.tags.equals(com.getMapTags()));
}
/**
* Método que verifica se um post existe em posts.
*
* @return Posts um post
*/
public Posts lookPost(long id) {
return posts.get(id);
}
/**
* Método que verifica se um user existe em users.
*
* @return Users um user
*/
public Users lookUser(long id) {
return users.get(id);
}
/**
* Método que verifica se um day existe em days.
*
* @return Users um user
*/
public Day lookDay(LocalDate date) {
return days.get(date);
}
/**
* Método que insere um post na HashMap posts.
*
* @param p - Um post.
*
*/
public void insertPost(Posts p) {
posts.put(p.getPostId(), p);
}
/**
* Método que insere um user numa HashMap.
*
* @param u - Um user.
*
*/
public void insertUser(Users u) {
users.put(u.getUsersId(), u);
}
/**
* Método que insere um day numa HashMap.
*
* @param d Dia.
* @param ld LocalDate do dia.
*
*/
public void insertDay(Day d, LocalDate ld) {
days.put(ld, d);
}
/**
* Método que insere uma tag numa HashMap.
*
* @param name_tag - nome da Tag.
* @param id_tag - identificador da Tag.
*
*/
public void insertTag(String name_tag, long id_tag) {
tags.put(name_tag, id_tag);
}
/**
* Método que preenche o questionsSet (de perguntas) ordenado por data.
*
*/
public void initQSet() {
if (questionsSet == null) {
Supplier<TreeSet<Question>> supplier = () -> new TreeSet<Question>(new PostComparator());
questionsSet = posts.values().stream().filter(p -> (p.getPostType() == 1)).map( p -> (Question)p).
collect(Collectors.toCollection(supplier));
}
}
/**
* Método que preenche o usersSet (de users) ordenado por reputação.
*
*/
public void initUSet() {
if (usersSet == null) {
usersSet = new TreeSet<>(new UsersComparator());
Iterator<Users> it = users.values().iterator();
while (it.hasNext())
usersSet.add(it.next());
}
}
/**
* Método que preenche o usersPostsList (de identificadores de users)
* ordenado por número de posts.
*
*/
public void initUsersPostsList() {
if (usersPostList == null) {
usersPostList = users.values().stream().
sorted(new NumeroPostsComparador()).
map(u -> u.getUsersId()).
collect(Collectors.toCollection(ArrayList::new));
}
}
/**
* Método que faz o parser dos ficheiros xml.
*
* @param dumpPath - caminho para o ficheiro xml.
*/
public void load(String dumpPath) throws SAXException, ParserConfigurationException, IOException {
Load load = new Load();
load.lerFicheiros(this, dumpPath);
}
/**
* QUERY 1
*
* Dado o identificador de um post, o método retorna
* o título do post e o nome (não o ID) de utilizador do autor.
* Caso o post não possua título ou nome de utilizador, o resultado
* correspondente deverá ser NULL.
* Se o post for uma resposta, a função retorna informações
* (título e utilizador) da pergunta correspondente.
* Acresce que se o id passado como parametro não for id de nenhum post
* devolve NULL.
*
*
* @param id - id do post
*
* @returns Pair<String, String> - título e o nome do autor do pergunta
*
* @throws NoPostIdException
*/
public Pair<String,String> infoFromPost(long id) throws NoPostIdException {
long userId;
long parentId;
String title, username;
Answer resposta = null;
Question pergunta = null;
Posts post = lookPost(id);
if(post == null) {
throw new NoPostIdException(id + " não identifica uma pergunta nem uma resposta");
}
if (post.getPostType() == 2) {
resposta = (Answer) post;
parentId = resposta.getParentId();
pergunta = (Question) lookPost(parentId);
}
else {
pergunta = (Question) post;
}
userId = pergunta.getUserId();
Users user = lookUser(userId);
if (user == null) {
return new Pair<>("null","null");
}
title = pergunta.getTitle();
username = user.getUserName();
if (title != null && username != null) {
return new Pair<>(title, username);
}
return new Pair<>("null","null");
}
/**
* QUERY 2
*
* Método que devolve o top N utilizadores com maior número
* de posts de sempre. Para isto, são considerados tanto perguntas
* quanto respostas dadas pelo respectivo utilizador.
*
* @param N Número de utilizadores com mais posts.
*
* @returns List<Long> - lista com os ids dos N utilizadores com mais posts publicados
*/
public List<Long> topMostActive(int N) {
initUsersPostsList();
return usersPostList.stream().limit(N).collect(Collectors.toCollection(ArrayList::new));
}
/**
* QUERY 3
*
* Dado um intervalo de tempo arbitrário,
* obtem o nú́mero total de posts
* (identificando perguntas e respostas separadamente) neste período.
*
* @param begin - data inicial
* @param end - data final
*
* @returns Pair<Long,Long> - número de perguntas e número de respostas
*/
public Pair<Long,Long> totalPosts(LocalDate begin, LocalDate end) {
long number_q = 0;
long number_p = 0;
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
number_q += d.getN_questions();
number_p += d.getN_answers();
}
begin = begin.plusDays(1);
}
}
return new Pair<Long, Long>(number_q, number_p);
}
/**
* QUERY 4
*
* Dado um intervalo de tempo arbitrário, retorna todas
* as perguntas contendo uma determinada tag.
* O retorno do método é uma lista com os IDs
* das perguntas ordenadas em cronologia inversa
* (a pergunta mais recente no início da lista).
*
* @param tag - tag procurada
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - IDs das perguntas
*/
public List<Long> questionsWithTag(String tag, LocalDate begin, LocalDate end) {
List<Long> resp = new ArrayList<>();
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!end.equals(begin.plusDays(-1))){
d = days.get(end);
if(d != null){
for(Question q: d.getQuestions()){
if(q.getTags().contains(tag))
resp.add(q.getPostId());
}
}
end = end.plusDays(-1);
}
}
return resp;
}
/**
* QUERY 5
*
* Dado um ID de utilizador, devolver a informação do
* seu perfil (short bio) e os IDs dos seus 10 últimos posts,
* ordenados por cronologia inversa;
*
* @param id - User id
*
* @returns List<Long> - IDs das perguntas
*/
public Pair<String, List<Long>> getUserInfo(long id) throws NoUserIdException {
if(!users.containsKey(id))
throw new NoUserIdException(Long.toString(id));
Users u = users.get(id);
String shortBio = u.getUserBio();
List<Long> ids = u.getPosts()
.stream()
.sorted(new PostComparator())
.limit(10)
.map(q -> q.getPostId())
.collect(Collectors.toList());
return new Pair<>(shortBio,ids);
}
/**
* QUERY 6
*
* Dado um intervalo de tempo arbitrário,
* devolve os IDs das N respostas com mais votos,
* em ordem decrescente do número de votos.
*
* @param N - número de respostas procuradas
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - IDs das respostas
*/
public List<Long> mostVotedAnswers(int N, LocalDate begin, LocalDate end) throws IndexOutOfBoundsException {
List<Answer> as = new ArrayList<>();
List<Long> ids = new ArrayList<>();
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
for(Answer a: d.getAnswers())
as.add(a);
}
begin = begin.plusDays(1);
}
}
else
return ids;
as.sort(new NumeroVotosRespostas());
as = as.subList(0, N);
Iterator<Answer> it = as.iterator();
while (it.hasNext()) {
Answer a = it.next();
ids.add(a.getPostId());
}
return ids;
}
/**
* QUERY 7
*
* Dado um intervalo de tempo arbitrário,
* devolve as IDs das N perguntas com mais respostas,
* em ordem decrescente do nú́mero de respostas.
*
* @param N - número de perguntas procuradas
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - IDs das perguntas
*/
public List<Long> mostAnsweredQuestions(int N, LocalDate begin, LocalDate end) {
List<Question> qs = new ArrayList<>();
List<Long> ids = new ArrayList<>();
Day d;
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
for(Question q: d.getQuestions())
qs.add(q);
}
begin = begin.plusDays(1);
}
}
else
return ids;
qs.sort(new NumeroRespostasPergunta());
qs = qs.subList(0, N);
Iterator<Question> it = qs.iterator();
while (it.hasNext()) {
Question q = it.next();
ids.add(q.getPostId());
}
return ids;
}
/**
* QUERY 8
*
* Dado uma palavra, devolver uma lista com os IDs de
* N perguntas cujos títulos a contenham, ordenados por cronologia inversa
*
* @param N - número de perguntas
* @param word - palavra a verificar
*
* @return List<Long> - IDs das perguntas
*/
public List<Long> containsWord(int N, String word) {
initQSet();
return questionsSet
.stream()
.filter(q -> q.getTitle().contains(word))
.limit(N)
.map(Question::getPostId)
.collect(Collectors.toList());
}
private boolean participateAnswers(Question q, long id) {
return q.getAnswers()
.stream()
.anyMatch(quest -> quest.getUserId() == id);
}
/**
* QUERY 9
*
* Dados os IDs de dois utilizadores, devolver as últimas
* N perguntas (cronologia inversa) em que participaram dois utilizadores
* específicos.
*
* @param N - número de ocorrências
* @param id1 - utilizador 1
* @param id2 - utilizador 2
*
* @return List<Long> - IDs das perguntas
*/
public List<Long> bothParticipated(int N, long id1, long id2) {
initQSet();
List<Long> ret = new ArrayList<>(N);
boolean id1P, id2P;
long uid;
Iterator<Question> it = questionsSet.iterator();
for (int i = 0; i < N && it.hasNext();) {
Question q = it.next();
uid = q.getUserId();
if(uid == id1)
id1P = true;
else
id1P = participateAnswers(q, id1);
if(id1P) {
if(uid == id2)
id2P = true;
else
id2P = participateAnswers(q, id2);
if(id2P) {
ret.add(q.getPostId());
i++;
}
}
}
return ret;
}
/**
* QUERY 10
*
* Dado o ID de uma pergunta, obtem a melhor resposta.
* Para isso, usa a função de média ponderada abaixo:
* (score da resposta × 0.45) + (reputação do utilizador × 0.25) +
* (número de votos recebidos pela resposta × 0.2) +
* (número de comentários recebidos pela resposta × 0.1)
*
* Caso a pergunta não tenha nenhuma resposta ou o id passado como
* parametro não identifique uma pergunta o método devolverá -1.
*
* @param id - id da pergunta
*
* @returns long - id da resposta
*
* @throws NoAnswersException, NoQuestionIdException
*/
public long betterAnswer(long id) throws NoAnswersException, NoQuestionIdException {
int i, total_answers, reputation, score, commentCount;
long answerId = -1;
double total, max = 0.0;
Question pergunta;
Answer resposta;
Posts post = lookPost(id);
if(post == null || (post.getPostType() != 1)) {
throw new NoQuestionIdException("O id " + id + " não pertence a uma pergunta.");
}
pergunta = (Question)post;
total_answers = pergunta.getNAnswers();
if(total_answers == 0) {
throw new NoAnswersException("A pergunta não tem nenhuma resposta.");
}
for(i = 0; i < total_answers; i++) {
resposta = pergunta.getAnswers().get(i);
Users user = lookUser(resposta.getUserId());
if(user == null) {
reputation = 0;
}
else {
reputation = user.getReputation();
}
score = resposta.getScore();
commentCount = resposta.getCommentCount();
total = score * 0.65 + reputation * 0.25 + commentCount * 0.1;
if(total > max) {
max = total;
answerId = resposta.getPostId();
}
}
return answerId;
}
/**
* QUERY 11
*
* Dado um intervalo arbitrário de tempo,
* devolve as N tags mais usadas pelos N utilizadores
* com melhor reputação, em ordem decrescente do
* nú́mero de vezes em que a tag foi usada.
*
* @param N - número de tags e utilizadores procurados
* @param begin - data inicial
* @param end - data final
*
* @returns List<Long> - Identificadores das tags
* @throws IllegalArgumentException, IndexOutOfBoundsException
*/
public List<Long> mostUsedBestRep(int N, LocalDate begin, LocalDate end) throws IllegalArgumentException, IndexOutOfBoundsException {
initUSet();
List<Long> ident_tags = new ArrayList<>();
Day d;
Map<Long, Users> users_rep = usersSet.stream()
.limit(N)
.collect(Collectors.toMap(u -> u.getUsersId(), u -> u));
if(begin.isBefore(end.plusDays(1))){
while(!begin.equals(end.plusDays(1))){
d = days.get(begin);
if(d != null){
for(Question q: d.getQuestions()){
if(users_rep.get(q.getUserId()) != null){
String tag = q.getTags();
String[] parts = tag.split("[><]");
for(int i = 1; i < parts.length; i++){
if(tags.get(parts[i]) != null)
ident_tags.add(tags.get(parts[i]));
i++;
}
}
}
}
begin = begin.plusDays(1);
}
}
else
return ident_tags;
Map<Long, Long> maptags =
ident_tags.stream()
.collect(Collectors.groupingBy(e -> e, Collectors.counting()));
return maptags.entrySet().stream()
.sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
.map(Map.Entry::getKey)
.collect(Collectors.toList()).subList(0,N);
}
/**
* Limpa a memória utilizada.
*/
public void clear(){
}
}
| 25,542 | 0.530865 | 0.526577 | 866 | 28.349884 | 24.249258 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.359122 | false | false | 12 |
06bd099121ad89cbdc17532367e0eb570d5f33d8 | 23,845,658,461,303 | 1a61e3c125d8659e2ea030b4ce65d1c9e097d657 | /tb/src/com/tb/web/ImageSwitchController.java | e23e3444ba46112e4780fb498b3b7b3ee20eb9b8 | [] | no_license | pprivulet/TrafficBureau | https://github.com/pprivulet/TrafficBureau | 3a8805b30695b3c6148d323b115a8ec0fd781a43 | 17409bf70b6e3dcca2ae9ccd49fbbe512f282871 | refs/heads/master | 2020-07-05T02:09:53.210000 | 2014-11-18T01:42:45 | 2014-11-18T01:42:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tb.web;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.tb.domain.Phile;
import com.tb.service.PhileService;
@Controller
@RequestMapping("/imageSwitch.html")
public class ImageSwitchController {
@Autowired
private PhileService fileService;
@RequestMapping(method = RequestMethod.GET)
public ModelAndView doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException {
PrintWriter out = response.getWriter();
Random random = new Random();
try {
List<Phile> images = fileService.findByStatus(1, 2);
int id = random.nextInt(images.size());
String path = images.get(id).getPath();
System.out.println(path);
out.write(path);
return null;
} catch (Exception e) {
out.write("error");
return null;
}
}
}
| UTF-8 | Java | 1,233 | java | ImageSwitchController.java | Java | [] | null | [] | package com.tb.web;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Random;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.tb.domain.Phile;
import com.tb.service.PhileService;
@Controller
@RequestMapping("/imageSwitch.html")
public class ImageSwitchController {
@Autowired
private PhileService fileService;
@RequestMapping(method = RequestMethod.GET)
public ModelAndView doPost(HttpServletRequest request,
HttpServletResponse response) throws IOException {
PrintWriter out = response.getWriter();
Random random = new Random();
try {
List<Phile> images = fileService.findByStatus(1, 2);
int id = random.nextInt(images.size());
String path = images.get(id).getPath();
System.out.println(path);
out.write(path);
return null;
} catch (Exception e) {
out.write("error");
return null;
}
}
}
| 1,233 | 0.775345 | 0.773723 | 45 | 26.4 | 19.916939 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.577778 | false | false | 12 |
accfd4823f52183945bc43bb4159953747711ed9 | 33,200,097,201,263 | 0bf783b2a5b580dba45ee26329b85432cc41241d | /src/main/java/com/oas/web/pages/CustomerActivationPage.java | 27e34417fe7ffa4f7ce305fcf42f1036e8c3a802 | [] | no_license | toytown/immo | https://github.com/toytown/immo | 9dd603ee6fbe9df4bf687c1c5f0ab592f8964fcd | f69f6d10775ba58b8faf456bd6727b5f9fb466f1 | refs/heads/master | 2021-01-10T21:31:11.185000 | 2010-12-31T10:58:56 | 2010-12-31T10:58:56 | 1,198,986 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.oas.web.pages;
import org.apache.wicket.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import com.oas.model.Customer;
import com.oas.services.ICustomerService;
public class CustomerActivationPage extends BasePage {
@SpringBean
private ICustomerService customerService;
@Override
public String getTitle() {
return "Activation Page";
}
public CustomerActivationPage() {
super();
setStatelessHint(true);
}
public CustomerActivationPage(PageParameters pm) {
super();
setStatelessHint(true);
String userId = (String) pm.get("userId");
String activationCode = (String) pm.get("activationCode");
if ( userId != null && activationCode != null) {
Customer customer = customerService.findCustomerById(Long.valueOf(userId));
customer.setUserStatus(Short.valueOf("1"));
Customer userUpdated = customerService.update(customer);
if (userUpdated != null && userUpdated.getUserStatus() == Short.valueOf("1")) {
setResponsePage(new LoginPage());
}
}
}
}
| UTF-8 | Java | 1,082 | java | CustomerActivationPage.java | Java | [] | null | [] | package com.oas.web.pages;
import org.apache.wicket.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import com.oas.model.Customer;
import com.oas.services.ICustomerService;
public class CustomerActivationPage extends BasePage {
@SpringBean
private ICustomerService customerService;
@Override
public String getTitle() {
return "Activation Page";
}
public CustomerActivationPage() {
super();
setStatelessHint(true);
}
public CustomerActivationPage(PageParameters pm) {
super();
setStatelessHint(true);
String userId = (String) pm.get("userId");
String activationCode = (String) pm.get("activationCode");
if ( userId != null && activationCode != null) {
Customer customer = customerService.findCustomerById(Long.valueOf(userId));
customer.setUserStatus(Short.valueOf("1"));
Customer userUpdated = customerService.update(customer);
if (userUpdated != null && userUpdated.getUserStatus() == Short.valueOf("1")) {
setResponsePage(new LoginPage());
}
}
}
}
| 1,082 | 0.707024 | 0.705176 | 40 | 25.049999 | 23.873573 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.8 | false | false | 12 |
b64eac6396f87bcbdde0aba9cd532a76679fc850 | 30,537,217,482,106 | 4fa6722b1a57b2d5599075bd4b39c81b16abee09 | /src/main/java/com/saltlux/tts/agent/service/input/ProcessRecoveryInput.java | 3791b812e886ceec847b13138bab072a239e7ec9 | [] | no_license | ShaunHolt/VoiceStudio_Tts_Master_service | https://github.com/ShaunHolt/VoiceStudio_Tts_Master_service | 1608165c9eaa2e539122def648cadc6a590050b8 | 462c0717d2d247ae1c24b988e1b4a3ec2dec4ace | refs/heads/master | 2022-12-31T21:27:00.256000 | 2020-07-07T09:59:14 | 2020-07-07T09:59:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.saltlux.tts.agent.service.input;
public class ProcessRecoveryInput {
private String voiceId;
private String url;
private boolean activate;
@Override
public String toString() {
return "ProcessRecoveryInput [voiceId=" + voiceId + ", url=" + url + ", activate=" + activate + "]";
}
public String getVoiceId() {
return voiceId;
}
public String getUrl() {
return url;
}
public boolean isActivate() {
return activate;
}
}
| UTF-8 | Java | 481 | java | ProcessRecoveryInput.java | Java | [] | null | [] | package com.saltlux.tts.agent.service.input;
public class ProcessRecoveryInput {
private String voiceId;
private String url;
private boolean activate;
@Override
public String toString() {
return "ProcessRecoveryInput [voiceId=" + voiceId + ", url=" + url + ", activate=" + activate + "]";
}
public String getVoiceId() {
return voiceId;
}
public String getUrl() {
return url;
}
public boolean isActivate() {
return activate;
}
}
| 481 | 0.654886 | 0.654886 | 25 | 17.24 | 21.709499 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.28 | false | false | 12 |
a3e12cafcd3c1ce4f2c475073fa40871c14a5cf7 | 30,537,217,481,764 | fc947233ca5899af5226f48b9d31be65f82425d8 | /src/logic/data/planet/BlackPlanet.java | 78d7cafe9eb1e16df5da81498801a9813b5a1f85 | [] | no_license | treysemedo/planet-bound-en | https://github.com/treysemedo/planet-bound-en | 4555f05c44acf9ce65e9917c18e1e5a743278e66 | 3fd6bae396801d00b680c85aead5e56313357259 | refs/heads/main | 2023-08-16T17:17:48.086000 | 2021-10-02T12:16:00 | 2021-10-02T12:16:00 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* 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 logic.data.planet;
import java.util.ArrayList;
import java.util.Arrays;
import logic.data.util.EnumResource;
/**
*
* @author treys
*/
public class BlackPlanet extends Planet {
public BlackPlanet() {
super(new ArrayList<EnumResource>(Arrays.asList(EnumResource.BLACK,EnumResource.BLUE)), false);
}
@Override
public String toString() {
return "Black Planet->"+super.toString();
}
@Override
public EnumPlanet getPlanetType(){
return EnumPlanet.BLACK;
}
}
| UTF-8 | Java | 748 | java | BlackPlanet.java | Java | [
{
"context": "logic.data.util.EnumResource;\r\n/**\r\n *\r\n * @author treys\r\n */\r\npublic class BlackPlanet extends Planet {\r\n",
"end": 338,
"score": 0.9994805455207825,
"start": 333,
"tag": "USERNAME",
"value": "treys"
}
] | null | [] | /*
* 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 logic.data.planet;
import java.util.ArrayList;
import java.util.Arrays;
import logic.data.util.EnumResource;
/**
*
* @author treys
*/
public class BlackPlanet extends Planet {
public BlackPlanet() {
super(new ArrayList<EnumResource>(Arrays.asList(EnumResource.BLACK,EnumResource.BLUE)), false);
}
@Override
public String toString() {
return "Black Planet->"+super.toString();
}
@Override
public EnumPlanet getPlanetType(){
return EnumPlanet.BLACK;
}
}
| 748 | 0.656417 | 0.656417 | 30 | 22.933332 | 24.739891 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 12 |
9489ea3d1089cfc75871026fe269505efad769c9 | 29,205,777,658,940 | 0e72060cb1b7651c9552af3e59786e9946a3d03f | /app/src/main/java/com/owo/module_a_register/widgets/FragRegister.java | 614f646159ce96484defc7e6e5c6f5d35dc3fe7c | [] | no_license | AlexCatP/YUP | https://github.com/AlexCatP/YUP | f24a4d805b37c63a768bd6962c81395089271bbb | 2a3f1a31c621e572a6790fc2e931d8439786357e | refs/heads/master | 2021-09-08T03:09:45.256000 | 2018-03-06T13:34:58 | 2018-03-06T13:34:58 | 115,122,678 | 0 | 2 | null | false | 2018-03-06T13:34:59 | 2017-12-22T14:30:47 | 2017-12-22T14:42:36 | 2018-03-06T13:34:59 | 24,118 | 0 | 2 | 0 | Java | false | null | package com.owo.module_a_register.widgets;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.owo.module_a_login.AtyLoginOrRegister;
import com.owo.module_a_selectlabel.widgets.AtySelectLabel;
import com.owo.utils.util_http.MyURL;
import com.owo.utils.util_http.URL;
import com.wao.dogcat.R;
import com.owo.base.FragBase;
import com.owo.module_b_main.AtyMain;
import com.owo.module_a_register.presenter.PresenterRegister;
import com.owo.module_a_register.presenter.PresenterRgisterImpl;
import com.owo.module_a_register.view.ViewRegister;
import com.owo.utils.Common;
import com.owo.utils.EncodeAndDecode;
import com.owo.utils.util_http.HttpHelper;
import com.owo.utils.UtilLog;
import com.wao.dogcat.controller.server.TimeService;
import org.json.JSONException;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.api.BasicCallback;
import io.jchat.android.activity.MainActivity;
import io.jchat.android.chatting.utils.HandleResponseCode;
import io.jchat.android.database.UserEntry;
/**
* @author XQF
* @created 2017/5/18
*/
public class FragRegister extends FragBase implements ViewRegister {
public static FragRegister newInstance() {
return new FragRegister();
}
//交互中介
private PresenterRegister mPresenterRegister;
//用户ID
private int mUserId;
//保存用户ID
private SharedPreferences.Editor mEditor;
private String mUserName;
private String mUserPhone;
private String mUserPassword;
private String mUserPasswordAgain;
private String mUserMd5password;
private String mResultRegister;
@BindView(R.id.editV_frag_login_or_register_phone)
protected EditText mEditTextPhone;
@BindView(R.id.editV_frag_login_or_register_password)
protected EditText mEditTextPwd;
@BindView(R.id.editV_frag_login_or_register_password1)
protected EditText mEditTextPwd1;
@BindView(R.id.btn_register)
protected Button mButtonRegister;
public ProgressDialog mDialog;
private int regCode;
//posRegCode, posLogCode;
private boolean flag = false;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.frag_register_layout, container, false);
ButterKnife.bind(this, view);
mPresenterRegister = new PresenterRgisterImpl(this);
return view;
}
@Override
public void onDestroy() {
super.onDestroy();
Common.dismissProgressDialog(getContext());
}
@OnClick(R.id.backBtn)
public void backBtn(){
start(getActivity(), AtyLoginOrRegister.class);
getActivity().finish();
}
/**
* 注册时的逻辑
*/
@OnClick(R.id.btn_register)
public void onBtnRegisterClick() {
mUserPhone = mEditTextPhone.getText().toString();
mUserPassword = mEditTextPwd.getText().toString();
mUserName = "u_" + Common.createRandom(true, 6);
boolean isConnectWS = true;
if (!mEditTextPwd.getText().toString().matches("[a-zA-Z\\d+]{6,16}")) {
Common.display(getContext(), "密码应该为6-16位字母或数字组合");
isConnectWS = false;
}
if (!mEditTextPwd.getText().toString().equals(mEditTextPwd1.getText().toString())) {
Common.display(getContext(), "与上次输入密码不同");
isConnectWS = false;
}
if (!mEditTextPhone.getText().toString().matches("1[1-9]{1}[0-9]{9}")) {
Common.display(getContext(), "手机号码格式错误");
isConnectWS = false;
}
boolean flag = Common.isNetworkAvailable(getContext());
if (!flag) {
Common.display(getContext(), "请开启手机网络");
isConnectWS = false;
}
if (!isConnectWS)
return;
// mDialog = showSpinnerDialog();
// mDialog.show();
//注册应用
mPresenterRegister.registerByPhoneAndPsw(mUserName, mUserPhone, mUserPassword);
}
/**
* 注册成功返回数据
*
* @param string 返回的数据
*/
@Override
public void getRegisterResult(String string, int code) {
mResultRegister = string;
regCode = code;
UtilLog.d("test", "注册成功返回的数据 mResultRegister" + mResultRegister);
UtilLog.d("test", "进入注册pose相机之前 mResultRegister" + mResultRegister);
registerPoseCameraAndSoOn(mResultRegister);
}
// @Override
// public void getPoseRegisterResult(String string, int code) {
// posRegCode = code;
// flag = true;
//
// }
/**
* 根据注册返回的信息数据注册pose相机等等一系列的操作
*
* @param string
*/
private void registerPoseCameraAndSoOn(final String string) {
// UtilLog.d("test", "准备解析的pose相机: " + string);
Common.showProgressDialog("加载初始数据...", getContext());
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
try {
if (regCode == 200) {
//获取ID
Object objId = HttpHelper.AnalysisData(string);
if (objId != null) {
mUserMd5password = EncodeAndDecode.getMD5Str(mUserPassword);
Common.userSP = getContext().getSharedPreferences("userSP", 0);
mUserId = Integer.parseInt(objId.toString().substring(0, objId.toString().length() - 6));
UtilLog.d("test", "mUserId: " + mUserId);
mEditor = Common.userSP.edit();
mEditor.putInt("ID", mUserId);
mEditor.putInt("status", 1);
mEditor.commit();
Common.userID = mUserId;
//用id登录
String jsonInfo = login();
HashMap<String, Object>
userHM = HttpHelper.AnalysisUserInfo(jsonInfo);
Common.setUserInfo(userHM);
//注册pose相机
//mPresenterRegister.registerPoseCameraByPhoneAndMd5passsword(mUserName, mUserPhone, mUserMd5password);
// String str = regPose();
// posRegCode = HttpHelper.getCode(str);
// if (posRegCode == 100) {
//登陆pose相机
//mPresenterRegister.loginPoseCameraByNameAndMd5password(mUserName, mUserMd5password, mUserId);
//String jsonResultData = loginPose(mUserName, mUserMd5password);
// posLogCode = HttpHelper.getCode(jsonResultData);
// if (posLogCode == 100) {
// UtilLog.d("test", "登录pose相机返回的数据 " + jsonResultData);
// HashMap<String, Object> poseID = HttpHelper.AnalysisUid(jsonResultData);
// Common.userIdPose = (int) poseID.get("userid"); //获取poseUserID
// HashMap<String, String> po = new HashMap<>();
// po.put("id", mUserId + "");
// po.put("wexID", Common.userIdPose + "");
// HttpHelper.postData(MyURL.UPDATE_WEXID_BY_ID, po, null); //建立poseUserID与yup通道
// HashMap<String, String> param = new HashMap<>();
// param.put("userID", mUserId + "");
// param.put("itemID", "10");
// HttpHelper.postData(MyURL.INSERT_USER_ITEM, param, null); //注册成功奖励相机道具
//
// HashMap<String, String> p = new HashMap<>();
// p.put("userID", mUserId + "");
// p.put("itemID", "11");
// HttpHelper.postData(MyURL.INSERT_USER_ITEM, p, null); //注册成功奖励纸条道具
// HashMap<String, String> pose = new HashMap<>();
// pose.put("userID", mUserId + "");
// pose.put("itemID", "18");
// HttpHelper.postData(MyURL.INSERT_USER_ITEM, pose, null); //注册成功pose相机道具
HashMap<String, String> data = new HashMap<>();
data.put("userID", mUserId + "");
data.put("status", "1");
HttpHelper.postData(MyURL.INSERT_STEPS, data, null);
Looper.prepare();
registerIM("yup_"+mUserId, mUserMd5password, getContext());
Looper.loop();
// }
// } else {
// Looper.prepare();
// Common.dismissProgressDialog(getContext());
// Common.display(getContext(), "注册失败:POSCODE " + posRegCode);
// Looper.loop();
// }
} else {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "注册失败:NULL");
Looper.loop();
}
} else if (regCode == 101) {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "初始化昵称失败,请联系管理员= =..");
Looper.loop();
} else if (regCode == 102) {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "该手机号已被注册过了哦");
Looper.loop();
} else {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "注册失败");
Looper.loop();
}
} catch (Exception e) {
e.printStackTrace();
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "注册失败:Exception");
Looper.loop();
}
}
};
timer.schedule(task, 100);
}
public void registerIM(final String username, final String password, final Context mContext) {
JMessageClient.register(username, password, new BasicCallback() {
@Override
public void gotResult(final int status, final String desc) {
if (status == 0) {
JMessageClient.login(username, password, new BasicCallback() {
@Override
public void gotResult(final int status, String desc) {
if (status == 0) {
String username = JMessageClient.getMyInfo().getUserName();
String appKey = JMessageClient.getMyInfo().getAppKey();
UserEntry user = UserEntry.getUser(username, appKey);
if (null == user) {
user = new UserEntry(username, appKey);
user.save();
}
AtyMain.start(getActivity(), AtyMain.class,true);
getActivity().finish();
if (Common.isServiceRun(mContext, "com.wao.dogcat.controller.server.TimeService")) {
Intent i = new Intent(mContext, TimeService.class);
getContext().stopService(i);
}
}
// else {
// HandleResponseCode.onHandle(mContext, status, false);
//
// }
}
});
}
// else {
// HandleResponseCode.onHandle(mContext, status, false);
//
// }
}
});
}
// public String regPose() throws Exception {
// HashMap<String, String> paramHM = new HashMap<>();
// paramHM.put("username", mUserName);
// paramHM.put("userphone", mUserPhone);
// paramHM.put("password", mUserMd5password);
// paramHM.put("userpb", "0");
// paramHM.put("taskpic_url", "119.29.245.167:8089/head.png");
// return HttpHelper.postData(URL.REG_URL, paramHM, null);
// }
//
// public String loginPose(String ln, String pw) throws Exception {
// HashMap<String, String> paramHM = new HashMap<>();
// paramHM.put("username", ln);
// paramHM.put("password", pw);
// String result = HttpHelper.postData(URL.LOGIN_URL, paramHM, null);
// return result;
// }
public String login() throws Exception {
HashMap<String, String> paramHM = new HashMap<>();
paramHM.put("id", mUserId + "");
String result = HttpHelper.postData(MyURL.GET_USER_BY_ID, paramHM, null);
return result;
}
}
| UTF-8 | Java | 14,663 | java | FragRegister.java | Java | [
{
"context": ".jchat.android.database.UserEntry;\n\n/**\n * @author XQF\n * @created 2017/5/18\n */\npublic class FragRegist",
"end": 1496,
"score": 0.999683141708374,
"start": 1493,
"tag": "USERNAME",
"value": "XQF"
},
{
"context": "Preferences.Editor mEditor;\n\n\n private Strin... | null | [] | package com.owo.module_a_register.widgets;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.owo.module_a_login.AtyLoginOrRegister;
import com.owo.module_a_selectlabel.widgets.AtySelectLabel;
import com.owo.utils.util_http.MyURL;
import com.owo.utils.util_http.URL;
import com.wao.dogcat.R;
import com.owo.base.FragBase;
import com.owo.module_b_main.AtyMain;
import com.owo.module_a_register.presenter.PresenterRegister;
import com.owo.module_a_register.presenter.PresenterRgisterImpl;
import com.owo.module_a_register.view.ViewRegister;
import com.owo.utils.Common;
import com.owo.utils.EncodeAndDecode;
import com.owo.utils.util_http.HttpHelper;
import com.owo.utils.UtilLog;
import com.wao.dogcat.controller.server.TimeService;
import org.json.JSONException;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.api.BasicCallback;
import io.jchat.android.activity.MainActivity;
import io.jchat.android.chatting.utils.HandleResponseCode;
import io.jchat.android.database.UserEntry;
/**
* @author XQF
* @created 2017/5/18
*/
public class FragRegister extends FragBase implements ViewRegister {
public static FragRegister newInstance() {
return new FragRegister();
}
//交互中介
private PresenterRegister mPresenterRegister;
//用户ID
private int mUserId;
//保存用户ID
private SharedPreferences.Editor mEditor;
private String mUserName;
private String mUserPhone;
private String mUserPassword;
private String mUserPasswordAgain;
private String mUserMd5password;
private String mResultRegister;
@BindView(R.id.editV_frag_login_or_register_phone)
protected EditText mEditTextPhone;
@BindView(R.id.editV_frag_login_or_register_password)
protected EditText mEditTextPwd;
@BindView(R.id.editV_frag_login_or_register_password1)
protected EditText mEditTextPwd1;
@BindView(R.id.btn_register)
protected Button mButtonRegister;
public ProgressDialog mDialog;
private int regCode;
//posRegCode, posLogCode;
private boolean flag = false;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.frag_register_layout, container, false);
ButterKnife.bind(this, view);
mPresenterRegister = new PresenterRgisterImpl(this);
return view;
}
@Override
public void onDestroy() {
super.onDestroy();
Common.dismissProgressDialog(getContext());
}
@OnClick(R.id.backBtn)
public void backBtn(){
start(getActivity(), AtyLoginOrRegister.class);
getActivity().finish();
}
/**
* 注册时的逻辑
*/
@OnClick(R.id.btn_register)
public void onBtnRegisterClick() {
mUserPhone = mEditTextPhone.getText().toString();
mUserPassword = mEditTextPwd.getText().toString();
mUserName = "u_" + Common.createRandom(true, 6);
boolean isConnectWS = true;
if (!mEditTextPwd.getText().toString().matches("[a-zA-Z\\d+]{6,16}")) {
Common.display(getContext(), "密码应该为6-16位字母或数字组合");
isConnectWS = false;
}
if (!mEditTextPwd.getText().toString().equals(mEditTextPwd1.getText().toString())) {
Common.display(getContext(), "与上次输入密码不同");
isConnectWS = false;
}
if (!mEditTextPhone.getText().toString().matches("1[1-9]{1}[0-9]{9}")) {
Common.display(getContext(), "手机号码格式错误");
isConnectWS = false;
}
boolean flag = Common.isNetworkAvailable(getContext());
if (!flag) {
Common.display(getContext(), "请开启手机网络");
isConnectWS = false;
}
if (!isConnectWS)
return;
// mDialog = showSpinnerDialog();
// mDialog.show();
//注册应用
mPresenterRegister.registerByPhoneAndPsw(mUserName, mUserPhone, mUserPassword);
}
/**
* 注册成功返回数据
*
* @param string 返回的数据
*/
@Override
public void getRegisterResult(String string, int code) {
mResultRegister = string;
regCode = code;
UtilLog.d("test", "注册成功返回的数据 mResultRegister" + mResultRegister);
UtilLog.d("test", "进入注册pose相机之前 mResultRegister" + mResultRegister);
registerPoseCameraAndSoOn(mResultRegister);
}
// @Override
// public void getPoseRegisterResult(String string, int code) {
// posRegCode = code;
// flag = true;
//
// }
/**
* 根据注册返回的信息数据注册pose相机等等一系列的操作
*
* @param string
*/
private void registerPoseCameraAndSoOn(final String string) {
// UtilLog.d("test", "准备解析的pose相机: " + string);
Common.showProgressDialog("加载初始数据...", getContext());
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
try {
if (regCode == 200) {
//获取ID
Object objId = HttpHelper.AnalysisData(string);
if (objId != null) {
mUserMd5password = EncodeAndDecode.getMD5Str(mUserPassword);
Common.userSP = getContext().getSharedPreferences("userSP", 0);
mUserId = Integer.parseInt(objId.toString().substring(0, objId.toString().length() - 6));
UtilLog.d("test", "mUserId: " + mUserId);
mEditor = Common.userSP.edit();
mEditor.putInt("ID", mUserId);
mEditor.putInt("status", 1);
mEditor.commit();
Common.userID = mUserId;
//用id登录
String jsonInfo = login();
HashMap<String, Object>
userHM = HttpHelper.AnalysisUserInfo(jsonInfo);
Common.setUserInfo(userHM);
//注册pose相机
//mPresenterRegister.registerPoseCameraByPhoneAndMd5passsword(mUserName, mUserPhone, mUserMd5password);
// String str = regPose();
// posRegCode = HttpHelper.getCode(str);
// if (posRegCode == 100) {
//登陆pose相机
//mPresenterRegister.loginPoseCameraByNameAndMd5password(mUserName, mUserMd5password, mUserId);
//String jsonResultData = loginPose(mUserName, mUserMd5password);
// posLogCode = HttpHelper.getCode(jsonResultData);
// if (posLogCode == 100) {
// UtilLog.d("test", "登录pose相机返回的数据 " + jsonResultData);
// HashMap<String, Object> poseID = HttpHelper.AnalysisUid(jsonResultData);
// Common.userIdPose = (int) poseID.get("userid"); //获取poseUserID
// HashMap<String, String> po = new HashMap<>();
// po.put("id", mUserId + "");
// po.put("wexID", Common.userIdPose + "");
// HttpHelper.postData(MyURL.UPDATE_WEXID_BY_ID, po, null); //建立poseUserID与yup通道
// HashMap<String, String> param = new HashMap<>();
// param.put("userID", mUserId + "");
// param.put("itemID", "10");
// HttpHelper.postData(MyURL.INSERT_USER_ITEM, param, null); //注册成功奖励相机道具
//
// HashMap<String, String> p = new HashMap<>();
// p.put("userID", mUserId + "");
// p.put("itemID", "11");
// HttpHelper.postData(MyURL.INSERT_USER_ITEM, p, null); //注册成功奖励纸条道具
// HashMap<String, String> pose = new HashMap<>();
// pose.put("userID", mUserId + "");
// pose.put("itemID", "18");
// HttpHelper.postData(MyURL.INSERT_USER_ITEM, pose, null); //注册成功pose相机道具
HashMap<String, String> data = new HashMap<>();
data.put("userID", mUserId + "");
data.put("status", "1");
HttpHelper.postData(MyURL.INSERT_STEPS, data, null);
Looper.prepare();
registerIM("yup_"+mUserId, mUserMd5password, getContext());
Looper.loop();
// }
// } else {
// Looper.prepare();
// Common.dismissProgressDialog(getContext());
// Common.display(getContext(), "注册失败:POSCODE " + posRegCode);
// Looper.loop();
// }
} else {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "注册失败:NULL");
Looper.loop();
}
} else if (regCode == 101) {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "初始化昵称失败,请联系管理员= =..");
Looper.loop();
} else if (regCode == 102) {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "该手机号已被注册过了哦");
Looper.loop();
} else {
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "注册失败");
Looper.loop();
}
} catch (Exception e) {
e.printStackTrace();
Looper.prepare();
Common.dismissProgressDialog(getContext());
Common.display(getContext(), "注册失败:Exception");
Looper.loop();
}
}
};
timer.schedule(task, 100);
}
public void registerIM(final String username, final String password, final Context mContext) {
JMessageClient.register(username, password, new BasicCallback() {
@Override
public void gotResult(final int status, final String desc) {
if (status == 0) {
JMessageClient.login(username, password, new BasicCallback() {
@Override
public void gotResult(final int status, String desc) {
if (status == 0) {
String username = JMessageClient.getMyInfo().getUserName();
String appKey = JMessageClient.getMyInfo().getAppKey();
UserEntry user = UserEntry.getUser(username, appKey);
if (null == user) {
user = new UserEntry(username, appKey);
user.save();
}
AtyMain.start(getActivity(), AtyMain.class,true);
getActivity().finish();
if (Common.isServiceRun(mContext, "com.wao.dogcat.controller.server.TimeService")) {
Intent i = new Intent(mContext, TimeService.class);
getContext().stopService(i);
}
}
// else {
// HandleResponseCode.onHandle(mContext, status, false);
//
// }
}
});
}
// else {
// HandleResponseCode.onHandle(mContext, status, false);
//
// }
}
});
}
// public String regPose() throws Exception {
// HashMap<String, String> paramHM = new HashMap<>();
// paramHM.put("username", mUserName);
// paramHM.put("userphone", mUserPhone);
// paramHM.put("password", <PASSWORD>);
// paramHM.put("userpb", "0");
// paramHM.put("taskpic_url", "192.168.127.12:8089/head.png");
// return HttpHelper.postData(URL.REG_URL, paramHM, null);
// }
//
// public String loginPose(String ln, String pw) throws Exception {
// HashMap<String, String> paramHM = new HashMap<>();
// paramHM.put("username", ln);
// paramHM.put("password", pw);
// String result = HttpHelper.postData(URL.LOGIN_URL, paramHM, null);
// return result;
// }
public String login() throws Exception {
HashMap<String, String> paramHM = new HashMap<>();
paramHM.put("id", mUserId + "");
String result = HttpHelper.postData(MyURL.GET_USER_BY_ID, paramHM, null);
return result;
}
}
| 14,657 | 0.517479 | 0.511782 | 402 | 34.365673 | 30.284933 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.738806 | false | false | 12 |
64b637234a9a2f65d2b5cd201dc7ad5b614b0f38 | 29,111,288,377,096 | c7ec5b78497e96a228f0ef0598dcd5fbbec97162 | /administrator/clients-microservice/src/main/java/de/tekup/marketplace/services/ClientService.java | bcaeaa1699a58e73521ced15675dc12bae922e58 | [] | no_license | wissemEljaoued/marketplace | https://github.com/wissemEljaoued/marketplace | 89b7522c26ff4dce5cc9be6d7144d9cfe424f504 | 33acb26bd42855eca08ce4a20aee572c6d1858a6 | refs/heads/master | 2021-05-24T10:34:50.598000 | 2020-04-05T20:18:38 | 2020-04-05T20:18:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.tekup.marketplace.services;
import org.springframework.stereotype.Service;
@Service
public interface ClientService {
}
| UTF-8 | Java | 132 | java | ClientService.java | Java | [] | null | [] | package de.tekup.marketplace.services;
import org.springframework.stereotype.Service;
@Service
public interface ClientService {
}
| 132 | 0.825758 | 0.825758 | 7 | 17.857143 | 18.581316 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 12 |
35b85b20ba801eed423f1e7493dd377b1cbc881f | 670,014,935,845 | 9c1a9c97e1aa5f519dc1dc9d99a0eadc844e9ae9 | /Projeto_7_1/src/br/lucas/ex_7_1_2/Linha.java | fde222226a24da71186ebd67029a1823637e2372 | [] | no_license | LucasDeOliveira1383/Trabalho | https://github.com/LucasDeOliveira1383/Trabalho | 13a05d30d57a238fdd261a89728d8e5b1e8dd398 | b3832d9322fa6674dee16642c3b61d8c0e534d7d | refs/heads/master | 2020-08-17T07:25:43.028000 | 2019-10-16T20:57:13 | 2019-10-16T20:57:13 | 215,632,200 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.lucas.ex_7_1_2;
import br.lucas.ex_7_1_1.Ponto2D;
public class Linha {
private Ponto2D a;
private Ponto2D b;
public Linha() {
a = new Ponto2D();
b = new Ponto2D();
}
public Linha(Ponto2D a, Ponto2D b) {
this.a = new Ponto2D(a.getX(), a.getY());
this.b = new Ponto2D(b.getX(), b.getY());
}
public Ponto2D getA() {
return new Ponto2D(a.getX(), a.getY());
}
public void setA(Ponto2D a) {
this.a = new Ponto2D (a.getX(), a.getY());
}
public Ponto2D getB() {
return new Ponto2D(b.getX(), b.getY());
}
public void setB(Ponto2D b) {
this.b = new Ponto2D(b.getX(), b.getY());
}
public Ponto2D centro() {
return new Ponto2D((a.getX()+b.getX())/2, (a.getY() + b.getY())/2);
}
@Override
public String toString() {
return "[" + a + ";" + b + "]";
}
@Override
public float perimetro() {
return a.distancia(b);
}
@Override
public float area() {
return 0;
}
@Override
public float largura() {
return Math.abs(a.getX() - b.getX());
}
@Override
public float altura() {
return Math.abs(a.getY() - b.getY());
}
}
| UTF-8 | Java | 1,156 | java | Linha.java | Java | [] | null | [] | package br.lucas.ex_7_1_2;
import br.lucas.ex_7_1_1.Ponto2D;
public class Linha {
private Ponto2D a;
private Ponto2D b;
public Linha() {
a = new Ponto2D();
b = new Ponto2D();
}
public Linha(Ponto2D a, Ponto2D b) {
this.a = new Ponto2D(a.getX(), a.getY());
this.b = new Ponto2D(b.getX(), b.getY());
}
public Ponto2D getA() {
return new Ponto2D(a.getX(), a.getY());
}
public void setA(Ponto2D a) {
this.a = new Ponto2D (a.getX(), a.getY());
}
public Ponto2D getB() {
return new Ponto2D(b.getX(), b.getY());
}
public void setB(Ponto2D b) {
this.b = new Ponto2D(b.getX(), b.getY());
}
public Ponto2D centro() {
return new Ponto2D((a.getX()+b.getX())/2, (a.getY() + b.getY())/2);
}
@Override
public String toString() {
return "[" + a + ";" + b + "]";
}
@Override
public float perimetro() {
return a.distancia(b);
}
@Override
public float area() {
return 0;
}
@Override
public float largura() {
return Math.abs(a.getX() - b.getX());
}
@Override
public float altura() {
return Math.abs(a.getY() - b.getY());
}
}
| 1,156 | 0.557958 | 0.533737 | 64 | 16.0625 | 16.105001 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.546875 | false | false | 12 |
28fb59be7113e7ad325ac1968ec8d5cd337c3609 | 5,308,579,634,912 | 2c281e00556deb53c127755783c75a8851f99c19 | /test/com/urise/webapp/util/JsonParserTest.java | ee515eb7941065e6da2f7c760dffdd7372d35df1 | [] | no_license | AndrewAlyonkin/basejava | https://github.com/AndrewAlyonkin/basejava | e268b6282babdb6b897452db8400f90921d18260 | b2142a17ea5ba5c2b6a55b38d231eebad04881ee | refs/heads/master | 2023-03-26T02:37:30.891000 | 2021-03-27T13:27:12 | 2021-03-27T13:27:12 | 319,697,725 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.urise.webapp.util;
import com.urise.webapp.model.Resume;
import com.urise.webapp.model.sections.Section;
import com.urise.webapp.model.sections.TextSection;
import org.junit.Assert;
import org.junit.Test;
import static com.urise.webapp.TestData.RESUME_1;
public class JsonParserTest {
@Test
public void testResume() {
String json = JsonParser.write(RESUME_1);
System.out.printf(json);
Resume testResume = JsonParser.read(json, Resume.class);
Assert.assertEquals(RESUME_1, testResume);
}
@Test
public void write() {
Section expSection = new TextSection("TestSection");
String json = JsonParser.write(expSection, Section.class);
System.out.println(json);
Section parsedSection = JsonParser.read(json, Section.class);
Assert.assertEquals(expSection, parsedSection);
}
} | UTF-8 | Java | 879 | java | JsonParserTest.java | Java | [] | null | [] | package com.urise.webapp.util;
import com.urise.webapp.model.Resume;
import com.urise.webapp.model.sections.Section;
import com.urise.webapp.model.sections.TextSection;
import org.junit.Assert;
import org.junit.Test;
import static com.urise.webapp.TestData.RESUME_1;
public class JsonParserTest {
@Test
public void testResume() {
String json = JsonParser.write(RESUME_1);
System.out.printf(json);
Resume testResume = JsonParser.read(json, Resume.class);
Assert.assertEquals(RESUME_1, testResume);
}
@Test
public void write() {
Section expSection = new TextSection("TestSection");
String json = JsonParser.write(expSection, Section.class);
System.out.println(json);
Section parsedSection = JsonParser.read(json, Section.class);
Assert.assertEquals(expSection, parsedSection);
}
} | 879 | 0.703072 | 0.699659 | 29 | 29.344828 | 22.741844 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.724138 | false | false | 12 |
d1234bcbf5a7b3a59eaef1fd87a7068dd5beebdd | 15,341,623,228,743 | 21c5594eb76f4f65984e94013ea6e9b4adda5bdd | /spring/users/src/main/java/fr/univlyon1/mif13/tp1/exception/ControllerAdvisor.java | c0d6a13179a8828cdf5a8dadc471c3e90ec2fec6 | [] | no_license | SamyBO98/mif13-tps | https://github.com/SamyBO98/mif13-tps | 805150ecee60b9196ec62efd7a1fa0049715f36a | 9989ea9b9a6594d3d3094f04560a6728b14395c7 | refs/heads/master | 2023-07-26T10:10:45.177000 | 2021-06-11T20:46:29 | 2021-06-11T20:46:29 | 404,295,305 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package fr.univlyon1.mif13.tp1.exception;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.Map;
@ControllerAdvice
public class ControllerAdvisor {
private static String ERROR_PAGE = "error";
@ResponseStatus(HttpStatus.UNAUTHORIZED)
@ExceptionHandler(UserPasswordException.class)
public ModelAndView handleUserPasswordException(UserPasswordException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.UNAUTHORIZED)
@ExceptionHandler(TokenException.class)
public ModelAndView handleTokenException(TokenException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(UserConnectedException.class)
public ModelAndView handleUserConnectedException(UserConnectedException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(UserLoginException.class)
public ModelAndView handleUserLoginException(UserLoginException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MissingArgumentsException.class)
public ModelAndView handleMissingArgumentsException(MissingArgumentsException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
private void checkException(RuntimeException exception){
if (AnnotationUtils.findAnnotation(exception.getClass(), ResponseStatus.class) != null){
throw exception;
}
}
}
| UTF-8 | Java | 3,261 | java | ControllerAdvisor.java | Java | [] | null | [] | package fr.univlyon1.mif13.tp1.exception;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.Map;
@ControllerAdvice
public class ControllerAdvisor {
private static String ERROR_PAGE = "error";
@ResponseStatus(HttpStatus.UNAUTHORIZED)
@ExceptionHandler(UserPasswordException.class)
public ModelAndView handleUserPasswordException(UserPasswordException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.UNAUTHORIZED)
@ExceptionHandler(TokenException.class)
public ModelAndView handleTokenException(TokenException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(UserConnectedException.class)
public ModelAndView handleUserConnectedException(UserConnectedException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(UserLoginException.class)
public ModelAndView handleUserLoginException(UserLoginException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(MissingArgumentsException.class)
public ModelAndView handleMissingArgumentsException(MissingArgumentsException exception, HttpServletRequest request){
checkException(exception);
ModelAndView mav = new ModelAndView();
mav.addObject("exception", exception.getMessage());
mav.addObject("url", request.getRequestURL());
mav.setViewName(ERROR_PAGE);
return mav;
}
private void checkException(RuntimeException exception){
if (AnnotationUtils.findAnnotation(exception.getClass(), ResponseStatus.class) != null){
throw exception;
}
}
}
| 3,261 | 0.736584 | 0.735357 | 92 | 34.445652 | 29.026361 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.663043 | false | false | 12 |
8a2dda21b4539d11cc2d0533ca9a7f991d57e0b1 | 13,134,009,992,794 | 452ace12689c6c70cb79797836c1b617cb156c57 | /zookeeper/src/test/java/com/hyang/demo/zookeeper/NodeDataCASTest.java | 4ef01bfee591c5464d06826f2818c323cbb2c962 | [] | no_license | hyang214/DemoCode | https://github.com/hyang214/DemoCode | aa6c43e80640b0dbf6fe75995bf9dd6de95ce265 | 4bb8ad3bca1287b023be3a024c58abaa097959ad | refs/heads/master | 2022-07-05T15:38:33.105000 | 2019-07-19T03:29:50 | 2019-07-19T03:29:50 | 190,190,859 | 0 | 0 | null | false | 2022-06-29T19:40:44 | 2019-06-04T11:48:46 | 2019-07-19T03:30:09 | 2022-06-29T19:40:43 | 107 | 0 | 0 | 1 | Java | false | false | package com.hyang.demo.zookeeper;
import com.github.zkclient.ZkClient;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class NodeDataCASTest {
public static final String SEQ_ZNODE = "/cas";
private static final String taskName = "CAS-";
@Before
public void init() {
ZkClient zkClient = new ZkClient("127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183", 3000, 50000);
zkClient.delete(SEQ_ZNODE);
zkClient.create(SEQ_ZNODE, new byte[0], CreateMode.PERSISTENT);
zkClient.writeData(SEQ_ZNODE, Long.valueOf(1000).toString().getBytes());
}
@Test
public void contextLoads() {
for (int i = 0; i < 10; i++) {
Long id = getCurrent();
System.out.println(taskName + i + " obtain id=" +id );
}
}
private Long getCurrent() {
try {
ZkClient zkClient = new ZkClient("127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183", 3000, 50000);
Stat stat = new Stat();
byte[] currentData = zkClient.readData(SEQ_ZNODE, stat);
Long current = Long.valueOf(new String(currentData));
Long next = current + 1;
zkClient.writeData(SEQ_ZNODE, next.toString().getBytes(), stat.getVersion());
zkClient.close();
return current;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
| UTF-8 | Java | 1,692 | java | NodeDataCASTest.java | Java | [
{
"context": "nit() {\n ZkClient zkClient = new ZkClient(\"127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183\", 3000, 50000)",
"end": 624,
"score": 0.999649703502655,
"start": 615,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": " ZkClient zkClient = new ZkClient(\"127.0.... | null | [] | package com.hyang.demo.zookeeper;
import com.github.zkclient.ZkClient;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class NodeDataCASTest {
public static final String SEQ_ZNODE = "/cas";
private static final String taskName = "CAS-";
@Before
public void init() {
ZkClient zkClient = new ZkClient("127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183", 3000, 50000);
zkClient.delete(SEQ_ZNODE);
zkClient.create(SEQ_ZNODE, new byte[0], CreateMode.PERSISTENT);
zkClient.writeData(SEQ_ZNODE, Long.valueOf(1000).toString().getBytes());
}
@Test
public void contextLoads() {
for (int i = 0; i < 10; i++) {
Long id = getCurrent();
System.out.println(taskName + i + " obtain id=" +id );
}
}
private Long getCurrent() {
try {
ZkClient zkClient = new ZkClient("127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183", 3000, 50000);
Stat stat = new Stat();
byte[] currentData = zkClient.readData(SEQ_ZNODE, stat);
Long current = Long.valueOf(new String(currentData));
Long next = current + 1;
zkClient.writeData(SEQ_ZNODE, next.toString().getBytes(), stat.getVersion());
zkClient.close();
return current;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
| 1,692 | 0.628842 | 0.576832 | 52 | 31.538462 | 26.941147 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.826923 | false | false | 12 |
8985c5debc19fb0d60e28c9ff52e5b41d0ce4c73 | 4,698,694,265,553 | 94b27e57a18b8f869684d1072cc3aed16f5f4e3d | /ATM/src/ATMGUI.java | 5e9496c59066742077b1905679542dd2052cd574 | [] | no_license | justinpl/CMIS242 | https://github.com/justinpl/CMIS242 | 86fc336484c5926b6854810ddd9573452ab2da1a | 942f328712b7c5cebb9e442060cb1904f3d44efc | refs/heads/master | 2021-01-22T01:43:09.493000 | 2017-10-14T23:10:36 | 2017-10-14T23:10:36 | 102,230,320 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* File Name : ATMGUI.java
* Author : Justin Luce
* Created on : 16-09-2017
* Description : This class creates a GUI and checks input
**/
public class ATMGUI extends JFrame
{
// create field and button objects
private JTextField inputField = new JTextField(20);
private JButton withdrawButton = new JButton("Withdraw");
private JButton depositButton = new JButton("Deposit");
private JButton transferToButton = new JButton("Transfer To");
private JButton balanceButton = new JButton("Balance");
private JRadioButton checkingRButton = new JRadioButton("Checking");
private JRadioButton savingsRButton = new JRadioButton("Savings");
// declare variables
private static final double BILL = 20;
private static double amount;
// create Account objects
private Account checkingAccount = new Account(100);
private Account savingsAccount = new Account(100);
// construct GUI object
public ATMGUI()
{
super("ATM");
setSize(300, 175);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(2,2,10,10));
buttonPanel.add(withdrawButton);
buttonPanel.add(depositButton);
buttonPanel.add(transferToButton);
buttonPanel.add(balanceButton);
add(buttonPanel);
JPanel radioPanel = new JPanel();
radioPanel.setLayout(new GridLayout(1, 2, 10, 10));
radioPanel.add(checkingRButton);
radioPanel.add(savingsRButton);
add(radioPanel);
checkingRButton.setSelected(true);
ButtonGroup bG = new ButtonGroup();
bG.add(checkingRButton);
bG.add(savingsRButton);
add(inputField);
withdrawButton.addActionListener
(event -> withdraw());
depositButton.addActionListener
(event -> deposit());
transferToButton.addActionListener
(event -> transferTo());
balanceButton.addActionListener
(event -> balance());
}
//check to verify that the number is a double.
public void numberCheck()
{
try
{
amount = Double.parseDouble(inputField.getText());
}
catch (NumberFormatException exception)
{
JOptionPane.showConfirmDialog(null, "Error, not a number. Please try again.");
}
}
//check to verify that the amount is a multiple of 20
public boolean denominationCheck()
{
if (amount%BILL != 0)
{
JOptionPane.showConfirmDialog(null, "Error, must be a muliple of 20. Please try again.");
return false;
}
return true;
}
// check to determine which button is currently selected to reduce duplication
public Account buttonCheck()
{
if (checkingRButton.isSelected())
{
return checkingAccount;
}
else
{
return savingsAccount;
}
}
//method to performs checks and withdraw amount from selected account
public void withdraw()
{
numberCheck();
if (denominationCheck() == true)
{
try
{
buttonCheck().withdraw(amount);
JOptionPane.showMessageDialog(null, "Succesfully withdrew: $" + amount);
}
catch (InsufficientFunds exception)
{
JOptionPane.showMessageDialog(null, exception.getMessage() + " more needed");
}
}
}
// method to perform check and deposit amount
public void deposit()
{
numberCheck();
buttonCheck().deposit(amount);
JOptionPane.showMessageDialog(null, "Succesfully deposited: $" + amount);
}
// method to perform check and transfer from one account to the other
public void transferTo()
{
numberCheck();
try
{
if (buttonCheck() == checkingAccount)
{
checkingAccount.transferTo(savingsAccount, amount);
}
else
{
savingsAccount.transferTo(checkingAccount, amount);
}
JOptionPane.showMessageDialog(null, "Succesfully tranfered: $" + amount);
}
catch (InsufficientFunds exception)
{
JOptionPane.showMessageDialog(null, exception.getMessage() + " more needed");
}
}
// method to get balance
public void balance()
{
double balance = buttonCheck().balance();
JOptionPane.showConfirmDialog(null, "Your balance is: $"+balance);
}
public static void main(String[] args)
{
ATMGUI frame = new ATMGUI();
frame.setVisible(true);
}
}
| UTF-8 | Java | 5,060 | java | ATMGUI.java | Java | [
{
"context": "**\r\n * File Name : ATMGUI.java\r\n * Author : Justin Luce\r\n * Created on : 16-09-2017\r\n * Description : Th",
"end": 134,
"score": 0.9998551607131958,
"start": 123,
"tag": "NAME",
"value": "Justin Luce"
}
] | null | [] | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* File Name : ATMGUI.java
* Author : <NAME>
* Created on : 16-09-2017
* Description : This class creates a GUI and checks input
**/
public class ATMGUI extends JFrame
{
// create field and button objects
private JTextField inputField = new JTextField(20);
private JButton withdrawButton = new JButton("Withdraw");
private JButton depositButton = new JButton("Deposit");
private JButton transferToButton = new JButton("Transfer To");
private JButton balanceButton = new JButton("Balance");
private JRadioButton checkingRButton = new JRadioButton("Checking");
private JRadioButton savingsRButton = new JRadioButton("Savings");
// declare variables
private static final double BILL = 20;
private static double amount;
// create Account objects
private Account checkingAccount = new Account(100);
private Account savingsAccount = new Account(100);
// construct GUI object
public ATMGUI()
{
super("ATM");
setSize(300, 175);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(2,2,10,10));
buttonPanel.add(withdrawButton);
buttonPanel.add(depositButton);
buttonPanel.add(transferToButton);
buttonPanel.add(balanceButton);
add(buttonPanel);
JPanel radioPanel = new JPanel();
radioPanel.setLayout(new GridLayout(1, 2, 10, 10));
radioPanel.add(checkingRButton);
radioPanel.add(savingsRButton);
add(radioPanel);
checkingRButton.setSelected(true);
ButtonGroup bG = new ButtonGroup();
bG.add(checkingRButton);
bG.add(savingsRButton);
add(inputField);
withdrawButton.addActionListener
(event -> withdraw());
depositButton.addActionListener
(event -> deposit());
transferToButton.addActionListener
(event -> transferTo());
balanceButton.addActionListener
(event -> balance());
}
//check to verify that the number is a double.
public void numberCheck()
{
try
{
amount = Double.parseDouble(inputField.getText());
}
catch (NumberFormatException exception)
{
JOptionPane.showConfirmDialog(null, "Error, not a number. Please try again.");
}
}
//check to verify that the amount is a multiple of 20
public boolean denominationCheck()
{
if (amount%BILL != 0)
{
JOptionPane.showConfirmDialog(null, "Error, must be a muliple of 20. Please try again.");
return false;
}
return true;
}
// check to determine which button is currently selected to reduce duplication
public Account buttonCheck()
{
if (checkingRButton.isSelected())
{
return checkingAccount;
}
else
{
return savingsAccount;
}
}
//method to performs checks and withdraw amount from selected account
public void withdraw()
{
numberCheck();
if (denominationCheck() == true)
{
try
{
buttonCheck().withdraw(amount);
JOptionPane.showMessageDialog(null, "Succesfully withdrew: $" + amount);
}
catch (InsufficientFunds exception)
{
JOptionPane.showMessageDialog(null, exception.getMessage() + " more needed");
}
}
}
// method to perform check and deposit amount
public void deposit()
{
numberCheck();
buttonCheck().deposit(amount);
JOptionPane.showMessageDialog(null, "Succesfully deposited: $" + amount);
}
// method to perform check and transfer from one account to the other
public void transferTo()
{
numberCheck();
try
{
if (buttonCheck() == checkingAccount)
{
checkingAccount.transferTo(savingsAccount, amount);
}
else
{
savingsAccount.transferTo(checkingAccount, amount);
}
JOptionPane.showMessageDialog(null, "Succesfully tranfered: $" + amount);
}
catch (InsufficientFunds exception)
{
JOptionPane.showMessageDialog(null, exception.getMessage() + " more needed");
}
}
// method to get balance
public void balance()
{
double balance = buttonCheck().balance();
JOptionPane.showConfirmDialog(null, "Your balance is: $"+balance);
}
public static void main(String[] args)
{
ATMGUI frame = new ATMGUI();
frame.setVisible(true);
}
}
| 5,055 | 0.581818 | 0.573715 | 150 | 31.733334 | 23.308558 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.54 | false | false | 12 |
c541836306615d5682cbd6b6595cc7161dc225d1 | 31,473,520,382,640 | e5ba147020284f5527c9c67a5eb2955265d55159 | /src/main/java/com/google/cloud/pso/pipeline/model/PersonValidationError.java | 59fb8de13b9484438797e222812063f19473d1a3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | kwadie/data-pipeline-examples | https://github.com/kwadie/data-pipeline-examples | d82b8f66a011fa0af6a93315d7d4826fedcf183e | 3358f2bd3f78e527c5cbb08dadadfe700156ac1c | refs/heads/master | 2021-02-19T01:02:08.408000 | 2020-03-18T20:13:41 | 2020-03-18T20:13:41 | 245,260,644 | 0 | 0 | Apache-2.0 | false | 2020-10-13T20:06:14 | 2020-03-05T20:25:36 | 2020-03-18T20:13:57 | 2020-10-13T20:06:12 | 40 | 0 | 0 | 1 | Java | false | false | package com.google.cloud.pso.pipeline.model;
import org.apache.beam.sdk.coders.AvroCoder;
import org.apache.beam.sdk.coders.DefaultCoder;
import java.util.Objects;
@DefaultCoder(AvroCoder.class)
public class PersonValidationError {
private Person person;
private String error;
// for avro coder
public PersonValidationError() {
}
public PersonValidationError(Person person, String error) {
this.person = person;
this.error = error;
}
public Person getPerson() {
return person;
}
public String getError() {
return error;
}
@Override
public String toString() {
return "PersonValidationError{" +
"person=" + person +
", error='" + error + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PersonValidationError that = (PersonValidationError) o;
return Objects.equals(person, that.person) &&
Objects.equals(error, that.error);
}
@Override
public int hashCode() {
return Objects.hash(person, error);
}
}
| UTF-8 | Java | 1,231 | java | PersonValidationError.java | Java | [] | null | [] | package com.google.cloud.pso.pipeline.model;
import org.apache.beam.sdk.coders.AvroCoder;
import org.apache.beam.sdk.coders.DefaultCoder;
import java.util.Objects;
@DefaultCoder(AvroCoder.class)
public class PersonValidationError {
private Person person;
private String error;
// for avro coder
public PersonValidationError() {
}
public PersonValidationError(Person person, String error) {
this.person = person;
this.error = error;
}
public Person getPerson() {
return person;
}
public String getError() {
return error;
}
@Override
public String toString() {
return "PersonValidationError{" +
"person=" + person +
", error='" + error + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PersonValidationError that = (PersonValidationError) o;
return Objects.equals(person, that.person) &&
Objects.equals(error, that.error);
}
@Override
public int hashCode() {
return Objects.hash(person, error);
}
}
| 1,231 | 0.599513 | 0.599513 | 54 | 21.796297 | 19.394901 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425926 | false | false | 5 |
63d89d3eda8ab97955ca89fbd8bdabd2060ae136 | 26,852,135,559,189 | f179ba5fe492b3e7f5e24501b80618d45320c808 | /PA1-A/build/generated-src/jacc/DecafJaccParser.java | d39e3afaa37f81e902c4df3b6b83b5aefaa1db80 | [
"MIT"
] | permissive | Suffoquer-fang/decaf | https://github.com/Suffoquer-fang/decaf | 7c78bd5b8772bfe5c767fceb3bdfa0b737122f0d | af38e4344ba94ff1fe27adb843b26f6231b9fd21 | refs/heads/master | 2020-08-27T18:28:08.783000 | 2019-11-22T07:21:29 | 2019-11-22T07:21:29 | 217,458,374 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | // Output created by jacc 2.1.0
package decaf.frontend.parsing;
import decaf.frontend.tree.Tree.*;
import java.util.Optional;
public class DecafJaccParser extends JaccParser.BaseParser implements JaccTokens {
private int yyss = 100;
private int yytok;
private int yysp = 0;
private int[] yyst;
protected int yyerrno = (-1);
private SemValue[] yysv;
private SemValue yyrv;
public boolean parse() {
int yyn = 0;
yysp = 0;
yyst = new int[yyss];
yysv = new SemValue[yyss];
yytok = (token
);
loop:
for (;;) {
switch (yyn) {
case 0:
yyst[yysp] = 0;
if (++yysp>=yyst.length) {
yyexpand();
}
case 201:
switch (yytok) {
case ABSTRACT:
yyn = 4;
continue;
case CLASS:
yyn = 5;
continue;
}
yyn = 405;
continue;
case 1:
yyst[yysp] = 1;
if (++yysp>=yyst.length) {
yyexpand();
}
case 202:
switch (yytok) {
case ENDINPUT:
yyn = 402;
continue;
}
yyn = 405;
continue;
case 2:
yyst[yysp] = 2;
if (++yysp>=yyst.length) {
yyexpand();
}
case 203:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr3();
continue;
}
yyn = 405;
continue;
case 3:
yyst[yysp] = 3;
if (++yysp>=yyst.length) {
yyexpand();
}
case 204:
switch (yytok) {
case ABSTRACT:
yyn = 4;
continue;
case CLASS:
yyn = 5;
continue;
case ENDINPUT:
yyn = yyr1();
continue;
}
yyn = 405;
continue;
case 4:
yyst[yysp] = 4;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 205:
switch (yytok) {
case CLASS:
yyn = 7;
continue;
}
yyn = 405;
continue;
case 5:
yyst[yysp] = 5;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 206:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 6:
yyst[yysp] = 6;
if (++yysp>=yyst.length) {
yyexpand();
}
case 207:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr2();
continue;
}
yyn = 405;
continue;
case 7:
yyst[yysp] = 7;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 208:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 8:
yyst[yysp] = 8;
if (++yysp>=yyst.length) {
yyexpand();
}
case 209:
switch (yytok) {
case EXTENDS:
yyn = 12;
continue;
case '{':
yyn = yyr7();
continue;
}
yyn = 405;
continue;
case 9:
yyst[yysp] = 9;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 210:
yyn = yys9();
continue;
case 10:
yyst[yysp] = 10;
if (++yysp>=yyst.length) {
yyexpand();
}
case 211:
switch (yytok) {
case EXTENDS:
yyn = 12;
continue;
case '{':
yyn = yyr7();
continue;
}
yyn = 405;
continue;
case 11:
yyst[yysp] = 11;
if (++yysp>=yyst.length) {
yyexpand();
}
case 212:
switch (yytok) {
case '{':
yyn = 14;
continue;
}
yyn = 405;
continue;
case 12:
yyst[yysp] = 12;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 213:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 13:
yyst[yysp] = 13;
if (++yysp>=yyst.length) {
yyexpand();
}
case 214:
switch (yytok) {
case '{':
yyn = 16;
continue;
}
yyn = 405;
continue;
case 14:
yyst[yysp] = 14;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 215:
yyn = yys14();
continue;
case 15:
yyst[yysp] = 15;
if (++yysp>=yyst.length) {
yyexpand();
}
case 216:
switch (yytok) {
case '{':
yyn = yyr6();
continue;
}
yyn = 405;
continue;
case 16:
yyst[yysp] = 16;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 217:
yyn = yys16();
continue;
case 17:
yyst[yysp] = 17;
if (++yysp>=yyst.length) {
yyexpand();
}
case 218:
yyn = yys17();
continue;
case 18:
yyst[yysp] = 18;
if (++yysp>=yyst.length) {
yyexpand();
}
case 219:
yyn = yys18();
continue;
case 19:
yyst[yysp] = 19;
if (++yysp>=yyst.length) {
yyexpand();
}
case 220:
yyn = yys19();
continue;
case 20:
yyst[yysp] = 20;
if (++yysp>=yyst.length) {
yyexpand();
}
case 221:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 21:
yyst[yysp] = 21;
if (++yysp>=yyst.length) {
yyexpand();
}
case 222:
switch (yytok) {
case ';':
yyn = 34;
continue;
}
yyn = 405;
continue;
case 22:
yyst[yysp] = 22;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 223:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 23:
yyst[yysp] = 23;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 224:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr20();
continue;
}
yyn = 405;
continue;
case 24:
yyst[yysp] = 24;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 225:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 25:
yyst[yysp] = 25;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 226:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr19();
continue;
}
yyn = 405;
continue;
case 26:
yyst[yysp] = 26;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 227:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 27:
yyst[yysp] = 27;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 228:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr21();
continue;
}
yyn = 405;
continue;
case 28:
yyst[yysp] = 28;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 229:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr22();
continue;
}
yyn = 405;
continue;
case 29:
yyst[yysp] = 29;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 230:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr4();
continue;
}
yyn = 405;
continue;
case 30:
yyst[yysp] = 30;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 231:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr5();
continue;
}
yyn = 405;
continue;
case 31:
yyst[yysp] = 31;
if (++yysp>=yyst.length) {
yyexpand();
}
case 232:
switch (yytok) {
case '(':
yyn = 38;
continue;
case ';':
yyn = yyr11();
continue;
}
yyn = 405;
continue;
case 32:
yyst[yysp] = 32;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 233:
yyn = yys32();
continue;
case 33:
yyst[yysp] = 33;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 234:
switch (yytok) {
case ']':
yyn = 42;
continue;
}
yyn = 405;
continue;
case 34:
yyst[yysp] = 34;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 235:
yyn = yys34();
continue;
case 35:
yyst[yysp] = 35;
if (++yysp>=yyst.length) {
yyexpand();
}
case 236:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 36:
yyst[yysp] = 36;
if (++yysp>=yyst.length) {
yyexpand();
}
case 237:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr23();
continue;
}
yyn = 405;
continue;
case 37:
yyst[yysp] = 37;
if (++yysp>=yyst.length) {
yyexpand();
}
case 238:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 38:
yyst[yysp] = 38;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 239:
yyn = yys38();
continue;
case 39:
yyst[yysp] = 39;
if (++yysp>=yyst.length) {
yyexpand();
}
case 240:
switch (yytok) {
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
case ',':
case ')':
yyn = yyr29();
continue;
}
yyn = 405;
continue;
case 40:
yyst[yysp] = 40;
if (++yysp>=yyst.length) {
yyexpand();
}
case 241:
switch (yytok) {
case ')':
yyn = 49;
continue;
}
yyn = 405;
continue;
case 41:
yyst[yysp] = 41;
if (++yysp>=yyst.length) {
yyexpand();
}
case 242:
switch (yytok) {
case ',':
yyn = 50;
continue;
case ')':
yyn = yyr26();
continue;
}
yyn = 405;
continue;
case 42:
yyst[yysp] = 42;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 243:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr24();
continue;
}
yyn = 405;
continue;
case 43:
yyst[yysp] = 43;
if (++yysp>=yyst.length) {
yyexpand();
}
case 244:
switch (yytok) {
case '(':
yyn = 51;
continue;
}
yyn = 405;
continue;
case 44:
yyst[yysp] = 44;
if (++yysp>=yyst.length) {
yyexpand();
}
case 245:
switch (yytok) {
case '(':
yyn = 52;
continue;
}
yyn = 405;
continue;
case 45:
yyst[yysp] = 45;
if (++yysp>=yyst.length) {
yyexpand();
}
case 246:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 46:
yyst[yysp] = 46;
if (++yysp>=yyst.length) {
yyexpand();
}
case 247:
switch (yytok) {
case ',':
case ')':
yyn = yyr18();
continue;
}
yyn = 405;
continue;
case 47:
yyst[yysp] = 47;
if (++yysp>=yyst.length) {
yyexpand();
}
case 248:
switch (yytok) {
case ')':
yyn = 54;
continue;
}
yyn = 405;
continue;
case 48:
yyst[yysp] = 48;
if (++yysp>=yyst.length) {
yyexpand();
}
case 249:
switch (yytok) {
case ',':
yyn = 55;
continue;
case ')':
yyn = yyr15();
continue;
}
yyn = 405;
continue;
case 49:
yyst[yysp] = 49;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 250:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr25();
continue;
}
yyn = 405;
continue;
case 50:
yyst[yysp] = 50;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 251:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 51:
yyst[yysp] = 51;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 252:
yyn = yys51();
continue;
case 52:
yyst[yysp] = 52;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 253:
yyn = yys52();
continue;
case 53:
yyst[yysp] = 53;
if (++yysp>=yyst.length) {
yyexpand();
}
case 254:
switch (yytok) {
case '=':
case ';':
case ',':
case ')':
yyn = yyr11();
continue;
}
yyn = 405;
continue;
case 54:
yyst[yysp] = 54;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 255:
switch (yytok) {
case '{':
yyn = 60;
continue;
}
yyn = 405;
continue;
case 55:
yyst[yysp] = 55;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 256:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 56:
yyst[yysp] = 56;
if (++yysp>=yyst.length) {
yyexpand();
}
case 257:
switch (yytok) {
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
case ',':
case ')':
yyn = yyr28();
continue;
}
yyn = 405;
continue;
case 57:
yyst[yysp] = 57;
if (++yysp>=yyst.length) {
yyexpand();
}
case 258:
switch (yytok) {
case ')':
yyn = 62;
continue;
}
yyn = 405;
continue;
case 58:
yyst[yysp] = 58;
if (++yysp>=yyst.length) {
yyexpand();
}
case 259:
switch (yytok) {
case ')':
yyn = 63;
continue;
}
yyn = 405;
continue;
case 59:
yyst[yysp] = 59;
if (++yysp>=yyst.length) {
yyexpand();
}
case 260:
yyn = yys59();
continue;
case 60:
yyst[yysp] = 60;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 261:
yyn = yys60();
continue;
case 61:
yyst[yysp] = 61;
if (++yysp>=yyst.length) {
yyexpand();
}
case 262:
switch (yytok) {
case ',':
case ')':
yyn = yyr17();
continue;
}
yyn = 405;
continue;
case 62:
yyst[yysp] = 62;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 263:
switch (yytok) {
case ';':
yyn = 65;
continue;
}
yyn = 405;
continue;
case 63:
yyst[yysp] = 63;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 264:
switch (yytok) {
case '{':
yyn = 60;
continue;
}
yyn = 405;
continue;
case 64:
yyst[yysp] = 64;
if (++yysp>=yyst.length) {
yyexpand();
}
case 265:
yyn = yys64();
continue;
case 65:
yyst[yysp] = 65;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 266:
yyn = yys65();
continue;
case 66:
yyst[yysp] = 66;
if (++yysp>=yyst.length) {
yyexpand();
}
case 267:
yyn = yys66();
continue;
case 67:
yyst[yysp] = 67;
if (++yysp>=yyst.length) {
yyexpand();
}
case 268:
yyn = yys67();
continue;
case 68:
yyst[yysp] = 68;
if (++yysp>=yyst.length) {
yyexpand();
}
case 269:
yyn = yys68();
continue;
case 69:
yyst[yysp] = 69;
if (++yysp>=yyst.length) {
yyexpand();
}
case 270:
yyn = yys69();
continue;
case 70:
yyst[yysp] = 70;
if (++yysp>=yyst.length) {
yyexpand();
}
case 271:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 71:
yyst[yysp] = 71;
if (++yysp>=yyst.length) {
yyexpand();
}
case 272:
switch (yytok) {
case ';':
yyn = 114;
continue;
}
yyn = 405;
continue;
case 72:
yyst[yysp] = 72;
if (++yysp>=yyst.length) {
yyexpand();
}
case 273:
yyn = yys72();
continue;
case 73:
yyst[yysp] = 73;
if (++yysp>=yyst.length) {
yyexpand();
}
case 274:
yyn = yys73();
continue;
case 74:
yyst[yysp] = 74;
if (++yysp>=yyst.length) {
yyexpand();
}
case 275:
switch (yytok) {
case '=':
yyn = 116;
continue;
case ';':
case ')':
yyn = yyr47();
continue;
}
yyn = 405;
continue;
case 75:
yyst[yysp] = 75;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 276:
yyn = yys75();
continue;
case 76:
yyst[yysp] = 76;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 277:
switch (yytok) {
case ';':
yyn = 117;
continue;
}
yyn = 405;
continue;
case 77:
yyst[yysp] = 77;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 278:
switch (yytok) {
case '(':
yyn = 118;
continue;
}
yyn = 405;
continue;
case 78:
yyst[yysp] = 78;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 279:
switch (yytok) {
case '(':
yyn = 119;
continue;
}
yyn = 405;
continue;
case 79:
yyst[yysp] = 79;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 280:
switch (yytok) {
case '(':
yyn = 120;
continue;
}
yyn = 405;
continue;
case 80:
yyst[yysp] = 80;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 281:
switch (yytok) {
case '(':
yyn = 121;
continue;
}
yyn = 405;
continue;
case 81:
yyst[yysp] = 81;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 282:
yyn = yys81();
continue;
case 82:
yyst[yysp] = 82;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 283:
yyn = yys82();
continue;
case 83:
yyst[yysp] = 83;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 284:
yyn = yys83();
continue;
case 84:
yyst[yysp] = 84;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 285:
switch (yytok) {
case '(':
yyn = 124;
continue;
}
yyn = 405;
continue;
case 85:
yyst[yysp] = 85;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 286:
switch (yytok) {
case '(':
yyn = 125;
continue;
}
yyn = 405;
continue;
case 86:
yyst[yysp] = 86;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 287:
switch (yytok) {
case '(':
yyn = 126;
continue;
}
yyn = 405;
continue;
case 87:
yyst[yysp] = 87;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 288:
yyn = yys87();
continue;
case 88:
yyst[yysp] = 88;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 289:
yyn = yys88();
continue;
case 89:
yyst[yysp] = 89;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 290:
yyn = yys89();
continue;
case 90:
yyst[yysp] = 90;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 291:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 91:
yyst[yysp] = 91;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 292:
switch (yytok) {
case '(':
yyn = 131;
continue;
}
yyn = 405;
continue;
case 92:
yyst[yysp] = 92;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 293:
yyn = yys92();
continue;
case 93:
yyst[yysp] = 93;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 294:
yyn = yys93();
continue;
case 94:
yyst[yysp] = 94;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 295:
yyn = yys94();
continue;
case 95:
yyst[yysp] = 95;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 296:
yyn = yys95();
continue;
case 96:
yyst[yysp] = 96;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 297:
yyn = yys96();
continue;
case 97:
yyst[yysp] = 97;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 298:
yyn = yys97();
continue;
case 98:
yyst[yysp] = 98;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 299:
yyn = yys98();
continue;
case 99:
yyst[yysp] = 99;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 300:
yyn = yys99();
continue;
case 100:
yyst[yysp] = 100;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 301:
yyn = yys100();
continue;
case 101:
yyst[yysp] = 101;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 302:
yyn = yys101();
continue;
case 102:
yyst[yysp] = 102;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 303:
yyn = yys102();
continue;
case 103:
yyst[yysp] = 103;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 304:
yyn = yys103();
continue;
case 104:
yyst[yysp] = 104;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 305:
yyn = yys104();
continue;
case 105:
yyst[yysp] = 105;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 306:
yyn = yys105();
continue;
case 106:
yyst[yysp] = 106;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 307:
yyn = yys106();
continue;
case 107:
yyst[yysp] = 107;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 308:
switch (yytok) {
case IDENTIFIER:
yyn = yyr86();
continue;
}
yyn = 405;
continue;
case 108:
yyst[yysp] = 108;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 309:
yyn = yys108();
continue;
case 109:
yyst[yysp] = 109;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 310:
yyn = yys109();
continue;
case 110:
yyst[yysp] = 110;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 311:
yyn = yys110();
continue;
case 111:
yyst[yysp] = 111;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 312:
yyn = yys111();
continue;
case 112:
yyst[yysp] = 112;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 313:
yyn = yys112();
continue;
case 113:
yyst[yysp] = 113;
if (++yysp>=yyst.length) {
yyexpand();
}
case 314:
yyn = yys113();
continue;
case 114:
yyst[yysp] = 114;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 315:
yyn = yys114();
continue;
case 115:
yyst[yysp] = 115;
if (++yysp>=yyst.length) {
yyexpand();
}
case 316:
switch (yytok) {
case ';':
case ')':
yyn = yyr41();
continue;
}
yyn = 405;
continue;
case 116:
yyst[yysp] = 116;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 317:
yyn = yys116();
continue;
case 117:
yyst[yysp] = 117;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 318:
yyn = yys117();
continue;
case 118:
yyst[yysp] = 118;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 319:
yyn = yys118();
continue;
case 119:
yyst[yysp] = 119;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 320:
yyn = yys119();
continue;
case 120:
yyst[yysp] = 120;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 321:
yyn = yys120();
continue;
case 121:
yyst[yysp] = 121;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 322:
yyn = yys121();
continue;
case 122:
yyst[yysp] = 122;
if (++yysp>=yyst.length) {
yyexpand();
}
case 323:
switch (yytok) {
case '(':
yyn = 159;
continue;
}
yyn = 405;
continue;
case 123:
yyst[yysp] = 123;
if (++yysp>=yyst.length) {
yyexpand();
}
case 324:
switch (yytok) {
case '(':
yyn = 32;
continue;
case '[':
yyn = 160;
continue;
}
yyn = 405;
continue;
case 124:
yyst[yysp] = 124;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 325:
yyn = yys124();
continue;
case 125:
yyst[yysp] = 125;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 326:
switch (yytok) {
case ')':
yyn = 162;
continue;
}
yyn = 405;
continue;
case 126:
yyst[yysp] = 126;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 327:
switch (yytok) {
case ')':
yyn = 163;
continue;
}
yyn = 405;
continue;
case 127:
yyst[yysp] = 127;
if (++yysp>=yyst.length) {
yyexpand();
}
case 328:
yyn = yys127();
continue;
case 128:
yyst[yysp] = 128;
if (++yysp>=yyst.length) {
yyexpand();
}
case 329:
switch (yytok) {
case ';':
yyn = 164;
continue;
}
yyn = 405;
continue;
case 129:
yyst[yysp] = 129;
if (++yysp>=yyst.length) {
yyexpand();
}
case 330:
yyn = yys129();
continue;
case 130:
yyst[yysp] = 130;
if (++yysp>=yyst.length) {
yyexpand();
}
case 331:
switch (yytok) {
case '=':
yyn = 165;
continue;
}
yyn = 405;
continue;
case 131:
yyst[yysp] = 131;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 332:
yyn = yys131();
continue;
case 132:
yyst[yysp] = 132;
if (++yysp>=yyst.length) {
yyexpand();
}
case 333:
yyn = yys132();
continue;
case 133:
yyst[yysp] = 133;
if (++yysp>=yyst.length) {
yyexpand();
}
case 334:
yyn = yys133();
continue;
case 134:
yyst[yysp] = 134;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 335:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 135:
yyst[yysp] = 135;
if (++yysp>=yyst.length) {
yyexpand();
}
case 336:
yyn = yys135();
continue;
case 136:
yyst[yysp] = 136;
if (++yysp>=yyst.length) {
yyexpand();
}
case 337:
yyn = yys136();
continue;
case 137:
yyst[yysp] = 137;
if (++yysp>=yyst.length) {
yyexpand();
}
case 338:
yyn = yys137();
continue;
case 138:
yyst[yysp] = 138;
if (++yysp>=yyst.length) {
yyexpand();
}
case 339:
yyn = yys138();
continue;
case 139:
yyst[yysp] = 139;
if (++yysp>=yyst.length) {
yyexpand();
}
case 340:
yyn = yys139();
continue;
case 140:
yyst[yysp] = 140;
if (++yysp>=yyst.length) {
yyexpand();
}
case 341:
yyn = yys140();
continue;
case 141:
yyst[yysp] = 141;
if (++yysp>=yyst.length) {
yyexpand();
}
case 342:
yyn = yys141();
continue;
case 142:
yyst[yysp] = 142;
if (++yysp>=yyst.length) {
yyexpand();
}
case 343:
yyn = yys142();
continue;
case 143:
yyst[yysp] = 143;
if (++yysp>=yyst.length) {
yyexpand();
}
case 344:
yyn = yys143();
continue;
case 144:
yyst[yysp] = 144;
if (++yysp>=yyst.length) {
yyexpand();
}
case 345:
switch (yytok) {
case ')':
yyn = 169;
continue;
}
yyn = 405;
continue;
case 145:
yyst[yysp] = 145;
if (++yysp>=yyst.length) {
yyexpand();
}
case 346:
switch (yytok) {
case ',':
yyn = 170;
continue;
case ')':
yyn = yyr89();
continue;
}
yyn = 405;
continue;
case 146:
yyst[yysp] = 146;
if (++yysp>=yyst.length) {
yyexpand();
}
case 347:
yyn = yys146();
continue;
case 147:
yyst[yysp] = 147;
if (++yysp>=yyst.length) {
yyexpand();
}
case 348:
yyn = yys147();
continue;
case 148:
yyst[yysp] = 148;
if (++yysp>=yyst.length) {
yyexpand();
}
case 349:
yyn = yys148();
continue;
case 149:
yyst[yysp] = 149;
if (++yysp>=yyst.length) {
yyexpand();
}
case 350:
yyn = yys149();
continue;
case 150:
yyst[yysp] = 150;
if (++yysp>=yyst.length) {
yyexpand();
}
case 351:
yyn = yys150();
continue;
case 151:
yyst[yysp] = 151;
if (++yysp>=yyst.length) {
yyexpand();
}
case 352:
yyn = yys151();
continue;
case 152:
yyst[yysp] = 152;
if (++yysp>=yyst.length) {
yyexpand();
}
case 353:
yyn = yys152();
continue;
case 153:
yyst[yysp] = 153;
if (++yysp>=yyst.length) {
yyexpand();
}
case 354:
yyn = yys153();
continue;
case 154:
yyst[yysp] = 154;
if (++yysp>=yyst.length) {
yyexpand();
}
case 355:
yyn = yys154();
continue;
case 155:
yyst[yysp] = 155;
if (++yysp>=yyst.length) {
yyexpand();
}
case 356:
switch (yytok) {
case ';':
yyn = 172;
continue;
}
yyn = 405;
continue;
case 156:
yyst[yysp] = 156;
if (++yysp>=yyst.length) {
yyexpand();
}
case 357:
switch (yytok) {
case ')':
yyn = 173;
continue;
}
yyn = 405;
continue;
case 157:
yyst[yysp] = 157;
if (++yysp>=yyst.length) {
yyexpand();
}
case 358:
yyn = yys157();
continue;
case 158:
yyst[yysp] = 158;
if (++yysp>=yyst.length) {
yyexpand();
}
case 359:
yyn = yys158();
continue;
case 159:
yyst[yysp] = 159;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 360:
switch (yytok) {
case ')':
yyn = 176;
continue;
}
yyn = 405;
continue;
case 160:
yyst[yysp] = 160;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 361:
yyn = yys160();
continue;
case 161:
yyst[yysp] = 161;
if (++yysp>=yyst.length) {
yyexpand();
}
case 362:
switch (yytok) {
case ')':
yyn = 178;
continue;
}
yyn = 405;
continue;
case 162:
yyst[yysp] = 162;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 363:
yyn = yys162();
continue;
case 163:
yyst[yysp] = 163;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 364:
yyn = yys163();
continue;
case 164:
yyst[yysp] = 164;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 365:
yyn = yys164();
continue;
case 165:
yyst[yysp] = 165;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 366:
yyn = yys165();
continue;
case 166:
yyst[yysp] = 166;
if (++yysp>=yyst.length) {
yyexpand();
}
case 367:
yyn = yys166();
continue;
case 167:
yyst[yysp] = 167;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 368:
yyn = yys167();
continue;
case 168:
yyst[yysp] = 168;
if (++yysp>=yyst.length) {
yyexpand();
}
case 369:
switch (yytok) {
case ')':
yyn = 181;
continue;
}
yyn = 405;
continue;
case 169:
yyst[yysp] = 169;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 370:
yyn = yys169();
continue;
case 170:
yyst[yysp] = 170;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 371:
yyn = yys170();
continue;
case 171:
yyst[yysp] = 171;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 372:
yyn = yys171();
continue;
case 172:
yyst[yysp] = 172;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 373:
yyn = yys172();
continue;
case 173:
yyst[yysp] = 173;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 374:
switch (yytok) {
case '{':
yyn = 60;
continue;
case ARROW:
yyn = 185;
continue;
}
yyn = 405;
continue;
case 174:
yyst[yysp] = 174;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 375:
yyn = yys174();
continue;
case 175:
yyst[yysp] = 175;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 376:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 176:
yyst[yysp] = 176;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 377:
yyn = yys176();
continue;
case 177:
yyst[yysp] = 177;
if (++yysp>=yyst.length) {
yyexpand();
}
case 378:
yyn = yys177();
continue;
case 178:
yyst[yysp] = 178;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 379:
switch (yytok) {
case ';':
yyn = 189;
continue;
}
yyn = 405;
continue;
case 179:
yyst[yysp] = 179;
if (++yysp>=yyst.length) {
yyexpand();
}
case 380:
yyn = yys179();
continue;
case 180:
yyst[yysp] = 180;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 381:
yyn = yys180();
continue;
case 181:
yyst[yysp] = 181;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 382:
yyn = yys181();
continue;
case 182:
yyst[yysp] = 182;
if (++yysp>=yyst.length) {
yyexpand();
}
case 383:
yyn = yys182();
continue;
case 183:
yyst[yysp] = 183;
if (++yysp>=yyst.length) {
yyexpand();
}
case 384:
yyn = yys183();
continue;
case 184:
yyst[yysp] = 184;
if (++yysp>=yyst.length) {
yyexpand();
}
case 385:
yyn = yys184();
continue;
case 185:
yyst[yysp] = 185;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 386:
yyn = yys185();
continue;
case 186:
yyst[yysp] = 186;
if (++yysp>=yyst.length) {
yyexpand();
}
case 387:
yyn = yys186();
continue;
case 187:
yyst[yysp] = 187;
if (++yysp>=yyst.length) {
yyexpand();
}
case 388:
switch (yytok) {
case ')':
yyn = 196;
continue;
}
yyn = 405;
continue;
case 188:
yyst[yysp] = 188;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 389:
yyn = yys188();
continue;
case 189:
yyst[yysp] = 189;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 390:
yyn = yys189();
continue;
case 190:
yyst[yysp] = 190;
if (++yysp>=yyst.length) {
yyexpand();
}
case 391:
yyn = yys190();
continue;
case 191:
yyst[yysp] = 191;
if (++yysp>=yyst.length) {
yyexpand();
}
case 392:
yyn = yys191();
continue;
case 192:
yyst[yysp] = 192;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 393:
yyn = yys192();
continue;
case 193:
yyst[yysp] = 193;
if (++yysp>=yyst.length) {
yyexpand();
}
case 394:
yyn = yys193();
continue;
case 194:
yyst[yysp] = 194;
if (++yysp>=yyst.length) {
yyexpand();
}
case 395:
yyn = yys194();
continue;
case 195:
yyst[yysp] = 195;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 396:
yyn = yys195();
continue;
case 196:
yyst[yysp] = 196;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 397:
yyn = yys196();
continue;
case 197:
yyst[yysp] = 197;
if (++yysp>=yyst.length) {
yyexpand();
}
case 398:
switch (yytok) {
case ')':
yyn = 199;
continue;
}
yyn = 405;
continue;
case 198:
yyst[yysp] = 198;
if (++yysp>=yyst.length) {
yyexpand();
}
case 399:
yyn = yys198();
continue;
case 199:
yyst[yysp] = 199;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 400:
yyn = yys199();
continue;
case 200:
yyst[yysp] = 200;
if (++yysp>=yyst.length) {
yyexpand();
}
case 401:
yyn = yys200();
continue;
case 402:
return true;
case 403:
yyerror("stack overflow");
case 404:
return false;
case 405:
yyerror("syntax error");
return false;
}
}
}
protected void yyexpand() {
int[] newyyst = new int[2*yyst.length];
SemValue[] newyysv = new SemValue[2*yyst.length];
for (int i=0; i<yyst.length; i++) {
newyyst[i] = yyst[i];
newyysv[i] = yysv[i];
}
yyst = newyyst;
yysv = newyysv;
}
private int yys9() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case '{':
case ']':
case '[':
case '=':
case '<':
case ';':
case OR:
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '/':
case EXTENDS:
case '+':
case '*':
case '>':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr93();
}
return 405;
}
private int yys14() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr10();
}
return 405;
}
private int yys16() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr10();
}
return 405;
}
private int yys17() {
switch (yytok) {
case ABSTRACT:
return 22;
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STATIC:
return 26;
case STRING:
return 27;
case VOID:
return 28;
case '}':
return 29;
}
return 405;
}
private int yys18() {
switch (yytok) {
case ABSTRACT:
return 22;
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STATIC:
return 26;
case STRING:
return 27;
case VOID:
return 28;
case '}':
return 30;
}
return 405;
}
private int yys19() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr9();
}
return 405;
}
private int yys32() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr27();
}
return 405;
}
private int yys34() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr8();
}
return 405;
}
private int yys38() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys51() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys52() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys59() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr13();
}
return 405;
}
private int yys60() {
switch (yytok) {
case ')':
case STATIC:
case '/':
case '*':
case ENDINPUT:
case UMINUS:
case '[':
case OR:
case NOT_EQUAL:
case '+':
case '%':
case EMPTY:
case ABSTRACT:
case ELSE:
case AND:
case ']':
case '>':
case '<':
case EQUAL:
case '.':
case EXTENDS:
case ',':
case ARROW:
case LESS_EQUAL:
case '=':
case error:
case GREATER_EQUAL:
return 405;
}
return yyr40();
}
private int yys64() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case '}':
return 95;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys65() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr14();
}
return 405;
}
private int yys66() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr12();
}
return 405;
}
private int yys67() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
return yyr88();
case ';':
case ')':
return yyr43();
}
return 405;
}
private int yys68() {
switch (yytok) {
case '=':
return 112;
case IDENTIFIER:
case GREATER_EQUAL:
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr54();
}
return 405;
}
private int yys69() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr52();
}
return 405;
}
private int yys72() {
switch (yytok) {
case ')':
case STATIC:
case '/':
case '*':
case ENDINPUT:
case UMINUS:
case '[':
case OR:
case NOT_EQUAL:
case '+':
case '%':
case EMPTY:
case ABSTRACT:
case ELSE:
case AND:
case ']':
case '>':
case '<':
case EQUAL:
case '.':
case EXTENDS:
case ',':
case ARROW:
case LESS_EQUAL:
case '=':
case error:
case GREATER_EQUAL:
return 405;
}
return yyr39();
}
private int yys73() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr30();
}
private int yys75() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr81();
}
return 405;
}
private int yys81() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr80();
}
return 405;
}
private int yys82() {
switch (yytok) {
case IDENTIFIER:
return 9;
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
}
return 405;
}
private int yys83() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr83();
}
return 405;
}
private int yys87() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case ';':
return yyr51();
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys88() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr82();
}
return 405;
}
private int yys89() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr53();
}
return 405;
}
private int yys92() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys93() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case CLASS:
return 134;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys94() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys95() {
switch (yytok) {
case '=':
case UMINUS:
case ENDINPUT:
case error:
case EXTENDS:
case ARROW:
case EMPTY:
return 405;
}
return yyr38();
}
private int yys96() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys97() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys98() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys99() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys100() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys101() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys102() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys103() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case ')':
return yyr90();
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys104() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys105() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys106() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys108() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys109() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys110() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys111() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys112() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys113() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '=':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case '>':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr84();
}
return 405;
}
private int yys114() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr31();
}
private int yys116() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys117() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr35();
}
private int yys118() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys119() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys120() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys121() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys124() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case ')':
return yyr90();
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys127() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ';':
return yyr50();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys129() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr54();
}
return 405;
}
private int yys131() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys132() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr71();
}
return 405;
}
private int yys133() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ')':
return 167;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys135() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr70();
}
return 405;
}
private int yys136() {
switch (yytok) {
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
case AND:
return yyr67();
}
return 405;
}
private int yys137() {
switch (yytok) {
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
case AND:
return yyr61();
}
return 405;
}
private int yys138() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr66();
}
return 405;
}
private int yys139() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr65();
}
return 405;
}
private int yys140() {
switch (yytok) {
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
case AND:
return yyr62();
}
return 405;
}
private int yys141() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
return yyr68();
}
return 405;
}
private int yys142() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr60();
}
return 405;
}
private int yys143() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ',':
case ')':
return yyr92();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys146() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr58();
}
return 405;
}
private int yys147() {
switch (yytok) {
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '.':
return 107;
case '/':
return 108;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '-':
case ',':
case NOT_EQUAL:
case '+':
case ')':
case LESS_EQUAL:
case EQUAL:
case AND:
return yyr56();
}
return 405;
}
private int yys148() {
switch (yytok) {
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '.':
return 107;
case '/':
return 108;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '-':
case ',':
case NOT_EQUAL:
case '+':
case ')':
case LESS_EQUAL:
case EQUAL:
case AND:
return yyr57();
}
return 405;
}
private int yys149() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr59();
}
return 405;
}
private int yys150() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr63();
}
return 405;
}
private int yys151() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr64();
}
return 405;
}
private int yys152() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ']':
return 171;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys153() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
return yyr88();
case ';':
case ')':
return yyr42();
}
return 405;
}
private int yys154() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ';':
case ')':
return yyr46();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys157() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ')':
return 174;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys158() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ',':
return 175;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys160() {
switch (yytok) {
case ']':
return 42;
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys162() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr72();
}
return 405;
}
private int yys163() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr73();
}
return 405;
}
private int yys164() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr36();
}
private int yys165() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys166() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ')':
return 180;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys167() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr69();
}
return 405;
}
private int yys169() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr55();
}
return 405;
}
private int yys170() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys171() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '=':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case '>':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr85();
}
return 405;
}
private int yys172() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys174() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys176() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr74();
}
return 405;
}
private int yys177() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ']':
return 188;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys179() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
return yyr88();
case ';':
case ')':
return yyr45();
}
return 405;
}
private int yys180() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys181() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys182() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ',':
case ')':
return yyr91();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys183() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ';':
return 192;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys184() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr79();
}
return 405;
}
private int yys185() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys186() {
switch (yytok) {
case GREATER_EQUAL:
case STATIC:
case ')':
case '*':
case ENDINPUT:
case UMINUS:
case '/':
case OR:
case NOT_EQUAL:
case '+':
case '%':
case EMPTY:
case ABSTRACT:
case AND:
case '[':
case ']':
case '>':
case '<':
case EQUAL:
case '.':
case EXTENDS:
case ',':
case ARROW:
case LESS_EQUAL:
case '=':
case error:
return 405;
case ELSE:
return 195;
}
return yyr49();
}
private int yys188() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr75();
}
return 405;
}
private int yys189() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr37();
}
private int yys190() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr33();
}
private int yys191() {
switch (yytok) {
case '(':
return 103;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr77();
}
return 405;
}
private int yys192() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ')':
return yyr44();
}
return 405;
}
private int yys193() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case ',':
case ')':
return yyr78();
}
return 405;
}
private int yys194() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr32();
}
private int yys195() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys196() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr76();
}
return 405;
}
private int yys198() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr48();
}
private int yys199() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys200() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr34();
}
private int yyr1() { // TopLevel : ClassList
{
tree = new TopLevel(yysv[yysp-1].classList, yysv[yysp-1].pos);
}
yysv[yysp-=1] = yyrv;
return 1;
}
private int yyr4() { // ClassDef : CLASS Id ExtendsClause '{' FieldList '}'
{
yyrv = svClass(new ClassDef(false, yysv[yysp-5].id, Optional.ofNullable(yysv[yysp-4].id), yysv[yysp-2].fieldList, yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypClassDef();
}
private int yyr5() { // ClassDef : ABSTRACT CLASS Id ExtendsClause '{' FieldList '}'
{
yyrv = svClass(new ClassDef(true, yysv[yysp-5].id, Optional.ofNullable(yysv[yysp-4].id), yysv[yysp-2].fieldList, yysv[yysp-6].pos));
}
yysv[yysp-=7] = yyrv;
return yypClassDef();
}
private int yypClassDef() {
switch (yyst[yysp-1]) {
case 0: return 2;
default: return 6;
}
}
private int yyr2() { // ClassList : ClassList ClassDef
{
yyrv = yysv[yysp-2];
yyrv.classList.add(yysv[yysp-1].clazz);
}
yysv[yysp-=2] = yyrv;
return 3;
}
private int yyr3() { // ClassList : ClassDef
{
yyrv = svClasses(yysv[yysp-1].clazz);
}
yysv[yysp-=1] = yyrv;
return 3;
}
private int yyr48() { // ElseClause : ELSE Stmt
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=2] = yyrv;
return 194;
}
private int yyr49() { // ElseClause : /* empty */
{
yyrv = svStmt(null);
}
yysv[yysp-=0] = yyrv;
return 194;
}
private int yyr52() { // Expr : Literal
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return yypExpr();
}
private int yyr53() { // Expr : THIS
{
yyrv = svExpr(new This(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypExpr();
}
private int yyr54() { // Expr : LValue
{
yyrv = svExpr(yysv[yysp-1].lValue);
}
yysv[yysp-=1] = yyrv;
return yypExpr();
}
private int yyr55() { // Expr : Expr '(' ExprList ')'
{
yyrv = svExpr(new Call(Optional.ofNullable(yysv[yysp-4].expr), yysv[yysp-2].exprList, yysv[yysp-3].pos));
}
yysv[yysp-=4] = yyrv;
return yypExpr();
}
private int yyr56() { // Expr : Expr '+' Expr
{
yyrv = svExpr(new Binary(BinaryOp.ADD, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr57() { // Expr : Expr '-' Expr
{
yyrv = svExpr(new Binary(BinaryOp.SUB, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr58() { // Expr : Expr '*' Expr
{
yyrv = svExpr(new Binary(BinaryOp.MUL, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr59() { // Expr : Expr '/' Expr
{
yyrv = svExpr(new Binary(BinaryOp.DIV, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr60() { // Expr : Expr '%' Expr
{
yyrv = svExpr(new Binary(BinaryOp.MOD, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr61() { // Expr : Expr EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.EQ, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr62() { // Expr : Expr NOT_EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.NE, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr63() { // Expr : Expr '<' Expr
{
yyrv = svExpr(new Binary(BinaryOp.LT, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr64() { // Expr : Expr '>' Expr
{
yyrv = svExpr(new Binary(BinaryOp.GT, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr65() { // Expr : Expr LESS_EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.LE, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr66() { // Expr : Expr GREATER_EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.GE, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr67() { // Expr : Expr AND Expr
{
yyrv = svExpr(new Binary(BinaryOp.AND, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr68() { // Expr : Expr OR Expr
{
yyrv = svExpr(new Binary(BinaryOp.OR, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr69() { // Expr : '(' Expr ')'
{
yyrv = yysv[yysp-2];
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr70() { // Expr : '-' Expr
{
yyrv = svExpr(new Unary(UnaryOp.NEG, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypExpr();
}
private int yyr71() { // Expr : '!' Expr
{
yyrv = svExpr(new Unary(UnaryOp.NOT, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypExpr();
}
private int yyr72() { // Expr : READ_INTEGER '(' ')'
{
yyrv = svExpr(new ReadInt(yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr73() { // Expr : READ_LINE '(' ')'
{
yyrv = svExpr(new ReadLine(yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr74() { // Expr : NEW Id '(' ')'
{
yyrv = svExpr(new NewClass(yysv[yysp-3].id, yysv[yysp-4].pos));
}
yysv[yysp-=4] = yyrv;
return yypExpr();
}
private int yyr75() { // Expr : NEW Type '[' Expr ']'
{
yyrv = svExpr(new NewArray(yysv[yysp-4].type, yysv[yysp-2].expr, yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypExpr();
}
private int yyr76() { // Expr : INSTANCE_OF '(' Expr ',' Id ')'
{
yyrv = svExpr(new ClassTest(yysv[yysp-4].expr, yysv[yysp-2].id, yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypExpr();
}
private int yyr77() { // Expr : '(' CLASS Id ')' Expr
{
yyrv = svExpr(new ClassCast(yysv[yysp-1].expr, yysv[yysp-3].id, yysv[yysp-1].expr.pos));
}
yysv[yysp-=5] = yyrv;
return yypExpr();
}
private int yyr78() { // Expr : FUN '(' VarList ')' ARROW Expr
{
yyrv = svExpr(new Lambda(false, yysv[yysp-4].varList, Optional.ofNullable(yysv[yysp-1].expr), Optional.empty(), yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypExpr();
}
private int yyr79() { // Expr : FUN '(' VarList ')' Block
{
yyrv = svExpr(new Lambda(true, yysv[yysp-3].varList, Optional.empty(), Optional.ofNullable(yysv[yysp-1].block), yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypExpr();
}
private int yypExpr() {
switch (yyst[yysp-1]) {
case 185: return 193;
case 181: return 191;
case 172: return 183;
case 170: return 182;
case 165: return 179;
case 160: return 177;
case 131: return 166;
case 124: return 143;
case 121: return 158;
case 120: return 157;
case 116: return 154;
case 112: return 153;
case 111: return 152;
case 110: return 151;
case 109: return 150;
case 108: return 149;
case 106: return 148;
case 105: return 147;
case 104: return 146;
case 103: return 143;
case 102: return 142;
case 101: return 141;
case 100: return 140;
case 99: return 139;
case 98: return 138;
case 97: return 137;
case 96: return 136;
case 94: return 135;
case 93: return 133;
case 92: return 132;
case 87: return 127;
default: return 67;
}
}
private int yyr89() { // ExprList : ExprList1
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return yypExprList();
}
private int yyr90() { // ExprList : /* empty */
{
yyrv = svExprs();
}
yysv[yysp-=0] = yyrv;
return yypExprList();
}
private int yypExprList() {
switch (yyst[yysp-1]) {
case 103: return 144;
default: return 161;
}
}
private int yyr91() { // ExprList1 : ExprList1 ',' Expr
{
yyrv = yysv[yysp-3];
yyrv.exprList.add(yysv[yysp-1].expr);
}
yysv[yysp-=3] = yyrv;
return 145;
}
private int yyr92() { // ExprList1 : Expr
{
yyrv = svExprs(yysv[yysp-1].expr);
}
yysv[yysp-=1] = yyrv;
return 145;
}
private int yyr50() { // ExprOpt : Expr
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return 128;
}
private int yyr51() { // ExprOpt : /* empty */
{
yyrv = svExpr(null);
}
yysv[yysp-=0] = yyrv;
return 128;
}
private int yyr6() { // ExtendsClause : EXTENDS Id
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=2] = yyrv;
return yypExtendsClause();
}
private int yyr7() { // ExtendsClause : /* empty */
{
yyrv = svId(null);
}
yysv[yysp-=0] = yyrv;
return yypExtendsClause();
}
private int yypExtendsClause() {
switch (yyst[yysp-1]) {
case 8: return 11;
default: return 13;
}
}
private int yyr8() { // FieldList : FieldList Var ';'
{
yyrv = yysv[yysp-3];
yyrv.fieldList.add(new VarDef(yysv[yysp-2].type, yysv[yysp-2].id, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypFieldList();
}
private int yyr9() { // FieldList : FieldList MethodDef
{
yyrv = yysv[yysp-2];
yyrv.fieldList.add(yysv[yysp-1].field);
}
yysv[yysp-=2] = yyrv;
return yypFieldList();
}
private int yyr10() { // FieldList : /* empty */
{
yyrv = svFields();
}
yysv[yysp-=0] = yyrv;
return yypFieldList();
}
private int yypFieldList() {
switch (yyst[yysp-1]) {
case 14: return 17;
default: return 18;
}
}
private int yyr93() { // Id : IDENTIFIER
{
yyrv = svId(new Id(yysv[yysp-1].strVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
switch (yyst[yysp-1]) {
case 134: return 168;
case 90: return 130;
case 82: return 122;
case 70: return 113;
case 45: return 53;
case 37: return 44;
case 35: return 43;
case 24: return 36;
case 20: return 31;
case 12: return 15;
case 7: return 10;
case 5: return 8;
default: return 187;
}
}
private int yyr46() { // Initializer : '=' Expr
{
yyrv = svExpr(yysv[yysp-1].expr);
yyrv.pos = yysv[yysp-2].pos;
}
yysv[yysp-=2] = yyrv;
return 115;
}
private int yyr47() { // Initializer : /* empty */
{
yyrv = svExpr(null);
}
yysv[yysp-=0] = yyrv;
return 115;
}
private int yyr84() { // LValue : Receiver Id
{
yyrv = svLValue(new VarSel(Optional.ofNullable(yysv[yysp-2].expr), yysv[yysp-1].id, yysv[yysp-1].pos));
}
yysv[yysp-=2] = yyrv;
return yypLValue();
}
private int yyr85() { // LValue : Expr '[' Expr ']'
{
yyrv = svLValue(new IndexSel(yysv[yysp-4].expr, yysv[yysp-2].expr, yysv[yysp-3].pos));
}
yysv[yysp-=4] = yyrv;
return yypLValue();
}
private int yypLValue() {
switch (yyst[yysp-1]) {
case 199: return 68;
case 195: return 68;
case 192: return 68;
case 180: return 68;
case 174: return 68;
case 118: return 68;
case 64: return 68;
default: return 129;
}
}
private int yyr80() { // Literal : INT_LIT
{
yyrv = svExpr(new IntLit(yysv[yysp-1].intVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr81() { // Literal : BOOL_LIT
{
yyrv = svExpr(new BoolLit(yysv[yysp-1].boolVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr82() { // Literal : STRING_LIT
{
yyrv = svExpr(new StringLit(yysv[yysp-1].strVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr83() { // Literal : NULL
{
yyrv = svExpr(new NullLit(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr12() { // MethodDef : STATIC Type Id '(' VarList ')' Block
{
yyrv = svField(new MethodDef(true, false, yysv[yysp-5].id, yysv[yysp-6].type, yysv[yysp-3].varList, Optional.ofNullable(yysv[yysp-1].block), yysv[yysp-5].pos));
}
yysv[yysp-=7] = yyrv;
return 19;
}
private int yyr13() { // MethodDef : Type Id '(' VarList ')' Block
{
yyrv = svField(new MethodDef(false, false, yysv[yysp-5].id, yysv[yysp-6].type, yysv[yysp-3].varList, Optional.ofNullable(yysv[yysp-1].block), yysv[yysp-5].pos));
}
yysv[yysp-=6] = yyrv;
return 19;
}
private int yyr14() { // MethodDef : ABSTRACT Type Id '(' VarList ')' ';'
{
yyrv = svField(new MethodDef(false, true, yysv[yysp-5].id, yysv[yysp-6].type, yysv[yysp-3].varList, Optional.empty(), yysv[yysp-5].pos));
}
yysv[yysp-=7] = yyrv;
return 19;
}
private int yyr86() { // Receiver : Expr '.'
{
yyrv = yysv[yysp-2];
}
yysv[yysp-=2] = yyrv;
return 70;
}
private int yyr87() { // Receiver : /* empty */
{
yyrv = svExpr(null);
}
yysv[yysp-=0] = yyrv;
return 70;
}
private int yyr88() { // Receiver : Expr
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return 70;
}
private int yyr41() { // SimpleStmt : Var Initializer
{
yyrv = svStmt(new LocalVarDef(Optional.ofNullable(yysv[yysp-2].type), yysv[yysp-2].id, yysv[yysp-1].pos, Optional.ofNullable(yysv[yysp-1].expr), yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypSimpleStmt();
}
private int yyr42() { // SimpleStmt : LValue '=' Expr
{
yyrv = svStmt(new Assign(yysv[yysp-3].lValue, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypSimpleStmt();
}
private int yyr43() { // SimpleStmt : Expr
{
yyrv = svStmt(new ExprEval(yysv[yysp-1].expr, yysv[yysp-1].expr.pos));
}
yysv[yysp-=1] = yyrv;
return yypSimpleStmt();
}
private int yyr44() { // SimpleStmt : /* empty */
{
yyrv = svStmt(null);
}
yysv[yysp-=0] = yyrv;
return yypSimpleStmt();
}
private int yyr45() { // SimpleStmt : VAR Id '=' Expr
{
yyrv = svStmt(new LocalVarDef(Optional.empty(), yysv[yysp-3].id, yysv[yysp-3].pos, Optional.ofNullable(yysv[yysp-1].expr), yysv[yysp-3].pos));
}
yysv[yysp-=4] = yyrv;
return yypSimpleStmt();
}
private int yypSimpleStmt() {
switch (yyst[yysp-1]) {
case 192: return 197;
case 118: return 155;
default: return 71;
}
}
private int yyr30() { // Stmt : Block
{
yyrv = svStmt(yysv[yysp-1].block);
}
yysv[yysp-=1] = yyrv;
return yypStmt();
}
private int yyr31() { // Stmt : SimpleStmt ';'
{
if (yysv[yysp-2].stmt == null) {
yyrv = svStmt(new Skip(yysv[yysp-1].pos));
} else {
yyrv = yysv[yysp-2];
}
}
yysv[yysp-=2] = yyrv;
return yypStmt();
}
private int yyr32() { // Stmt : IF '(' Expr ')' Stmt ElseClause
{
yyrv = svStmt(new If(yysv[yysp-4].expr, yysv[yysp-2].stmt, Optional.ofNullable(yysv[yysp-1].stmt), yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypStmt();
}
private int yyr33() { // Stmt : WHILE '(' Expr ')' Stmt
{
yyrv = svStmt(new While(yysv[yysp-3].expr, yysv[yysp-1].stmt, yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypStmt();
}
private int yyr34() { // Stmt : FOR '(' SimpleStmt ';' Expr ';' SimpleStmt ')' Stmt
{
if (yysv[yysp-7].stmt == null) yysv[yysp-7].stmt = new Skip(yysv[yysp-6].pos);
if (yysv[yysp-3].stmt == null) yysv[yysp-3].stmt = new Skip(yysv[yysp-2].pos);
yyrv = svStmt(new For(yysv[yysp-7].stmt, yysv[yysp-5].expr, yysv[yysp-3].stmt, yysv[yysp-1].stmt, yysv[yysp-9].pos));
}
yysv[yysp-=9] = yyrv;
return yypStmt();
}
private int yyr35() { // Stmt : BREAK ';'
{
yyrv = svStmt(new Break(yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypStmt();
}
private int yyr36() { // Stmt : RETURN ExprOpt ';'
{
yyrv = svStmt(new Return(Optional.ofNullable(yysv[yysp-2].expr), yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
return yypStmt();
}
private int yyr37() { // Stmt : PRINT '(' ExprList ')' ';'
{
yyrv = svStmt(new Print(yysv[yysp-3].exprList, yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypStmt();
}
private int yypStmt() {
switch (yyst[yysp-1]) {
case 195: return 198;
case 180: return 190;
case 174: return 186;
case 64: return 72;
default: return 200;
}
}
private int yyr39() { // StmtList : StmtList Stmt
{
yyrv = yysv[yysp-2];
yyrv.stmtList.add(yysv[yysp-1].stmt);
}
yysv[yysp-=2] = yyrv;
return 64;
}
private int yyr40() { // StmtList : /* empty */
{
yyrv = svStmts();
}
yysv[yysp-=0] = yyrv;
return 64;
}
private int yyr38() { // Block : '{' StmtList '}'
{
yyrv = svBlock(new Block(yysv[yysp-2].stmtList, yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
switch (yyst[yysp-1]) {
case 173: return 184;
case 63: return 66;
case 54: return 59;
default: return 73;
}
}
private int yyr19() { // Type : INT
{
yyrv = svType(new TInt(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr20() { // Type : BOOL
{
yyrv = svType(new TBool(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr21() { // Type : STRING
{
yyrv = svType(new TString(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr22() { // Type : VOID
{
yyrv = svType(new TVoid(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr23() { // Type : CLASS Id
{
yyrv = svType(new TClass(yysv[yysp-1].id, yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypType();
}
private int yyr24() { // Type : Type '[' ']'
{
yyrv = svType(new TArray(yysv[yysp-3].type, yysv[yysp-3].type.pos));
}
yysv[yysp-=3] = yyrv;
return yypType();
}
private int yyr25() { // Type : Type '(' TypeList ')'
{
yyrv = svType(new TLambda(yysv[yysp-4].type, yysv[yysp-2].typeList, yysv[yysp-4].type.pos));
}
yysv[yysp-=4] = yyrv;
return yypType();
}
private int yypType() {
switch (yyst[yysp-1]) {
case 82: return 123;
case 50: return 56;
case 32: return 39;
case 26: return 37;
case 22: return 35;
case 18: return 20;
case 17: return 20;
default: return 45;
}
}
private int yyr26() { // TypeList : TypeList1
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return 40;
}
private int yyr27() { // TypeList : /* empty */
{
yyrv = svTypes();
}
yysv[yysp-=0] = yyrv;
return 40;
}
private int yyr28() { // TypeList1 : TypeList1 ',' Type
{
yyrv = yysv[yysp-3];
yyrv.typeList.add(yysv[yysp-1].type);
}
yysv[yysp-=3] = yyrv;
return 41;
}
private int yyr29() { // TypeList1 : Type
{
yyrv = svTypes(yysv[yysp-1].type);
}
yysv[yysp-=1] = yyrv;
return 41;
}
private int yyr11() { // Var : Type Id
{
yyrv = svVar(yysv[yysp-2].type, yysv[yysp-1].id, yysv[yysp-1].pos);
}
yysv[yysp-=2] = yyrv;
switch (yyst[yysp-1]) {
case 119: return 46;
case 55: return 61;
case 52: return 46;
case 51: return 46;
case 38: return 46;
case 18: return 21;
case 17: return 21;
default: return 74;
}
}
private int yyr15() { // VarList : VarList1
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return yypVarList();
}
private int yyr16() { // VarList : /* empty */
{
yyrv = svVars();
}
yysv[yysp-=0] = yyrv;
return yypVarList();
}
private int yypVarList() {
switch (yyst[yysp-1]) {
case 52: return 58;
case 51: return 57;
case 38: return 47;
default: return 156;
}
}
private int yyr17() { // VarList1 : VarList1 ',' Var
{
yyrv = yysv[yysp-3];
yyrv.varList.add(new LocalVarDef(Optional.ofNullable(yysv[yysp-1].type), yysv[yysp-1].id, yysv[yysp-1].pos));
}
yysv[yysp-=3] = yyrv;
return 48;
}
private int yyr18() { // VarList1 : Var
{
yyrv = svVars(new LocalVarDef(Optional.ofNullable(yysv[yysp-1].type), yysv[yysp-1].id, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 48;
}
protected String[] yyerrmsgs = {
};
}
| UTF-8 | Java | 208,452 | java | DecafJaccParser.java | Java | [] | null | [] | // Output created by jacc 2.1.0
package decaf.frontend.parsing;
import decaf.frontend.tree.Tree.*;
import java.util.Optional;
public class DecafJaccParser extends JaccParser.BaseParser implements JaccTokens {
private int yyss = 100;
private int yytok;
private int yysp = 0;
private int[] yyst;
protected int yyerrno = (-1);
private SemValue[] yysv;
private SemValue yyrv;
public boolean parse() {
int yyn = 0;
yysp = 0;
yyst = new int[yyss];
yysv = new SemValue[yyss];
yytok = (token
);
loop:
for (;;) {
switch (yyn) {
case 0:
yyst[yysp] = 0;
if (++yysp>=yyst.length) {
yyexpand();
}
case 201:
switch (yytok) {
case ABSTRACT:
yyn = 4;
continue;
case CLASS:
yyn = 5;
continue;
}
yyn = 405;
continue;
case 1:
yyst[yysp] = 1;
if (++yysp>=yyst.length) {
yyexpand();
}
case 202:
switch (yytok) {
case ENDINPUT:
yyn = 402;
continue;
}
yyn = 405;
continue;
case 2:
yyst[yysp] = 2;
if (++yysp>=yyst.length) {
yyexpand();
}
case 203:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr3();
continue;
}
yyn = 405;
continue;
case 3:
yyst[yysp] = 3;
if (++yysp>=yyst.length) {
yyexpand();
}
case 204:
switch (yytok) {
case ABSTRACT:
yyn = 4;
continue;
case CLASS:
yyn = 5;
continue;
case ENDINPUT:
yyn = yyr1();
continue;
}
yyn = 405;
continue;
case 4:
yyst[yysp] = 4;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 205:
switch (yytok) {
case CLASS:
yyn = 7;
continue;
}
yyn = 405;
continue;
case 5:
yyst[yysp] = 5;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 206:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 6:
yyst[yysp] = 6;
if (++yysp>=yyst.length) {
yyexpand();
}
case 207:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr2();
continue;
}
yyn = 405;
continue;
case 7:
yyst[yysp] = 7;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 208:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 8:
yyst[yysp] = 8;
if (++yysp>=yyst.length) {
yyexpand();
}
case 209:
switch (yytok) {
case EXTENDS:
yyn = 12;
continue;
case '{':
yyn = yyr7();
continue;
}
yyn = 405;
continue;
case 9:
yyst[yysp] = 9;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 210:
yyn = yys9();
continue;
case 10:
yyst[yysp] = 10;
if (++yysp>=yyst.length) {
yyexpand();
}
case 211:
switch (yytok) {
case EXTENDS:
yyn = 12;
continue;
case '{':
yyn = yyr7();
continue;
}
yyn = 405;
continue;
case 11:
yyst[yysp] = 11;
if (++yysp>=yyst.length) {
yyexpand();
}
case 212:
switch (yytok) {
case '{':
yyn = 14;
continue;
}
yyn = 405;
continue;
case 12:
yyst[yysp] = 12;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 213:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 13:
yyst[yysp] = 13;
if (++yysp>=yyst.length) {
yyexpand();
}
case 214:
switch (yytok) {
case '{':
yyn = 16;
continue;
}
yyn = 405;
continue;
case 14:
yyst[yysp] = 14;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 215:
yyn = yys14();
continue;
case 15:
yyst[yysp] = 15;
if (++yysp>=yyst.length) {
yyexpand();
}
case 216:
switch (yytok) {
case '{':
yyn = yyr6();
continue;
}
yyn = 405;
continue;
case 16:
yyst[yysp] = 16;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 217:
yyn = yys16();
continue;
case 17:
yyst[yysp] = 17;
if (++yysp>=yyst.length) {
yyexpand();
}
case 218:
yyn = yys17();
continue;
case 18:
yyst[yysp] = 18;
if (++yysp>=yyst.length) {
yyexpand();
}
case 219:
yyn = yys18();
continue;
case 19:
yyst[yysp] = 19;
if (++yysp>=yyst.length) {
yyexpand();
}
case 220:
yyn = yys19();
continue;
case 20:
yyst[yysp] = 20;
if (++yysp>=yyst.length) {
yyexpand();
}
case 221:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 21:
yyst[yysp] = 21;
if (++yysp>=yyst.length) {
yyexpand();
}
case 222:
switch (yytok) {
case ';':
yyn = 34;
continue;
}
yyn = 405;
continue;
case 22:
yyst[yysp] = 22;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 223:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 23:
yyst[yysp] = 23;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 224:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr20();
continue;
}
yyn = 405;
continue;
case 24:
yyst[yysp] = 24;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 225:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 25:
yyst[yysp] = 25;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 226:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr19();
continue;
}
yyn = 405;
continue;
case 26:
yyst[yysp] = 26;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 227:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 27:
yyst[yysp] = 27;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 228:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr21();
continue;
}
yyn = 405;
continue;
case 28:
yyst[yysp] = 28;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 229:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr22();
continue;
}
yyn = 405;
continue;
case 29:
yyst[yysp] = 29;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 230:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr4();
continue;
}
yyn = 405;
continue;
case 30:
yyst[yysp] = 30;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 231:
switch (yytok) {
case ENDINPUT:
case CLASS:
case ABSTRACT:
yyn = yyr5();
continue;
}
yyn = 405;
continue;
case 31:
yyst[yysp] = 31;
if (++yysp>=yyst.length) {
yyexpand();
}
case 232:
switch (yytok) {
case '(':
yyn = 38;
continue;
case ';':
yyn = yyr11();
continue;
}
yyn = 405;
continue;
case 32:
yyst[yysp] = 32;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 233:
yyn = yys32();
continue;
case 33:
yyst[yysp] = 33;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 234:
switch (yytok) {
case ']':
yyn = 42;
continue;
}
yyn = 405;
continue;
case 34:
yyst[yysp] = 34;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 235:
yyn = yys34();
continue;
case 35:
yyst[yysp] = 35;
if (++yysp>=yyst.length) {
yyexpand();
}
case 236:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 36:
yyst[yysp] = 36;
if (++yysp>=yyst.length) {
yyexpand();
}
case 237:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr23();
continue;
}
yyn = 405;
continue;
case 37:
yyst[yysp] = 37;
if (++yysp>=yyst.length) {
yyexpand();
}
case 238:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 38:
yyst[yysp] = 38;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 239:
yyn = yys38();
continue;
case 39:
yyst[yysp] = 39;
if (++yysp>=yyst.length) {
yyexpand();
}
case 240:
switch (yytok) {
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
case ',':
case ')':
yyn = yyr29();
continue;
}
yyn = 405;
continue;
case 40:
yyst[yysp] = 40;
if (++yysp>=yyst.length) {
yyexpand();
}
case 241:
switch (yytok) {
case ')':
yyn = 49;
continue;
}
yyn = 405;
continue;
case 41:
yyst[yysp] = 41;
if (++yysp>=yyst.length) {
yyexpand();
}
case 242:
switch (yytok) {
case ',':
yyn = 50;
continue;
case ')':
yyn = yyr26();
continue;
}
yyn = 405;
continue;
case 42:
yyst[yysp] = 42;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 243:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr24();
continue;
}
yyn = 405;
continue;
case 43:
yyst[yysp] = 43;
if (++yysp>=yyst.length) {
yyexpand();
}
case 244:
switch (yytok) {
case '(':
yyn = 51;
continue;
}
yyn = 405;
continue;
case 44:
yyst[yysp] = 44;
if (++yysp>=yyst.length) {
yyexpand();
}
case 245:
switch (yytok) {
case '(':
yyn = 52;
continue;
}
yyn = 405;
continue;
case 45:
yyst[yysp] = 45;
if (++yysp>=yyst.length) {
yyexpand();
}
case 246:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
}
yyn = 405;
continue;
case 46:
yyst[yysp] = 46;
if (++yysp>=yyst.length) {
yyexpand();
}
case 247:
switch (yytok) {
case ',':
case ')':
yyn = yyr18();
continue;
}
yyn = 405;
continue;
case 47:
yyst[yysp] = 47;
if (++yysp>=yyst.length) {
yyexpand();
}
case 248:
switch (yytok) {
case ')':
yyn = 54;
continue;
}
yyn = 405;
continue;
case 48:
yyst[yysp] = 48;
if (++yysp>=yyst.length) {
yyexpand();
}
case 249:
switch (yytok) {
case ',':
yyn = 55;
continue;
case ')':
yyn = yyr15();
continue;
}
yyn = 405;
continue;
case 49:
yyst[yysp] = 49;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 250:
switch (yytok) {
case IDENTIFIER:
case '[':
case ',':
case ')':
case '(':
yyn = yyr25();
continue;
}
yyn = 405;
continue;
case 50:
yyst[yysp] = 50;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 251:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 51:
yyst[yysp] = 51;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 252:
yyn = yys51();
continue;
case 52:
yyst[yysp] = 52;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 253:
yyn = yys52();
continue;
case 53:
yyst[yysp] = 53;
if (++yysp>=yyst.length) {
yyexpand();
}
case 254:
switch (yytok) {
case '=':
case ';':
case ',':
case ')':
yyn = yyr11();
continue;
}
yyn = 405;
continue;
case 54:
yyst[yysp] = 54;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 255:
switch (yytok) {
case '{':
yyn = 60;
continue;
}
yyn = 405;
continue;
case 55:
yyst[yysp] = 55;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 256:
switch (yytok) {
case BOOL:
yyn = 23;
continue;
case CLASS:
yyn = 24;
continue;
case INT:
yyn = 25;
continue;
case STRING:
yyn = 27;
continue;
case VOID:
yyn = 28;
continue;
}
yyn = 405;
continue;
case 56:
yyst[yysp] = 56;
if (++yysp>=yyst.length) {
yyexpand();
}
case 257:
switch (yytok) {
case '(':
yyn = 32;
continue;
case '[':
yyn = 33;
continue;
case ',':
case ')':
yyn = yyr28();
continue;
}
yyn = 405;
continue;
case 57:
yyst[yysp] = 57;
if (++yysp>=yyst.length) {
yyexpand();
}
case 258:
switch (yytok) {
case ')':
yyn = 62;
continue;
}
yyn = 405;
continue;
case 58:
yyst[yysp] = 58;
if (++yysp>=yyst.length) {
yyexpand();
}
case 259:
switch (yytok) {
case ')':
yyn = 63;
continue;
}
yyn = 405;
continue;
case 59:
yyst[yysp] = 59;
if (++yysp>=yyst.length) {
yyexpand();
}
case 260:
yyn = yys59();
continue;
case 60:
yyst[yysp] = 60;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 261:
yyn = yys60();
continue;
case 61:
yyst[yysp] = 61;
if (++yysp>=yyst.length) {
yyexpand();
}
case 262:
switch (yytok) {
case ',':
case ')':
yyn = yyr17();
continue;
}
yyn = 405;
continue;
case 62:
yyst[yysp] = 62;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 263:
switch (yytok) {
case ';':
yyn = 65;
continue;
}
yyn = 405;
continue;
case 63:
yyst[yysp] = 63;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 264:
switch (yytok) {
case '{':
yyn = 60;
continue;
}
yyn = 405;
continue;
case 64:
yyst[yysp] = 64;
if (++yysp>=yyst.length) {
yyexpand();
}
case 265:
yyn = yys64();
continue;
case 65:
yyst[yysp] = 65;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 266:
yyn = yys65();
continue;
case 66:
yyst[yysp] = 66;
if (++yysp>=yyst.length) {
yyexpand();
}
case 267:
yyn = yys66();
continue;
case 67:
yyst[yysp] = 67;
if (++yysp>=yyst.length) {
yyexpand();
}
case 268:
yyn = yys67();
continue;
case 68:
yyst[yysp] = 68;
if (++yysp>=yyst.length) {
yyexpand();
}
case 269:
yyn = yys68();
continue;
case 69:
yyst[yysp] = 69;
if (++yysp>=yyst.length) {
yyexpand();
}
case 270:
yyn = yys69();
continue;
case 70:
yyst[yysp] = 70;
if (++yysp>=yyst.length) {
yyexpand();
}
case 271:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 71:
yyst[yysp] = 71;
if (++yysp>=yyst.length) {
yyexpand();
}
case 272:
switch (yytok) {
case ';':
yyn = 114;
continue;
}
yyn = 405;
continue;
case 72:
yyst[yysp] = 72;
if (++yysp>=yyst.length) {
yyexpand();
}
case 273:
yyn = yys72();
continue;
case 73:
yyst[yysp] = 73;
if (++yysp>=yyst.length) {
yyexpand();
}
case 274:
yyn = yys73();
continue;
case 74:
yyst[yysp] = 74;
if (++yysp>=yyst.length) {
yyexpand();
}
case 275:
switch (yytok) {
case '=':
yyn = 116;
continue;
case ';':
case ')':
yyn = yyr47();
continue;
}
yyn = 405;
continue;
case 75:
yyst[yysp] = 75;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 276:
yyn = yys75();
continue;
case 76:
yyst[yysp] = 76;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 277:
switch (yytok) {
case ';':
yyn = 117;
continue;
}
yyn = 405;
continue;
case 77:
yyst[yysp] = 77;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 278:
switch (yytok) {
case '(':
yyn = 118;
continue;
}
yyn = 405;
continue;
case 78:
yyst[yysp] = 78;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 279:
switch (yytok) {
case '(':
yyn = 119;
continue;
}
yyn = 405;
continue;
case 79:
yyst[yysp] = 79;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 280:
switch (yytok) {
case '(':
yyn = 120;
continue;
}
yyn = 405;
continue;
case 80:
yyst[yysp] = 80;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 281:
switch (yytok) {
case '(':
yyn = 121;
continue;
}
yyn = 405;
continue;
case 81:
yyst[yysp] = 81;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 282:
yyn = yys81();
continue;
case 82:
yyst[yysp] = 82;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 283:
yyn = yys82();
continue;
case 83:
yyst[yysp] = 83;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 284:
yyn = yys83();
continue;
case 84:
yyst[yysp] = 84;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 285:
switch (yytok) {
case '(':
yyn = 124;
continue;
}
yyn = 405;
continue;
case 85:
yyst[yysp] = 85;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 286:
switch (yytok) {
case '(':
yyn = 125;
continue;
}
yyn = 405;
continue;
case 86:
yyst[yysp] = 86;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 287:
switch (yytok) {
case '(':
yyn = 126;
continue;
}
yyn = 405;
continue;
case 87:
yyst[yysp] = 87;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 288:
yyn = yys87();
continue;
case 88:
yyst[yysp] = 88;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 289:
yyn = yys88();
continue;
case 89:
yyst[yysp] = 89;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 290:
yyn = yys89();
continue;
case 90:
yyst[yysp] = 90;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 291:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 91:
yyst[yysp] = 91;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 292:
switch (yytok) {
case '(':
yyn = 131;
continue;
}
yyn = 405;
continue;
case 92:
yyst[yysp] = 92;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 293:
yyn = yys92();
continue;
case 93:
yyst[yysp] = 93;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 294:
yyn = yys93();
continue;
case 94:
yyst[yysp] = 94;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 295:
yyn = yys94();
continue;
case 95:
yyst[yysp] = 95;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 296:
yyn = yys95();
continue;
case 96:
yyst[yysp] = 96;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 297:
yyn = yys96();
continue;
case 97:
yyst[yysp] = 97;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 298:
yyn = yys97();
continue;
case 98:
yyst[yysp] = 98;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 299:
yyn = yys98();
continue;
case 99:
yyst[yysp] = 99;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 300:
yyn = yys99();
continue;
case 100:
yyst[yysp] = 100;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 301:
yyn = yys100();
continue;
case 101:
yyst[yysp] = 101;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 302:
yyn = yys101();
continue;
case 102:
yyst[yysp] = 102;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 303:
yyn = yys102();
continue;
case 103:
yyst[yysp] = 103;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 304:
yyn = yys103();
continue;
case 104:
yyst[yysp] = 104;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 305:
yyn = yys104();
continue;
case 105:
yyst[yysp] = 105;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 306:
yyn = yys105();
continue;
case 106:
yyst[yysp] = 106;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 307:
yyn = yys106();
continue;
case 107:
yyst[yysp] = 107;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 308:
switch (yytok) {
case IDENTIFIER:
yyn = yyr86();
continue;
}
yyn = 405;
continue;
case 108:
yyst[yysp] = 108;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 309:
yyn = yys108();
continue;
case 109:
yyst[yysp] = 109;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 310:
yyn = yys109();
continue;
case 110:
yyst[yysp] = 110;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 311:
yyn = yys110();
continue;
case 111:
yyst[yysp] = 111;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 312:
yyn = yys111();
continue;
case 112:
yyst[yysp] = 112;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 313:
yyn = yys112();
continue;
case 113:
yyst[yysp] = 113;
if (++yysp>=yyst.length) {
yyexpand();
}
case 314:
yyn = yys113();
continue;
case 114:
yyst[yysp] = 114;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 315:
yyn = yys114();
continue;
case 115:
yyst[yysp] = 115;
if (++yysp>=yyst.length) {
yyexpand();
}
case 316:
switch (yytok) {
case ';':
case ')':
yyn = yyr41();
continue;
}
yyn = 405;
continue;
case 116:
yyst[yysp] = 116;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 317:
yyn = yys116();
continue;
case 117:
yyst[yysp] = 117;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 318:
yyn = yys117();
continue;
case 118:
yyst[yysp] = 118;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 319:
yyn = yys118();
continue;
case 119:
yyst[yysp] = 119;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 320:
yyn = yys119();
continue;
case 120:
yyst[yysp] = 120;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 321:
yyn = yys120();
continue;
case 121:
yyst[yysp] = 121;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 322:
yyn = yys121();
continue;
case 122:
yyst[yysp] = 122;
if (++yysp>=yyst.length) {
yyexpand();
}
case 323:
switch (yytok) {
case '(':
yyn = 159;
continue;
}
yyn = 405;
continue;
case 123:
yyst[yysp] = 123;
if (++yysp>=yyst.length) {
yyexpand();
}
case 324:
switch (yytok) {
case '(':
yyn = 32;
continue;
case '[':
yyn = 160;
continue;
}
yyn = 405;
continue;
case 124:
yyst[yysp] = 124;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 325:
yyn = yys124();
continue;
case 125:
yyst[yysp] = 125;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 326:
switch (yytok) {
case ')':
yyn = 162;
continue;
}
yyn = 405;
continue;
case 126:
yyst[yysp] = 126;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 327:
switch (yytok) {
case ')':
yyn = 163;
continue;
}
yyn = 405;
continue;
case 127:
yyst[yysp] = 127;
if (++yysp>=yyst.length) {
yyexpand();
}
case 328:
yyn = yys127();
continue;
case 128:
yyst[yysp] = 128;
if (++yysp>=yyst.length) {
yyexpand();
}
case 329:
switch (yytok) {
case ';':
yyn = 164;
continue;
}
yyn = 405;
continue;
case 129:
yyst[yysp] = 129;
if (++yysp>=yyst.length) {
yyexpand();
}
case 330:
yyn = yys129();
continue;
case 130:
yyst[yysp] = 130;
if (++yysp>=yyst.length) {
yyexpand();
}
case 331:
switch (yytok) {
case '=':
yyn = 165;
continue;
}
yyn = 405;
continue;
case 131:
yyst[yysp] = 131;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 332:
yyn = yys131();
continue;
case 132:
yyst[yysp] = 132;
if (++yysp>=yyst.length) {
yyexpand();
}
case 333:
yyn = yys132();
continue;
case 133:
yyst[yysp] = 133;
if (++yysp>=yyst.length) {
yyexpand();
}
case 334:
yyn = yys133();
continue;
case 134:
yyst[yysp] = 134;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 335:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 135:
yyst[yysp] = 135;
if (++yysp>=yyst.length) {
yyexpand();
}
case 336:
yyn = yys135();
continue;
case 136:
yyst[yysp] = 136;
if (++yysp>=yyst.length) {
yyexpand();
}
case 337:
yyn = yys136();
continue;
case 137:
yyst[yysp] = 137;
if (++yysp>=yyst.length) {
yyexpand();
}
case 338:
yyn = yys137();
continue;
case 138:
yyst[yysp] = 138;
if (++yysp>=yyst.length) {
yyexpand();
}
case 339:
yyn = yys138();
continue;
case 139:
yyst[yysp] = 139;
if (++yysp>=yyst.length) {
yyexpand();
}
case 340:
yyn = yys139();
continue;
case 140:
yyst[yysp] = 140;
if (++yysp>=yyst.length) {
yyexpand();
}
case 341:
yyn = yys140();
continue;
case 141:
yyst[yysp] = 141;
if (++yysp>=yyst.length) {
yyexpand();
}
case 342:
yyn = yys141();
continue;
case 142:
yyst[yysp] = 142;
if (++yysp>=yyst.length) {
yyexpand();
}
case 343:
yyn = yys142();
continue;
case 143:
yyst[yysp] = 143;
if (++yysp>=yyst.length) {
yyexpand();
}
case 344:
yyn = yys143();
continue;
case 144:
yyst[yysp] = 144;
if (++yysp>=yyst.length) {
yyexpand();
}
case 345:
switch (yytok) {
case ')':
yyn = 169;
continue;
}
yyn = 405;
continue;
case 145:
yyst[yysp] = 145;
if (++yysp>=yyst.length) {
yyexpand();
}
case 346:
switch (yytok) {
case ',':
yyn = 170;
continue;
case ')':
yyn = yyr89();
continue;
}
yyn = 405;
continue;
case 146:
yyst[yysp] = 146;
if (++yysp>=yyst.length) {
yyexpand();
}
case 347:
yyn = yys146();
continue;
case 147:
yyst[yysp] = 147;
if (++yysp>=yyst.length) {
yyexpand();
}
case 348:
yyn = yys147();
continue;
case 148:
yyst[yysp] = 148;
if (++yysp>=yyst.length) {
yyexpand();
}
case 349:
yyn = yys148();
continue;
case 149:
yyst[yysp] = 149;
if (++yysp>=yyst.length) {
yyexpand();
}
case 350:
yyn = yys149();
continue;
case 150:
yyst[yysp] = 150;
if (++yysp>=yyst.length) {
yyexpand();
}
case 351:
yyn = yys150();
continue;
case 151:
yyst[yysp] = 151;
if (++yysp>=yyst.length) {
yyexpand();
}
case 352:
yyn = yys151();
continue;
case 152:
yyst[yysp] = 152;
if (++yysp>=yyst.length) {
yyexpand();
}
case 353:
yyn = yys152();
continue;
case 153:
yyst[yysp] = 153;
if (++yysp>=yyst.length) {
yyexpand();
}
case 354:
yyn = yys153();
continue;
case 154:
yyst[yysp] = 154;
if (++yysp>=yyst.length) {
yyexpand();
}
case 355:
yyn = yys154();
continue;
case 155:
yyst[yysp] = 155;
if (++yysp>=yyst.length) {
yyexpand();
}
case 356:
switch (yytok) {
case ';':
yyn = 172;
continue;
}
yyn = 405;
continue;
case 156:
yyst[yysp] = 156;
if (++yysp>=yyst.length) {
yyexpand();
}
case 357:
switch (yytok) {
case ')':
yyn = 173;
continue;
}
yyn = 405;
continue;
case 157:
yyst[yysp] = 157;
if (++yysp>=yyst.length) {
yyexpand();
}
case 358:
yyn = yys157();
continue;
case 158:
yyst[yysp] = 158;
if (++yysp>=yyst.length) {
yyexpand();
}
case 359:
yyn = yys158();
continue;
case 159:
yyst[yysp] = 159;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 360:
switch (yytok) {
case ')':
yyn = 176;
continue;
}
yyn = 405;
continue;
case 160:
yyst[yysp] = 160;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 361:
yyn = yys160();
continue;
case 161:
yyst[yysp] = 161;
if (++yysp>=yyst.length) {
yyexpand();
}
case 362:
switch (yytok) {
case ')':
yyn = 178;
continue;
}
yyn = 405;
continue;
case 162:
yyst[yysp] = 162;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 363:
yyn = yys162();
continue;
case 163:
yyst[yysp] = 163;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 364:
yyn = yys163();
continue;
case 164:
yyst[yysp] = 164;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 365:
yyn = yys164();
continue;
case 165:
yyst[yysp] = 165;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 366:
yyn = yys165();
continue;
case 166:
yyst[yysp] = 166;
if (++yysp>=yyst.length) {
yyexpand();
}
case 367:
yyn = yys166();
continue;
case 167:
yyst[yysp] = 167;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 368:
yyn = yys167();
continue;
case 168:
yyst[yysp] = 168;
if (++yysp>=yyst.length) {
yyexpand();
}
case 369:
switch (yytok) {
case ')':
yyn = 181;
continue;
}
yyn = 405;
continue;
case 169:
yyst[yysp] = 169;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 370:
yyn = yys169();
continue;
case 170:
yyst[yysp] = 170;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 371:
yyn = yys170();
continue;
case 171:
yyst[yysp] = 171;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 372:
yyn = yys171();
continue;
case 172:
yyst[yysp] = 172;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 373:
yyn = yys172();
continue;
case 173:
yyst[yysp] = 173;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 374:
switch (yytok) {
case '{':
yyn = 60;
continue;
case ARROW:
yyn = 185;
continue;
}
yyn = 405;
continue;
case 174:
yyst[yysp] = 174;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 375:
yyn = yys174();
continue;
case 175:
yyst[yysp] = 175;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 376:
switch (yytok) {
case IDENTIFIER:
yyn = 9;
continue;
}
yyn = 405;
continue;
case 176:
yyst[yysp] = 176;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 377:
yyn = yys176();
continue;
case 177:
yyst[yysp] = 177;
if (++yysp>=yyst.length) {
yyexpand();
}
case 378:
yyn = yys177();
continue;
case 178:
yyst[yysp] = 178;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 379:
switch (yytok) {
case ';':
yyn = 189;
continue;
}
yyn = 405;
continue;
case 179:
yyst[yysp] = 179;
if (++yysp>=yyst.length) {
yyexpand();
}
case 380:
yyn = yys179();
continue;
case 180:
yyst[yysp] = 180;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 381:
yyn = yys180();
continue;
case 181:
yyst[yysp] = 181;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 382:
yyn = yys181();
continue;
case 182:
yyst[yysp] = 182;
if (++yysp>=yyst.length) {
yyexpand();
}
case 383:
yyn = yys182();
continue;
case 183:
yyst[yysp] = 183;
if (++yysp>=yyst.length) {
yyexpand();
}
case 384:
yyn = yys183();
continue;
case 184:
yyst[yysp] = 184;
if (++yysp>=yyst.length) {
yyexpand();
}
case 385:
yyn = yys184();
continue;
case 185:
yyst[yysp] = 185;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 386:
yyn = yys185();
continue;
case 186:
yyst[yysp] = 186;
if (++yysp>=yyst.length) {
yyexpand();
}
case 387:
yyn = yys186();
continue;
case 187:
yyst[yysp] = 187;
if (++yysp>=yyst.length) {
yyexpand();
}
case 388:
switch (yytok) {
case ')':
yyn = 196;
continue;
}
yyn = 405;
continue;
case 188:
yyst[yysp] = 188;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 389:
yyn = yys188();
continue;
case 189:
yyst[yysp] = 189;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 390:
yyn = yys189();
continue;
case 190:
yyst[yysp] = 190;
if (++yysp>=yyst.length) {
yyexpand();
}
case 391:
yyn = yys190();
continue;
case 191:
yyst[yysp] = 191;
if (++yysp>=yyst.length) {
yyexpand();
}
case 392:
yyn = yys191();
continue;
case 192:
yyst[yysp] = 192;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 393:
yyn = yys192();
continue;
case 193:
yyst[yysp] = 193;
if (++yysp>=yyst.length) {
yyexpand();
}
case 394:
yyn = yys193();
continue;
case 194:
yyst[yysp] = 194;
if (++yysp>=yyst.length) {
yyexpand();
}
case 395:
yyn = yys194();
continue;
case 195:
yyst[yysp] = 195;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 396:
yyn = yys195();
continue;
case 196:
yyst[yysp] = 196;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 397:
yyn = yys196();
continue;
case 197:
yyst[yysp] = 197;
if (++yysp>=yyst.length) {
yyexpand();
}
case 398:
switch (yytok) {
case ')':
yyn = 199;
continue;
}
yyn = 405;
continue;
case 198:
yyst[yysp] = 198;
if (++yysp>=yyst.length) {
yyexpand();
}
case 399:
yyn = yys198();
continue;
case 199:
yyst[yysp] = 199;
yysv[yysp] = (semValue
);
yytok = (nextToken()
);
if (++yysp>=yyst.length) {
yyexpand();
}
case 400:
yyn = yys199();
continue;
case 200:
yyst[yysp] = 200;
if (++yysp>=yyst.length) {
yyexpand();
}
case 401:
yyn = yys200();
continue;
case 402:
return true;
case 403:
yyerror("stack overflow");
case 404:
return false;
case 405:
yyerror("syntax error");
return false;
}
}
}
protected void yyexpand() {
int[] newyyst = new int[2*yyst.length];
SemValue[] newyysv = new SemValue[2*yyst.length];
for (int i=0; i<yyst.length; i++) {
newyyst[i] = yyst[i];
newyysv[i] = yysv[i];
}
yyst = newyyst;
yysv = newyysv;
}
private int yys9() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case '{':
case ']':
case '[':
case '=':
case '<':
case ';':
case OR:
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '/':
case EXTENDS:
case '+':
case '*':
case '>':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr93();
}
return 405;
}
private int yys14() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr10();
}
return 405;
}
private int yys16() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr10();
}
return 405;
}
private int yys17() {
switch (yytok) {
case ABSTRACT:
return 22;
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STATIC:
return 26;
case STRING:
return 27;
case VOID:
return 28;
case '}':
return 29;
}
return 405;
}
private int yys18() {
switch (yytok) {
case ABSTRACT:
return 22;
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STATIC:
return 26;
case STRING:
return 27;
case VOID:
return 28;
case '}':
return 30;
}
return 405;
}
private int yys19() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr9();
}
return 405;
}
private int yys32() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr27();
}
return 405;
}
private int yys34() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr8();
}
return 405;
}
private int yys38() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys51() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys52() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys59() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr13();
}
return 405;
}
private int yys60() {
switch (yytok) {
case ')':
case STATIC:
case '/':
case '*':
case ENDINPUT:
case UMINUS:
case '[':
case OR:
case NOT_EQUAL:
case '+':
case '%':
case EMPTY:
case ABSTRACT:
case ELSE:
case AND:
case ']':
case '>':
case '<':
case EQUAL:
case '.':
case EXTENDS:
case ',':
case ARROW:
case LESS_EQUAL:
case '=':
case error:
case GREATER_EQUAL:
return 405;
}
return yyr40();
}
private int yys64() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case '}':
return 95;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys65() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr14();
}
return 405;
}
private int yys66() {
switch (yytok) {
case STRING:
case STATIC:
case CLASS:
case '}':
case INT:
case VOID:
case BOOL:
case ABSTRACT:
return yyr12();
}
return 405;
}
private int yys67() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
return yyr88();
case ';':
case ')':
return yyr43();
}
return 405;
}
private int yys68() {
switch (yytok) {
case '=':
return 112;
case IDENTIFIER:
case GREATER_EQUAL:
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr54();
}
return 405;
}
private int yys69() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr52();
}
return 405;
}
private int yys72() {
switch (yytok) {
case ')':
case STATIC:
case '/':
case '*':
case ENDINPUT:
case UMINUS:
case '[':
case OR:
case NOT_EQUAL:
case '+':
case '%':
case EMPTY:
case ABSTRACT:
case ELSE:
case AND:
case ']':
case '>':
case '<':
case EQUAL:
case '.':
case EXTENDS:
case ',':
case ARROW:
case LESS_EQUAL:
case '=':
case error:
case GREATER_EQUAL:
return 405;
}
return yyr39();
}
private int yys73() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr30();
}
private int yys75() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr81();
}
return 405;
}
private int yys81() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr80();
}
return 405;
}
private int yys82() {
switch (yytok) {
case IDENTIFIER:
return 9;
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
}
return 405;
}
private int yys83() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr83();
}
return 405;
}
private int yys87() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case ';':
return yyr51();
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys88() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr82();
}
return 405;
}
private int yys89() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr53();
}
return 405;
}
private int yys92() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys93() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case CLASS:
return 134;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys94() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys95() {
switch (yytok) {
case '=':
case UMINUS:
case ENDINPUT:
case error:
case EXTENDS:
case ARROW:
case EMPTY:
return 405;
}
return yyr38();
}
private int yys96() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys97() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys98() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys99() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys100() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys101() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys102() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys103() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case ')':
return yyr90();
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys104() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys105() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys106() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys108() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys109() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys110() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys111() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys112() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys113() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '=':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case '>':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr84();
}
return 405;
}
private int yys114() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr31();
}
private int yys116() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys117() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr35();
}
private int yys118() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys119() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case ')':
return yyr16();
}
return 405;
}
private int yys120() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys121() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys124() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case ')':
return yyr90();
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys127() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ';':
return yyr50();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys129() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr54();
}
return 405;
}
private int yys131() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys132() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr71();
}
return 405;
}
private int yys133() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ')':
return 167;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys135() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr70();
}
return 405;
}
private int yys136() {
switch (yytok) {
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
case AND:
return yyr67();
}
return 405;
}
private int yys137() {
switch (yytok) {
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
case AND:
return yyr61();
}
return 405;
}
private int yys138() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr66();
}
return 405;
}
private int yys139() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr65();
}
return 405;
}
private int yys140() {
switch (yytok) {
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
case AND:
return yyr62();
}
return 405;
}
private int yys141() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case ')':
return yyr68();
}
return 405;
}
private int yys142() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr60();
}
return 405;
}
private int yys143() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ',':
case ')':
return yyr92();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys146() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr58();
}
return 405;
}
private int yys147() {
switch (yytok) {
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '.':
return 107;
case '/':
return 108;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '-':
case ',':
case NOT_EQUAL:
case '+':
case ')':
case LESS_EQUAL:
case EQUAL:
case AND:
return yyr56();
}
return 405;
}
private int yys148() {
switch (yytok) {
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '.':
return 107;
case '/':
return 108;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '-':
case ',':
case NOT_EQUAL:
case '+':
case ')':
case LESS_EQUAL:
case EQUAL:
case AND:
return yyr57();
}
return 405;
}
private int yys149() {
switch (yytok) {
case '(':
return 103;
case '.':
return 107;
case '[':
return 111;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '>':
case '<':
case ';':
case OR:
case '/':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr59();
}
return 405;
}
private int yys150() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr63();
}
return 405;
}
private int yys151() {
switch (yytok) {
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case OR:
case ',':
case NOT_EQUAL:
case ')':
case EQUAL:
case AND:
return yyr64();
}
return 405;
}
private int yys152() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ']':
return 171;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys153() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
return yyr88();
case ';':
case ')':
return yyr42();
}
return 405;
}
private int yys154() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ';':
case ')':
return yyr46();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys157() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ')':
return 174;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys158() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ',':
return 175;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys160() {
switch (yytok) {
case ']':
return 42;
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys162() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr72();
}
return 405;
}
private int yys163() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr73();
}
return 405;
}
private int yys164() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr36();
}
private int yys165() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys166() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ')':
return 180;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys167() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr69();
}
return 405;
}
private int yys169() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr55();
}
return 405;
}
private int yys170() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys171() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '=':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case '>':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr85();
}
return 405;
}
private int yys172() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys174() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys176() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr74();
}
return 405;
}
private int yys177() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ']':
return 188;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys179() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
return yyr88();
case ';':
case ')':
return yyr45();
}
return 405;
}
private int yys180() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys181() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys182() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ',':
case ')':
return yyr91();
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys183() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case ';':
return 192;
case IDENTIFIER:
return yyr88();
}
return 405;
}
private int yys184() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr79();
}
return 405;
}
private int yys185() {
switch (yytok) {
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
}
return 405;
}
private int yys186() {
switch (yytok) {
case GREATER_EQUAL:
case STATIC:
case ')':
case '*':
case ENDINPUT:
case UMINUS:
case '/':
case OR:
case NOT_EQUAL:
case '+':
case '%':
case EMPTY:
case ABSTRACT:
case AND:
case '[':
case ']':
case '>':
case '<':
case EQUAL:
case '.':
case EXTENDS:
case ',':
case ARROW:
case LESS_EQUAL:
case '=':
case error:
return 405;
case ELSE:
return 195;
}
return yyr49();
}
private int yys188() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr75();
}
return 405;
}
private int yys189() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr37();
}
private int yys190() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr33();
}
private int yys191() {
switch (yytok) {
case '(':
return 103;
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr77();
}
return 405;
}
private int yys192() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case BOOL_LIT:
return 75;
case FUN:
return 78;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ')':
return yyr44();
}
return 405;
}
private int yys193() {
switch (yytok) {
case AND:
return 96;
case EQUAL:
return 97;
case GREATER_EQUAL:
return 98;
case LESS_EQUAL:
return 99;
case NOT_EQUAL:
return 100;
case OR:
return 101;
case '%':
return 102;
case '(':
return 103;
case '*':
return 104;
case '+':
return 105;
case '-':
return 106;
case '.':
return 107;
case '/':
return 108;
case '<':
return 109;
case '>':
return 110;
case '[':
return 111;
case IDENTIFIER:
case ']':
case ';':
case ',':
case ')':
return yyr78();
}
return 405;
}
private int yys194() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr32();
}
private int yys195() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys196() {
switch (yytok) {
case IDENTIFIER:
case GREATER_EQUAL:
case ']':
case '[':
case '>':
case '<':
case ';':
case OR:
case '/':
case '.':
case '-':
case ',':
case NOT_EQUAL:
case '+':
case '*':
case ')':
case '(':
case LESS_EQUAL:
case EQUAL:
case '%':
case AND:
return yyr76();
}
return 405;
}
private int yys198() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr48();
}
private int yys199() {
switch (yytok) {
case BOOL:
return 23;
case CLASS:
return 24;
case INT:
return 25;
case STRING:
return 27;
case VOID:
return 28;
case '{':
return 60;
case BOOL_LIT:
return 75;
case BREAK:
return 76;
case FOR:
return 77;
case FUN:
return 78;
case IF:
return 79;
case INSTANCE_OF:
return 80;
case INT_LIT:
return 81;
case NEW:
return 82;
case NULL:
return 83;
case PRINT:
return 84;
case READ_INTEGER:
return 85;
case READ_LINE:
return 86;
case RETURN:
return 87;
case STRING_LIT:
return 88;
case THIS:
return 89;
case VAR:
return 90;
case WHILE:
return 91;
case '!':
return 92;
case '(':
return 93;
case '-':
return 94;
case IDENTIFIER:
return yyr87();
case ';':
return yyr44();
}
return 405;
}
private int yys200() {
switch (yytok) {
case LESS_EQUAL:
case GREATER_EQUAL:
case '.':
case ')':
case ENDINPUT:
case STATIC:
case '>':
case '/':
case ',':
case '*':
case '<':
case ']':
case UMINUS:
case AND:
case ABSTRACT:
case '[':
case '=':
case OR:
case EQUAL:
case NOT_EQUAL:
case EXTENDS:
case '+':
case ARROW:
case '%':
case error:
case EMPTY:
return 405;
}
return yyr34();
}
private int yyr1() { // TopLevel : ClassList
{
tree = new TopLevel(yysv[yysp-1].classList, yysv[yysp-1].pos);
}
yysv[yysp-=1] = yyrv;
return 1;
}
private int yyr4() { // ClassDef : CLASS Id ExtendsClause '{' FieldList '}'
{
yyrv = svClass(new ClassDef(false, yysv[yysp-5].id, Optional.ofNullable(yysv[yysp-4].id), yysv[yysp-2].fieldList, yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypClassDef();
}
private int yyr5() { // ClassDef : ABSTRACT CLASS Id ExtendsClause '{' FieldList '}'
{
yyrv = svClass(new ClassDef(true, yysv[yysp-5].id, Optional.ofNullable(yysv[yysp-4].id), yysv[yysp-2].fieldList, yysv[yysp-6].pos));
}
yysv[yysp-=7] = yyrv;
return yypClassDef();
}
private int yypClassDef() {
switch (yyst[yysp-1]) {
case 0: return 2;
default: return 6;
}
}
private int yyr2() { // ClassList : ClassList ClassDef
{
yyrv = yysv[yysp-2];
yyrv.classList.add(yysv[yysp-1].clazz);
}
yysv[yysp-=2] = yyrv;
return 3;
}
private int yyr3() { // ClassList : ClassDef
{
yyrv = svClasses(yysv[yysp-1].clazz);
}
yysv[yysp-=1] = yyrv;
return 3;
}
private int yyr48() { // ElseClause : ELSE Stmt
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=2] = yyrv;
return 194;
}
private int yyr49() { // ElseClause : /* empty */
{
yyrv = svStmt(null);
}
yysv[yysp-=0] = yyrv;
return 194;
}
private int yyr52() { // Expr : Literal
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return yypExpr();
}
private int yyr53() { // Expr : THIS
{
yyrv = svExpr(new This(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypExpr();
}
private int yyr54() { // Expr : LValue
{
yyrv = svExpr(yysv[yysp-1].lValue);
}
yysv[yysp-=1] = yyrv;
return yypExpr();
}
private int yyr55() { // Expr : Expr '(' ExprList ')'
{
yyrv = svExpr(new Call(Optional.ofNullable(yysv[yysp-4].expr), yysv[yysp-2].exprList, yysv[yysp-3].pos));
}
yysv[yysp-=4] = yyrv;
return yypExpr();
}
private int yyr56() { // Expr : Expr '+' Expr
{
yyrv = svExpr(new Binary(BinaryOp.ADD, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr57() { // Expr : Expr '-' Expr
{
yyrv = svExpr(new Binary(BinaryOp.SUB, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr58() { // Expr : Expr '*' Expr
{
yyrv = svExpr(new Binary(BinaryOp.MUL, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr59() { // Expr : Expr '/' Expr
{
yyrv = svExpr(new Binary(BinaryOp.DIV, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr60() { // Expr : Expr '%' Expr
{
yyrv = svExpr(new Binary(BinaryOp.MOD, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr61() { // Expr : Expr EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.EQ, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr62() { // Expr : Expr NOT_EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.NE, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr63() { // Expr : Expr '<' Expr
{
yyrv = svExpr(new Binary(BinaryOp.LT, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr64() { // Expr : Expr '>' Expr
{
yyrv = svExpr(new Binary(BinaryOp.GT, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr65() { // Expr : Expr LESS_EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.LE, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr66() { // Expr : Expr GREATER_EQUAL Expr
{
yyrv = svExpr(new Binary(BinaryOp.GE, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr67() { // Expr : Expr AND Expr
{
yyrv = svExpr(new Binary(BinaryOp.AND, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr68() { // Expr : Expr OR Expr
{
yyrv = svExpr(new Binary(BinaryOp.OR, yysv[yysp-3].expr, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr69() { // Expr : '(' Expr ')'
{
yyrv = yysv[yysp-2];
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr70() { // Expr : '-' Expr
{
yyrv = svExpr(new Unary(UnaryOp.NEG, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypExpr();
}
private int yyr71() { // Expr : '!' Expr
{
yyrv = svExpr(new Unary(UnaryOp.NOT, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypExpr();
}
private int yyr72() { // Expr : READ_INTEGER '(' ')'
{
yyrv = svExpr(new ReadInt(yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr73() { // Expr : READ_LINE '(' ')'
{
yyrv = svExpr(new ReadLine(yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
return yypExpr();
}
private int yyr74() { // Expr : NEW Id '(' ')'
{
yyrv = svExpr(new NewClass(yysv[yysp-3].id, yysv[yysp-4].pos));
}
yysv[yysp-=4] = yyrv;
return yypExpr();
}
private int yyr75() { // Expr : NEW Type '[' Expr ']'
{
yyrv = svExpr(new NewArray(yysv[yysp-4].type, yysv[yysp-2].expr, yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypExpr();
}
private int yyr76() { // Expr : INSTANCE_OF '(' Expr ',' Id ')'
{
yyrv = svExpr(new ClassTest(yysv[yysp-4].expr, yysv[yysp-2].id, yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypExpr();
}
private int yyr77() { // Expr : '(' CLASS Id ')' Expr
{
yyrv = svExpr(new ClassCast(yysv[yysp-1].expr, yysv[yysp-3].id, yysv[yysp-1].expr.pos));
}
yysv[yysp-=5] = yyrv;
return yypExpr();
}
private int yyr78() { // Expr : FUN '(' VarList ')' ARROW Expr
{
yyrv = svExpr(new Lambda(false, yysv[yysp-4].varList, Optional.ofNullable(yysv[yysp-1].expr), Optional.empty(), yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypExpr();
}
private int yyr79() { // Expr : FUN '(' VarList ')' Block
{
yyrv = svExpr(new Lambda(true, yysv[yysp-3].varList, Optional.empty(), Optional.ofNullable(yysv[yysp-1].block), yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypExpr();
}
private int yypExpr() {
switch (yyst[yysp-1]) {
case 185: return 193;
case 181: return 191;
case 172: return 183;
case 170: return 182;
case 165: return 179;
case 160: return 177;
case 131: return 166;
case 124: return 143;
case 121: return 158;
case 120: return 157;
case 116: return 154;
case 112: return 153;
case 111: return 152;
case 110: return 151;
case 109: return 150;
case 108: return 149;
case 106: return 148;
case 105: return 147;
case 104: return 146;
case 103: return 143;
case 102: return 142;
case 101: return 141;
case 100: return 140;
case 99: return 139;
case 98: return 138;
case 97: return 137;
case 96: return 136;
case 94: return 135;
case 93: return 133;
case 92: return 132;
case 87: return 127;
default: return 67;
}
}
private int yyr89() { // ExprList : ExprList1
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return yypExprList();
}
private int yyr90() { // ExprList : /* empty */
{
yyrv = svExprs();
}
yysv[yysp-=0] = yyrv;
return yypExprList();
}
private int yypExprList() {
switch (yyst[yysp-1]) {
case 103: return 144;
default: return 161;
}
}
private int yyr91() { // ExprList1 : ExprList1 ',' Expr
{
yyrv = yysv[yysp-3];
yyrv.exprList.add(yysv[yysp-1].expr);
}
yysv[yysp-=3] = yyrv;
return 145;
}
private int yyr92() { // ExprList1 : Expr
{
yyrv = svExprs(yysv[yysp-1].expr);
}
yysv[yysp-=1] = yyrv;
return 145;
}
private int yyr50() { // ExprOpt : Expr
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return 128;
}
private int yyr51() { // ExprOpt : /* empty */
{
yyrv = svExpr(null);
}
yysv[yysp-=0] = yyrv;
return 128;
}
private int yyr6() { // ExtendsClause : EXTENDS Id
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=2] = yyrv;
return yypExtendsClause();
}
private int yyr7() { // ExtendsClause : /* empty */
{
yyrv = svId(null);
}
yysv[yysp-=0] = yyrv;
return yypExtendsClause();
}
private int yypExtendsClause() {
switch (yyst[yysp-1]) {
case 8: return 11;
default: return 13;
}
}
private int yyr8() { // FieldList : FieldList Var ';'
{
yyrv = yysv[yysp-3];
yyrv.fieldList.add(new VarDef(yysv[yysp-2].type, yysv[yysp-2].id, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypFieldList();
}
private int yyr9() { // FieldList : FieldList MethodDef
{
yyrv = yysv[yysp-2];
yyrv.fieldList.add(yysv[yysp-1].field);
}
yysv[yysp-=2] = yyrv;
return yypFieldList();
}
private int yyr10() { // FieldList : /* empty */
{
yyrv = svFields();
}
yysv[yysp-=0] = yyrv;
return yypFieldList();
}
private int yypFieldList() {
switch (yyst[yysp-1]) {
case 14: return 17;
default: return 18;
}
}
private int yyr93() { // Id : IDENTIFIER
{
yyrv = svId(new Id(yysv[yysp-1].strVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
switch (yyst[yysp-1]) {
case 134: return 168;
case 90: return 130;
case 82: return 122;
case 70: return 113;
case 45: return 53;
case 37: return 44;
case 35: return 43;
case 24: return 36;
case 20: return 31;
case 12: return 15;
case 7: return 10;
case 5: return 8;
default: return 187;
}
}
private int yyr46() { // Initializer : '=' Expr
{
yyrv = svExpr(yysv[yysp-1].expr);
yyrv.pos = yysv[yysp-2].pos;
}
yysv[yysp-=2] = yyrv;
return 115;
}
private int yyr47() { // Initializer : /* empty */
{
yyrv = svExpr(null);
}
yysv[yysp-=0] = yyrv;
return 115;
}
private int yyr84() { // LValue : Receiver Id
{
yyrv = svLValue(new VarSel(Optional.ofNullable(yysv[yysp-2].expr), yysv[yysp-1].id, yysv[yysp-1].pos));
}
yysv[yysp-=2] = yyrv;
return yypLValue();
}
private int yyr85() { // LValue : Expr '[' Expr ']'
{
yyrv = svLValue(new IndexSel(yysv[yysp-4].expr, yysv[yysp-2].expr, yysv[yysp-3].pos));
}
yysv[yysp-=4] = yyrv;
return yypLValue();
}
private int yypLValue() {
switch (yyst[yysp-1]) {
case 199: return 68;
case 195: return 68;
case 192: return 68;
case 180: return 68;
case 174: return 68;
case 118: return 68;
case 64: return 68;
default: return 129;
}
}
private int yyr80() { // Literal : INT_LIT
{
yyrv = svExpr(new IntLit(yysv[yysp-1].intVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr81() { // Literal : BOOL_LIT
{
yyrv = svExpr(new BoolLit(yysv[yysp-1].boolVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr82() { // Literal : STRING_LIT
{
yyrv = svExpr(new StringLit(yysv[yysp-1].strVal, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr83() { // Literal : NULL
{
yyrv = svExpr(new NullLit(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 69;
}
private int yyr12() { // MethodDef : STATIC Type Id '(' VarList ')' Block
{
yyrv = svField(new MethodDef(true, false, yysv[yysp-5].id, yysv[yysp-6].type, yysv[yysp-3].varList, Optional.ofNullable(yysv[yysp-1].block), yysv[yysp-5].pos));
}
yysv[yysp-=7] = yyrv;
return 19;
}
private int yyr13() { // MethodDef : Type Id '(' VarList ')' Block
{
yyrv = svField(new MethodDef(false, false, yysv[yysp-5].id, yysv[yysp-6].type, yysv[yysp-3].varList, Optional.ofNullable(yysv[yysp-1].block), yysv[yysp-5].pos));
}
yysv[yysp-=6] = yyrv;
return 19;
}
private int yyr14() { // MethodDef : ABSTRACT Type Id '(' VarList ')' ';'
{
yyrv = svField(new MethodDef(false, true, yysv[yysp-5].id, yysv[yysp-6].type, yysv[yysp-3].varList, Optional.empty(), yysv[yysp-5].pos));
}
yysv[yysp-=7] = yyrv;
return 19;
}
private int yyr86() { // Receiver : Expr '.'
{
yyrv = yysv[yysp-2];
}
yysv[yysp-=2] = yyrv;
return 70;
}
private int yyr87() { // Receiver : /* empty */
{
yyrv = svExpr(null);
}
yysv[yysp-=0] = yyrv;
return 70;
}
private int yyr88() { // Receiver : Expr
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return 70;
}
private int yyr41() { // SimpleStmt : Var Initializer
{
yyrv = svStmt(new LocalVarDef(Optional.ofNullable(yysv[yysp-2].type), yysv[yysp-2].id, yysv[yysp-1].pos, Optional.ofNullable(yysv[yysp-1].expr), yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypSimpleStmt();
}
private int yyr42() { // SimpleStmt : LValue '=' Expr
{
yyrv = svStmt(new Assign(yysv[yysp-3].lValue, yysv[yysp-1].expr, yysv[yysp-2].pos));
}
yysv[yysp-=3] = yyrv;
return yypSimpleStmt();
}
private int yyr43() { // SimpleStmt : Expr
{
yyrv = svStmt(new ExprEval(yysv[yysp-1].expr, yysv[yysp-1].expr.pos));
}
yysv[yysp-=1] = yyrv;
return yypSimpleStmt();
}
private int yyr44() { // SimpleStmt : /* empty */
{
yyrv = svStmt(null);
}
yysv[yysp-=0] = yyrv;
return yypSimpleStmt();
}
private int yyr45() { // SimpleStmt : VAR Id '=' Expr
{
yyrv = svStmt(new LocalVarDef(Optional.empty(), yysv[yysp-3].id, yysv[yysp-3].pos, Optional.ofNullable(yysv[yysp-1].expr), yysv[yysp-3].pos));
}
yysv[yysp-=4] = yyrv;
return yypSimpleStmt();
}
private int yypSimpleStmt() {
switch (yyst[yysp-1]) {
case 192: return 197;
case 118: return 155;
default: return 71;
}
}
private int yyr30() { // Stmt : Block
{
yyrv = svStmt(yysv[yysp-1].block);
}
yysv[yysp-=1] = yyrv;
return yypStmt();
}
private int yyr31() { // Stmt : SimpleStmt ';'
{
if (yysv[yysp-2].stmt == null) {
yyrv = svStmt(new Skip(yysv[yysp-1].pos));
} else {
yyrv = yysv[yysp-2];
}
}
yysv[yysp-=2] = yyrv;
return yypStmt();
}
private int yyr32() { // Stmt : IF '(' Expr ')' Stmt ElseClause
{
yyrv = svStmt(new If(yysv[yysp-4].expr, yysv[yysp-2].stmt, Optional.ofNullable(yysv[yysp-1].stmt), yysv[yysp-6].pos));
}
yysv[yysp-=6] = yyrv;
return yypStmt();
}
private int yyr33() { // Stmt : WHILE '(' Expr ')' Stmt
{
yyrv = svStmt(new While(yysv[yysp-3].expr, yysv[yysp-1].stmt, yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypStmt();
}
private int yyr34() { // Stmt : FOR '(' SimpleStmt ';' Expr ';' SimpleStmt ')' Stmt
{
if (yysv[yysp-7].stmt == null) yysv[yysp-7].stmt = new Skip(yysv[yysp-6].pos);
if (yysv[yysp-3].stmt == null) yysv[yysp-3].stmt = new Skip(yysv[yysp-2].pos);
yyrv = svStmt(new For(yysv[yysp-7].stmt, yysv[yysp-5].expr, yysv[yysp-3].stmt, yysv[yysp-1].stmt, yysv[yysp-9].pos));
}
yysv[yysp-=9] = yyrv;
return yypStmt();
}
private int yyr35() { // Stmt : BREAK ';'
{
yyrv = svStmt(new Break(yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypStmt();
}
private int yyr36() { // Stmt : RETURN ExprOpt ';'
{
yyrv = svStmt(new Return(Optional.ofNullable(yysv[yysp-2].expr), yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
return yypStmt();
}
private int yyr37() { // Stmt : PRINT '(' ExprList ')' ';'
{
yyrv = svStmt(new Print(yysv[yysp-3].exprList, yysv[yysp-5].pos));
}
yysv[yysp-=5] = yyrv;
return yypStmt();
}
private int yypStmt() {
switch (yyst[yysp-1]) {
case 195: return 198;
case 180: return 190;
case 174: return 186;
case 64: return 72;
default: return 200;
}
}
private int yyr39() { // StmtList : StmtList Stmt
{
yyrv = yysv[yysp-2];
yyrv.stmtList.add(yysv[yysp-1].stmt);
}
yysv[yysp-=2] = yyrv;
return 64;
}
private int yyr40() { // StmtList : /* empty */
{
yyrv = svStmts();
}
yysv[yysp-=0] = yyrv;
return 64;
}
private int yyr38() { // Block : '{' StmtList '}'
{
yyrv = svBlock(new Block(yysv[yysp-2].stmtList, yysv[yysp-3].pos));
}
yysv[yysp-=3] = yyrv;
switch (yyst[yysp-1]) {
case 173: return 184;
case 63: return 66;
case 54: return 59;
default: return 73;
}
}
private int yyr19() { // Type : INT
{
yyrv = svType(new TInt(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr20() { // Type : BOOL
{
yyrv = svType(new TBool(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr21() { // Type : STRING
{
yyrv = svType(new TString(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr22() { // Type : VOID
{
yyrv = svType(new TVoid(yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return yypType();
}
private int yyr23() { // Type : CLASS Id
{
yyrv = svType(new TClass(yysv[yysp-1].id, yysv[yysp-2].pos));
}
yysv[yysp-=2] = yyrv;
return yypType();
}
private int yyr24() { // Type : Type '[' ']'
{
yyrv = svType(new TArray(yysv[yysp-3].type, yysv[yysp-3].type.pos));
}
yysv[yysp-=3] = yyrv;
return yypType();
}
private int yyr25() { // Type : Type '(' TypeList ')'
{
yyrv = svType(new TLambda(yysv[yysp-4].type, yysv[yysp-2].typeList, yysv[yysp-4].type.pos));
}
yysv[yysp-=4] = yyrv;
return yypType();
}
private int yypType() {
switch (yyst[yysp-1]) {
case 82: return 123;
case 50: return 56;
case 32: return 39;
case 26: return 37;
case 22: return 35;
case 18: return 20;
case 17: return 20;
default: return 45;
}
}
private int yyr26() { // TypeList : TypeList1
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return 40;
}
private int yyr27() { // TypeList : /* empty */
{
yyrv = svTypes();
}
yysv[yysp-=0] = yyrv;
return 40;
}
private int yyr28() { // TypeList1 : TypeList1 ',' Type
{
yyrv = yysv[yysp-3];
yyrv.typeList.add(yysv[yysp-1].type);
}
yysv[yysp-=3] = yyrv;
return 41;
}
private int yyr29() { // TypeList1 : Type
{
yyrv = svTypes(yysv[yysp-1].type);
}
yysv[yysp-=1] = yyrv;
return 41;
}
private int yyr11() { // Var : Type Id
{
yyrv = svVar(yysv[yysp-2].type, yysv[yysp-1].id, yysv[yysp-1].pos);
}
yysv[yysp-=2] = yyrv;
switch (yyst[yysp-1]) {
case 119: return 46;
case 55: return 61;
case 52: return 46;
case 51: return 46;
case 38: return 46;
case 18: return 21;
case 17: return 21;
default: return 74;
}
}
private int yyr15() { // VarList : VarList1
{
yyrv = yysv[yysp-1];
}
yysv[yysp-=1] = yyrv;
return yypVarList();
}
private int yyr16() { // VarList : /* empty */
{
yyrv = svVars();
}
yysv[yysp-=0] = yyrv;
return yypVarList();
}
private int yypVarList() {
switch (yyst[yysp-1]) {
case 52: return 58;
case 51: return 57;
case 38: return 47;
default: return 156;
}
}
private int yyr17() { // VarList1 : VarList1 ',' Var
{
yyrv = yysv[yysp-3];
yyrv.varList.add(new LocalVarDef(Optional.ofNullable(yysv[yysp-1].type), yysv[yysp-1].id, yysv[yysp-1].pos));
}
yysv[yysp-=3] = yyrv;
return 48;
}
private int yyr18() { // VarList1 : Var
{
yyrv = svVars(new LocalVarDef(Optional.ofNullable(yysv[yysp-1].type), yysv[yysp-1].id, yysv[yysp-1].pos));
}
yysv[yysp-=1] = yyrv;
return 48;
}
protected String[] yyerrmsgs = {
};
}
| 208,452 | 0.294188 | 0.262334 | 7,681 | 26.138655 | 13.405804 | 188 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.415701 | false | false | 5 |
6d21e234eb26626595334f5664198488ec2df304 | 18,245,021,130,039 | 452284f89bd8403f3e5d759090dcf33e6380b829 | /src/main/java/com/codeup/pressd/repository/CommentRepository.java | b0277c5e85997e64b9bded3a23eaadc08ab678de | [] | no_license | Pressd-codeup/pressd | https://github.com/Pressd-codeup/pressd | b9c3510ee1a14cae12d1c26938114a9e2b0241ed | f800fd11f61af4162e40e287620fb94533ec29b1 | refs/heads/main | 2023-05-10T22:39:17.756000 | 2021-05-29T02:58:55 | 2021-05-29T02:58:55 | 357,590,645 | 2 | 0 | null | false | 2021-05-29T02:58:56 | 2021-04-13T14:53:09 | 2021-05-27T23:52:12 | 2021-05-29T02:58:56 | 136,187 | 3 | 0 | 0 | HTML | false | false | package com.codeup.pressd.repository;
import com.codeup.pressd.models.Comment;
import com.codeup.pressd.models.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CommentRepository extends JpaRepository<Comment, Long> {
List<Comment> findAllById(long id);
List<Comment> getCommentsByUser(User user);
}
| UTF-8 | Java | 432 | java | CommentRepository.java | Java | [] | null | [] | package com.codeup.pressd.repository;
import com.codeup.pressd.models.Comment;
import com.codeup.pressd.models.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CommentRepository extends JpaRepository<Comment, Long> {
List<Comment> findAllById(long id);
List<Comment> getCommentsByUser(User user);
}
| 432 | 0.810185 | 0.810185 | 15 | 27.799999 | 23.850088 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 5 |
60dc2d1474cd51dfc96bfb71603260574c0a3a9e | 15,874,199,179,885 | ee123c3382787dddece612ece2c0bcbe24ddcd36 | /bk-common/src/main/java/com/gewara/util/HttpResult.java | 36265a2c742cbfa058f037770c4389939028c9c1 | [] | no_license | 5245/Java2016 | https://github.com/5245/Java2016 | 08d0280da34b64daa9e57480f6c3bf0a37239a77 | c8da1e8be97a52b4585c7afe7483369d53195219 | refs/heads/master | 2021-01-17T13:25:51.989000 | 2018-10-19T01:55:40 | 2018-10-19T01:55:40 | 56,761,547 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gewara.util;
public class HttpResult {
private String response;
private String msg;
private boolean isSuccess;
public boolean isSuccess() {
return isSuccess;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public void setSuccess(boolean isSuccess) {
this.isSuccess = isSuccess;
}
public String getResponse() {
return response;
}
public void setResponse(String response) {
this.response = response;
}
}
| UTF-8 | Java | 576 | java | HttpResult.java | Java | [] | null | [] | package com.gewara.util;
public class HttpResult {
private String response;
private String msg;
private boolean isSuccess;
public boolean isSuccess() {
return isSuccess;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public void setSuccess(boolean isSuccess) {
this.isSuccess = isSuccess;
}
public String getResponse() {
return response;
}
public void setResponse(String response) {
this.response = response;
}
}
| 576 | 0.607639 | 0.607639 | 32 | 17 | 15.149258 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3125 | false | false | 5 |
e754c9e557540ce3a0b00999eb08f84bfd8f2e13 | 11,020,886,121,266 | df8464ba771a8a5de42fd82b4801d1f039d754ad | /prog_intro/HW10/src/expression/Variable.java | 05f52ab184205382ca3245cd677022c8d3b381d5 | [] | no_license | nowiwr01w/itmo | https://github.com/nowiwr01w/itmo | b13c135158de109acdaa9ee324cf5ea5e9c5343f | 64c775a7779777e120bc5e6a098b49ee8eebc876 | refs/heads/master | 2022-12-17T04:50:24.002000 | 2020-09-13T12:27:33 | 2020-09-13T12:27:33 | 220,715,265 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package expression;
public class Variable implements CommonExpression {
private String var;
Variable(String var) {
assert var != null;
this.var = var;
}
public int evaluate(int x) {
return x;
}
public double evaluate(double x) {
return x;
}
public int evaluate(int x, int y) {
switch (var) {
case "x":
return x;
case "y":
return y;
}
return 0;
}
} | UTF-8 | Java | 500 | java | Variable.java | Java | [] | null | [] | package expression;
public class Variable implements CommonExpression {
private String var;
Variable(String var) {
assert var != null;
this.var = var;
}
public int evaluate(int x) {
return x;
}
public double evaluate(double x) {
return x;
}
public int evaluate(int x, int y) {
switch (var) {
case "x":
return x;
case "y":
return y;
}
return 0;
}
} | 500 | 0.49 | 0.488 | 28 | 16.892857 | 13.481043 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 5 |
4230fe2a0411912830861256ab61e5e95feef1c7 | 20,375,324,854,468 | 46ab2a47022fcc3e645efc05d491b0e4e19fdadd | /orientation&foundation/week-06/day-2/src/EX8.java | 2aedb9513ea1d44f263d8e53e022a5f2fc2c1d40 | [] | no_license | green-fox-academy/olsanska | https://github.com/green-fox-academy/olsanska | 9a928fbff5cd719c879cd686e7ebab5a1b8f4d77 | 5904ed7afe9f3a80d9e415f18801b4a7a1b2daf2 | refs/heads/master | 2020-05-04T16:36:58.687000 | 2019-06-25T07:45:42 | 2019-06-25T07:45:42 | 179,282,716 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class EX8 {
public static void main(String[] args) {
List<Character> chars = Arrays.asList('H', 'e', 'l', 'l', 'o');
String hello = chars.stream().map(n -> n.toString()).collect(Collectors.joining());
System.out.println(hello);
}
}
/*
Write a Stream Expression to concatenate a Character list to a string!
*/ | UTF-8 | Java | 433 | java | EX8.java | Java | [] | null | [] | import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class EX8 {
public static void main(String[] args) {
List<Character> chars = Arrays.asList('H', 'e', 'l', 'l', 'o');
String hello = chars.stream().map(n -> n.toString()).collect(Collectors.joining());
System.out.println(hello);
}
}
/*
Write a Stream Expression to concatenate a Character list to a string!
*/ | 433 | 0.658199 | 0.655889 | 14 | 30 | 28.488092 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.714286 | false | false | 5 |
4ba901d40fe86ecd7e8044e6db10952173c7a201 | 17,557,826,352,503 | ad0e54465ecffd0a560ccc2bb8aae41aaabedb41 | /src/main/java/com/alphatica/genotick/data/MainAppData.java | a35354dbd4e85e96d5ad0375c69501a2aceb5929 | [] | no_license | raver1975/BleuTrade2 | https://github.com/raver1975/BleuTrade2 | 435449b4a441281ee4d0cc1145a818d3951b6b68 | b5fb0b2d9e09be851e8fca210f5c70003809b997 | refs/heads/master | 2021-01-20T05:52:25.564000 | 2017-11-04T03:23:31 | 2017-11-04T03:23:31 | 89,815,737 | 7 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.alphatica.genotick.data;
import com.alphatica.genotick.genotick.RobotData;
import com.alphatica.genotick.timepoint.TimePoint;
import java.sql.Time;
import java.util.*;
import static java.util.Collections.binarySearch;
public class MainAppData {
private final Map<DataSetName, DataSet> sets;
private final Map<DataSetName, Double> profits;
private final List<TimePoint> timePoints;
public MainAppData() {
sets = new HashMap<>();
timePoints = new ArrayList<>();
profits = new HashMap<>();
}
public double recordProfit(DataSetName setName, double profit) {
double totalProfit = profits.get(setName);
totalProfit *= (profit / 100.0) + 1;
profits.put(setName, totalProfit);
return totalProfit;
}
public void addDataSet(DataSet set) {
sets.put(set.getName(), set);
profits.put(set.getName(), 1.0);
updateTimePoints(set.getTimePoints());
}
private void updateTimePoints(List<TimePoint> newTimePoints) {
Set<TimePoint> set = new HashSet<>(this.timePoints);
set.addAll(newTimePoints);
timePoints.clear();
timePoints.addAll(set);
timePoints.sort(TimePoint::compareTo);
}
public List<RobotData> prepareRobotDataList(final TimePoint timePoint) {
List<RobotData> list = Collections.synchronizedList(new ArrayList<>());
sets.entrySet().parallelStream().forEach((Map.Entry<DataSetName, DataSet> entry) -> {
RobotData robotData = entry.getValue().getRobotData(timePoint);
if (!robotData.isEmpty())
list.add(robotData);
});
return list;
}
public double getActualChange(DataSetName name, TimePoint timePoint) {
return sets.get(name).calculateFutureChange(timePoint);
}
public TimePoint getFirstTimePoint() {
if (sets.isEmpty())
return null;
return timePoints.get(0);
}
public TimePoint getNextTimePint(TimePoint now) {
int index = binarySearch(timePoints, now);
if(index < 0) {
index = Math.abs(index + 1);
}
if(index > timePoints.size() - 2) {
return null;
} else {
return timePoints.get(index+1);
}
}
public TimePoint getLastTimePoint() {
if (sets.isEmpty())
return null;
return timePoints.get(timePoints.size()-1);
}
public Collection<DataSet> listSets() {
return sets.values();
}
boolean isEmpty() {
return sets.isEmpty();
}
}
| UTF-8 | Java | 2,601 | java | MainAppData.java | Java | [] | null | [] | package com.alphatica.genotick.data;
import com.alphatica.genotick.genotick.RobotData;
import com.alphatica.genotick.timepoint.TimePoint;
import java.sql.Time;
import java.util.*;
import static java.util.Collections.binarySearch;
public class MainAppData {
private final Map<DataSetName, DataSet> sets;
private final Map<DataSetName, Double> profits;
private final List<TimePoint> timePoints;
public MainAppData() {
sets = new HashMap<>();
timePoints = new ArrayList<>();
profits = new HashMap<>();
}
public double recordProfit(DataSetName setName, double profit) {
double totalProfit = profits.get(setName);
totalProfit *= (profit / 100.0) + 1;
profits.put(setName, totalProfit);
return totalProfit;
}
public void addDataSet(DataSet set) {
sets.put(set.getName(), set);
profits.put(set.getName(), 1.0);
updateTimePoints(set.getTimePoints());
}
private void updateTimePoints(List<TimePoint> newTimePoints) {
Set<TimePoint> set = new HashSet<>(this.timePoints);
set.addAll(newTimePoints);
timePoints.clear();
timePoints.addAll(set);
timePoints.sort(TimePoint::compareTo);
}
public List<RobotData> prepareRobotDataList(final TimePoint timePoint) {
List<RobotData> list = Collections.synchronizedList(new ArrayList<>());
sets.entrySet().parallelStream().forEach((Map.Entry<DataSetName, DataSet> entry) -> {
RobotData robotData = entry.getValue().getRobotData(timePoint);
if (!robotData.isEmpty())
list.add(robotData);
});
return list;
}
public double getActualChange(DataSetName name, TimePoint timePoint) {
return sets.get(name).calculateFutureChange(timePoint);
}
public TimePoint getFirstTimePoint() {
if (sets.isEmpty())
return null;
return timePoints.get(0);
}
public TimePoint getNextTimePint(TimePoint now) {
int index = binarySearch(timePoints, now);
if(index < 0) {
index = Math.abs(index + 1);
}
if(index > timePoints.size() - 2) {
return null;
} else {
return timePoints.get(index+1);
}
}
public TimePoint getLastTimePoint() {
if (sets.isEmpty())
return null;
return timePoints.get(timePoints.size()-1);
}
public Collection<DataSet> listSets() {
return sets.values();
}
boolean isEmpty() {
return sets.isEmpty();
}
}
| 2,601 | 0.623606 | 0.618608 | 92 | 27.27174 | 23.185032 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.532609 | false | false | 5 |
e2a1bfc112433924657c1fd9ebfbda90731cc2af | 15,281,493,675,024 | b7c571f69997e3da9a7544966ff589db619ccd40 | /src/main/java/pl/sda/spring/citizensapp/CitizensAppApplication.java | 260940141274f76390d92092944e96a22271ec80 | [] | no_license | bkonczyk/citizens-app | https://github.com/bkonczyk/citizens-app | eeee3fe66ec177584a7d917e52b5595aa0ab0374 | 8638cd792a4614a8dbda09988c05e6f5c7dbcf8b | refs/heads/master | 2023-04-06T14:25:24.574000 | 2021-04-18T10:56:24 | 2021-04-18T10:56:24 | 358,678,949 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.sda.spring.citizensapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CitizensAppApplication {
public static void main(String[] args) {
SpringApplication.run(CitizensAppApplication.class, args);
}
}
| UTF-8 | Java | 340 | java | CitizensAppApplication.java | Java | [] | null | [] | package pl.sda.spring.citizensapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CitizensAppApplication {
public static void main(String[] args) {
SpringApplication.run(CitizensAppApplication.class, args);
}
}
| 340 | 0.797059 | 0.797059 | 13 | 25.153847 | 25.154434 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false | 5 |
cef4487900d99e2dc205148ba41806cdcb098d50 | 26,431,228,781,748 | f15a97a51758dd91945c6342acfb137e85acab36 | /src/main/java/com/beifeng/ae/common/AEConstants.java | 6c347626865697f1b64e820f7881b08d7fa21b52 | [
"Apache-2.0"
] | permissive | SayHelloAllen/offline_analysis_platform_web | https://github.com/SayHelloAllen/offline_analysis_platform_web | 89866eb8747f4907723ef65473b97a8444eaa394 | 75b1c9d0f914ffaafc0550b59fbfbded7a5cb935 | refs/heads/master | 2020-04-08T07:33:38.745000 | 2018-11-26T09:25:42 | 2018-11-26T09:25:42 | 159,142,956 | 4 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.beifeng.ae.common;
/**
* 常量类
*
*
*
*/
public class AEConstants {
// default value
public static final String ALL = "all";
public static final String DAY = "day";
// ae controller api request parameter
public static final String BUCKET = "bucket";
public static final String METRIC = "metric";
public static final String GROUP_BY = "group_by";
public static final String DATE = "date";
public static final String START_DATE = "start_date";
public static final String END_DATE = "end_date";
public static final String DIMENSION_PLATFORM_ID = "dimension_platform_id";
public static final String PLATFORM = "platform";
public static final String DIMENSION_BROWSER_ID = "dimension_browser_id";
public static final String BROWSER = "browser";
public final static String BROWSER_VERSION = "browser_version";
public final static String DIMENSION_LOCATION_ID = "dimension_location_id";
public final static String LOCATION_COUNTRY = "country";
public final static String LOCATION_PROVINCE = "province";
public final static String LOCATION_CITY = "city";
public final static String DIMENSION_INBOUND_ID = "dimension_inbound_id";
public final static String INBOUND_NAME = "inbound";
public final static String DIMENSION_EVENT_ID = "dimension_event_id";
public final static String EVENT_CATEGORY = "category";
public final static String EVENT_ACTION = "action";
public final static String DIMENSION_CURRENCY_TYPE_ID = "dimension_currency_type_id";
public final static String CURRENCY_TYPE = "currency_type";
public final static String DIMENSION_PAYMENT_TYPE_ID = "dimension_payment_type_id";
public final static String PAYMENT_TYPE = "payment_type";
// other
public static final String SEPARTION_COMMA = ",";
public static final String DELIMITER = ".";
public static final String KPI_NAME = "kpiName";
public static final String PRIFIX = "$";
public static final String GROUP_FLAG = "group_";
public static final String EMPTY_STR = "";
public final static String TABLE_NAME = "table_name";
public final static String DIMENSIONS = "dimensions";
public final static String SELECT_COLUMNS = "select_columns";
public final static String DIMENSION_NAME = "dimension_name";
public final static String LOCATION = "location";
public final static String COUNTRY_NAME = "country_name";
public final static String PROVINCE_NAME = "province_name";
// mybatis column name
public final static String ACTIVE_USERS = "active_users";
public final static String NEW_USERS = "new_users";
public final static String TOTAL_USERS = "total_users";
public final static String ACTIVE_MEMBERS = "active_members";
public final static String NEW_MEMBERS = "new_members";
public final static String TOTAL_MEMBERS = "total_members";
// bucket name
public final static String BUCKET_USER_BEHAVIOR = "user_behavior";
public final static String BUCKET_BROWSER = "browser";
public final static String BUCKET_LOCATION = "location";
public final static String BUCKET_INBOUND = "inbound";
public final static String BUCKET_EVENT = "event";
public final static String BUCKET_ORDER = "order";
// metric name
public final static String METRIC_NEW_USER_SPEED_RATE = "new_user_speed_rate";
public final static String METRIC_ACTIVE_USER_SPEED_RATE = "active_user_speed_rate";
public final static String METRIC_TOTAL_USER_SPEED_RATE = "total_user_speed_rate";
public final static String METRIC_NEW_MEMBER_SPEED_RATE = "new_member_speed_rate";
public final static String METRIC_ACTIVE_MEMBER_SPEED_RATE = "active_member_speed_rate";
public final static String METRIC_TOTAL_MEMBER_SPEED_RATE = "total_member_speed_rate";
}
| UTF-8 | Java | 3,849 | java | AEConstants.java | Java | [] | null | [] | package com.beifeng.ae.common;
/**
* 常量类
*
*
*
*/
public class AEConstants {
// default value
public static final String ALL = "all";
public static final String DAY = "day";
// ae controller api request parameter
public static final String BUCKET = "bucket";
public static final String METRIC = "metric";
public static final String GROUP_BY = "group_by";
public static final String DATE = "date";
public static final String START_DATE = "start_date";
public static final String END_DATE = "end_date";
public static final String DIMENSION_PLATFORM_ID = "dimension_platform_id";
public static final String PLATFORM = "platform";
public static final String DIMENSION_BROWSER_ID = "dimension_browser_id";
public static final String BROWSER = "browser";
public final static String BROWSER_VERSION = "browser_version";
public final static String DIMENSION_LOCATION_ID = "dimension_location_id";
public final static String LOCATION_COUNTRY = "country";
public final static String LOCATION_PROVINCE = "province";
public final static String LOCATION_CITY = "city";
public final static String DIMENSION_INBOUND_ID = "dimension_inbound_id";
public final static String INBOUND_NAME = "inbound";
public final static String DIMENSION_EVENT_ID = "dimension_event_id";
public final static String EVENT_CATEGORY = "category";
public final static String EVENT_ACTION = "action";
public final static String DIMENSION_CURRENCY_TYPE_ID = "dimension_currency_type_id";
public final static String CURRENCY_TYPE = "currency_type";
public final static String DIMENSION_PAYMENT_TYPE_ID = "dimension_payment_type_id";
public final static String PAYMENT_TYPE = "payment_type";
// other
public static final String SEPARTION_COMMA = ",";
public static final String DELIMITER = ".";
public static final String KPI_NAME = "kpiName";
public static final String PRIFIX = "$";
public static final String GROUP_FLAG = "group_";
public static final String EMPTY_STR = "";
public final static String TABLE_NAME = "table_name";
public final static String DIMENSIONS = "dimensions";
public final static String SELECT_COLUMNS = "select_columns";
public final static String DIMENSION_NAME = "dimension_name";
public final static String LOCATION = "location";
public final static String COUNTRY_NAME = "country_name";
public final static String PROVINCE_NAME = "province_name";
// mybatis column name
public final static String ACTIVE_USERS = "active_users";
public final static String NEW_USERS = "new_users";
public final static String TOTAL_USERS = "total_users";
public final static String ACTIVE_MEMBERS = "active_members";
public final static String NEW_MEMBERS = "new_members";
public final static String TOTAL_MEMBERS = "total_members";
// bucket name
public final static String BUCKET_USER_BEHAVIOR = "user_behavior";
public final static String BUCKET_BROWSER = "browser";
public final static String BUCKET_LOCATION = "location";
public final static String BUCKET_INBOUND = "inbound";
public final static String BUCKET_EVENT = "event";
public final static String BUCKET_ORDER = "order";
// metric name
public final static String METRIC_NEW_USER_SPEED_RATE = "new_user_speed_rate";
public final static String METRIC_ACTIVE_USER_SPEED_RATE = "active_user_speed_rate";
public final static String METRIC_TOTAL_USER_SPEED_RATE = "total_user_speed_rate";
public final static String METRIC_NEW_MEMBER_SPEED_RATE = "new_member_speed_rate";
public final static String METRIC_ACTIVE_MEMBER_SPEED_RATE = "active_member_speed_rate";
public final static String METRIC_TOTAL_MEMBER_SPEED_RATE = "total_member_speed_rate";
}
| 3,849 | 0.717408 | 0.717408 | 80 | 47.037498 | 27.212334 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7375 | false | false | 5 |
f3042d7f89a2b758f55dedd77e0cea9b0c7ff3f6 | 26,654,567,097,673 | b00318feb07c754cf9c880e35432cf020dcd5779 | /src/main/java/com/ahnu/gis/TopTemperatureApplication.java | 8fbd329273ab656efd995cc3f9f4596f1507476c | [] | no_license | TianYunZi/top-temperature | https://github.com/TianYunZi/top-temperature | ec2ac81d7a60caa5aefb98551655b9601aa7f70f | fd462c3d64096c5539f80e7c1cfafe10d15e86ac | refs/heads/master | 2020-03-20T09:42:13.415000 | 2018-07-23T14:46:42 | 2018-07-23T14:46:42 | 137,345,714 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ahnu.gis;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
@SpringBootApplication(exclude = {RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class})
public class TopTemperatureApplication {
public static void main(String[] args) {
SpringApplication.run(TopTemperatureApplication.class, args);
}
}
| UTF-8 | Java | 590 | java | TopTemperatureApplication.java | Java | [] | null | [] | package com.ahnu.gis;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
@SpringBootApplication(exclude = {RedisAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class})
public class TopTemperatureApplication {
public static void main(String[] args) {
SpringApplication.run(TopTemperatureApplication.class, args);
}
}
| 590 | 0.837288 | 0.837288 | 14 | 41.142857 | 36.144268 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 5 |
d38b3cddd2e9d8aaa36e3acf3f14b494ece4b451 | 28,028,956,597,671 | 84b4e2440596e879a3d61a3f0807e4a9e2d6e9ee | /src/main/java/kerio/connect/admin/common/Time.java | 5a077dead862ced762481d3beb20576f04f5dfc1 | [
"Apache-2.0"
] | permissive | pascalrobert/kerio-admin | https://github.com/pascalrobert/kerio-admin | 6bb96d2c70d524a3809fea3abd0b459dcd72f93d | 6e83e7c6e4740d9bdea755d09c7e3736d585b950 | refs/heads/master | 2016-09-11T04:22:13.688000 | 2013-10-29T08:55:33 | 2013-10-29T08:55:33 | 13,856,186 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package kerio.connect.admin.common;
public class Time {
long hour; ///< 0-23
long min; ///< 0-59
public Time() {
}
public long getHour() {
return hour;
}
public void setHour(long hour) {
this.hour = hour;
}
public long getMin() {
return min;
}
public void setMin(long min) {
this.min = min;
}
}
| UTF-8 | Java | 355 | java | Time.java | Java | [] | null | [] | package kerio.connect.admin.common;
public class Time {
long hour; ///< 0-23
long min; ///< 0-59
public Time() {
}
public long getHour() {
return hour;
}
public void setHour(long hour) {
this.hour = hour;
}
public long getMin() {
return min;
}
public void setMin(long min) {
this.min = min;
}
}
| 355 | 0.557746 | 0.540845 | 28 | 11.678572 | 11.723157 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false | 5 |
21fb83ad7782734a6bb8c8e45aad2208cfdb6186 | 30,554,397,402,775 | 0e391b0b06f2641538c4eec2495e26167abfae60 | /Service/shop-soa/shop-soa-api/src/main/java/com/genyuanlian/consumer/shop/model/ShopPuCardType.java | c8e0747603a3373981bae8be56c372c4c69b2e7e | [] | no_license | GenYuanLian/monera | https://github.com/GenYuanLian/monera | c11bb63d3d37dfe7b3e67c048f3ac57b1ebaa2ee | a4acb244c0ec0071aa85cfd901daf33e0a6ccc61 | refs/heads/master | 2020-03-17T12:47:34.923000 | 2018-08-30T05:47:05 | 2018-08-30T05:47:05 | 133,603,383 | 3 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.genyuanlian.consumer.shop.model;
import java.io.Serializable;
/**
* ShopPuCardType Entity.
*/
public class ShopPuCardType implements Serializable {
/**
*
*/
private static final long serialVersionUID = -694909745401111837L;
// 列信息
private Long id;
private Long merchantId;
private String title;
private String code;
private Double totelValue;
private Double price;
private Double discount;
private String pic;
private String actLogo;
private String actPrdPic;
private Integer status;
private String remark;
private java.util.Date createTime;
private Integer inventory;
private Integer salesVolume;
// 很重要,小胖子 你别删掉(商品列表或下单页面 后台接口参数,用来区分是哪种商品)
private Integer commodityType = 1;// 商品类型:1-提货卡,2-溯源卡,3-零售商品
public void setId(Long value) {
this.id = value;
}
public Long getId() {
return this.id;
}
public void setMerchantId(Long value) {
this.merchantId = value;
}
public Long getMerchantId() {
return this.merchantId;
}
public void setTitle(String value) {
this.title = value;
}
public String getTitle() {
return this.title;
}
public void setCode(String value) {
this.code = value;
}
public String getCode() {
return this.code;
}
public void setTotelValue(Double value) {
this.totelValue = value;
}
public Double getTotelValue() {
return this.totelValue;
}
public void setPrice(Double value) {
this.price = value;
}
public Double getPrice() {
return this.price;
}
public void setDiscount(Double value) {
this.discount = value;
}
public Double getDiscount() {
return this.discount;
}
public void setPic(String value) {
this.pic = value;
}
public String getPic() {
return this.pic;
}
public String getActLogo() {
return actLogo;
}
public void setActLogo(String actLogo) {
this.actLogo = actLogo;
}
public String getActPrdPic() {
return actPrdPic;
}
public void setActPrdPic(String actPrdPic) {
this.actPrdPic = actPrdPic;
}
public void setStatus(Integer value) {
this.status = value;
}
public Integer getStatus() {
return this.status;
}
public void setRemark(String value) {
this.remark = value;
}
public String getRemark() {
return this.remark;
}
public void setCreateTime(java.util.Date value) {
this.createTime = value;
}
public java.util.Date getCreateTime() {
return this.createTime;
}
public Integer getInventory() {
return inventory;
}
public void setInventory(Integer inventory) {
this.inventory = inventory;
}
public Integer getSalesVolume() {
return salesVolume;
}
public void setSalesVolume(Integer salesVolume) {
this.salesVolume = salesVolume;
}
public Integer getCommodityType() {
return commodityType;
}
public void setCommodityType(Integer commodityType) {
this.commodityType = commodityType;
}
}
| UTF-8 | Java | 2,939 | java | ShopPuCardType.java | Java | [] | null | [] | package com.genyuanlian.consumer.shop.model;
import java.io.Serializable;
/**
* ShopPuCardType Entity.
*/
public class ShopPuCardType implements Serializable {
/**
*
*/
private static final long serialVersionUID = -694909745401111837L;
// 列信息
private Long id;
private Long merchantId;
private String title;
private String code;
private Double totelValue;
private Double price;
private Double discount;
private String pic;
private String actLogo;
private String actPrdPic;
private Integer status;
private String remark;
private java.util.Date createTime;
private Integer inventory;
private Integer salesVolume;
// 很重要,小胖子 你别删掉(商品列表或下单页面 后台接口参数,用来区分是哪种商品)
private Integer commodityType = 1;// 商品类型:1-提货卡,2-溯源卡,3-零售商品
public void setId(Long value) {
this.id = value;
}
public Long getId() {
return this.id;
}
public void setMerchantId(Long value) {
this.merchantId = value;
}
public Long getMerchantId() {
return this.merchantId;
}
public void setTitle(String value) {
this.title = value;
}
public String getTitle() {
return this.title;
}
public void setCode(String value) {
this.code = value;
}
public String getCode() {
return this.code;
}
public void setTotelValue(Double value) {
this.totelValue = value;
}
public Double getTotelValue() {
return this.totelValue;
}
public void setPrice(Double value) {
this.price = value;
}
public Double getPrice() {
return this.price;
}
public void setDiscount(Double value) {
this.discount = value;
}
public Double getDiscount() {
return this.discount;
}
public void setPic(String value) {
this.pic = value;
}
public String getPic() {
return this.pic;
}
public String getActLogo() {
return actLogo;
}
public void setActLogo(String actLogo) {
this.actLogo = actLogo;
}
public String getActPrdPic() {
return actPrdPic;
}
public void setActPrdPic(String actPrdPic) {
this.actPrdPic = actPrdPic;
}
public void setStatus(Integer value) {
this.status = value;
}
public Integer getStatus() {
return this.status;
}
public void setRemark(String value) {
this.remark = value;
}
public String getRemark() {
return this.remark;
}
public void setCreateTime(java.util.Date value) {
this.createTime = value;
}
public java.util.Date getCreateTime() {
return this.createTime;
}
public Integer getInventory() {
return inventory;
}
public void setInventory(Integer inventory) {
this.inventory = inventory;
}
public Integer getSalesVolume() {
return salesVolume;
}
public void setSalesVolume(Integer salesVolume) {
this.salesVolume = salesVolume;
}
public Integer getCommodityType() {
return commodityType;
}
public void setCommodityType(Integer commodityType) {
this.commodityType = commodityType;
}
}
| 2,939 | 0.712062 | 0.70428 | 177 | 14.971751 | 16.114502 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.146893 | false | false | 5 |
8e5036b15457374034c1b45f50f96e922c6d96ba | 14,611,478,797,175 | 54965adecf3c8ff20f9747c68ac918af45a73544 | /src/test/java/test/helper/TestUtils.java | 797efcfc6c035e6574a894398f0047e00e557596 | [
"Apache-2.0"
] | permissive | efficacy/tagml-efficacy | https://github.com/efficacy/tagml-efficacy | 498373c0c3277559ca742dda7013b6110035e120 | 12057e0d94ee944e8356533b44d688134f99d3af | refs/heads/main | 2023-01-06T04:58:40.921000 | 2020-10-31T15:21:46 | 2020-10-31T15:21:46 | 300,877,958 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test.helper;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.StringReader;
import java.util.Map;
import com.efsol.tagml.model.Chunk;
import com.efsol.tagml.model.ChunkSequence;
import com.efsol.tagml.model.Document;
import com.efsol.tagml.model.DocumentFactory;
import com.efsol.tagml.model.Node;
import com.efsol.tagml.model.Tag;
import com.efsol.tagml.model.dag.DagFactory;
import com.efsol.tagml.parser.Parser;
public class TestUtils {
public static void assertNodeCount(int expected, ChunkSequence sequence) {
CountVisitor visitor = new CountVisitor();
sequence.walk(visitor);
assertEquals(expected, visitor.count);
}
public static void assertChunkHasTag(Chunk chunk, String layerName, String tagName) {
Map<String, Node> layers = chunk.getLayers();
Node node = layers.get(layerName);
assertNotNull(node, "can't find tag " + tagName + " in layer " + layerName + " " + layers);
for (Tag tag : node.getTags()) {
if (tagName.equals(tag.name)) {
return;
}
}
fail("tag " + tagName + " not found in layer " + layerName);
}
public static Document parse(String input) throws IOException {
DocumentFactory factory = new DagFactory();
Parser parser = new Parser(factory);
StringReader reader = new StringReader(input);
Document document = parser.parse(reader);
// System.out.println("parsed(" + input + ") to " + document);
return document;
}
}
| UTF-8 | Java | 1,603 | java | TestUtils.java | Java | [] | null | [] | package test.helper;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import java.io.StringReader;
import java.util.Map;
import com.efsol.tagml.model.Chunk;
import com.efsol.tagml.model.ChunkSequence;
import com.efsol.tagml.model.Document;
import com.efsol.tagml.model.DocumentFactory;
import com.efsol.tagml.model.Node;
import com.efsol.tagml.model.Tag;
import com.efsol.tagml.model.dag.DagFactory;
import com.efsol.tagml.parser.Parser;
public class TestUtils {
public static void assertNodeCount(int expected, ChunkSequence sequence) {
CountVisitor visitor = new CountVisitor();
sequence.walk(visitor);
assertEquals(expected, visitor.count);
}
public static void assertChunkHasTag(Chunk chunk, String layerName, String tagName) {
Map<String, Node> layers = chunk.getLayers();
Node node = layers.get(layerName);
assertNotNull(node, "can't find tag " + tagName + " in layer " + layerName + " " + layers);
for (Tag tag : node.getTags()) {
if (tagName.equals(tag.name)) {
return;
}
}
fail("tag " + tagName + " not found in layer " + layerName);
}
public static Document parse(String input) throws IOException {
DocumentFactory factory = new DagFactory();
Parser parser = new Parser(factory);
StringReader reader = new StringReader(input);
Document document = parser.parse(reader);
// System.out.println("parsed(" + input + ") to " + document);
return document;
}
}
| 1,603 | 0.66126 | 0.66126 | 45 | 34.622223 | 24.80438 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777778 | false | false | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.