blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4dfae2fcc4d93a2234e51533ba6f3a4f30caaf6d | fd91a17b15285d60a49d67c79a2a5bb199814cb4 | /common2/src/ui/cashier/IAcceptPaymentWindow.java | f87d88275d83dfc27ef93500987315e3b0646591 | [] | no_license | ugurk/aasuite | b27d186b69bca6fc1983c26be515f83d2a17883a | 5c3aa229b612b2fc1d791f018c4e421179c0d745 | refs/heads/master | 2021-01-10T02:24:37.034074 | 2011-11-11T13:15:34 | 2011-11-11T13:15:34 | 55,149,900 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ui.cashier;
import ui.AbstractCashierForm;
/**
*
* @author alex
*/
public interface IAcceptPaymentWindow {
void searchOR(String or);
void run();
void setUseYear(String year);
void reloadPayments();
void setDrawer(AbstractCashierForm form);
}
| [
"sales.softlabs@d6e7c0fa-23b8-11df-b9ed-85270ab41615"
] | sales.softlabs@d6e7c0fa-23b8-11df-b9ed-85270ab41615 |
25c130deab0a60441ca6a96413edb3b29b1190ef | 1d1e053533ca5a44047411b8cda0e3a4334bfe8d | /src/com/patilparagp/wfa/model/ServerCredentials.java | 84e498bc670b4ea40f85df2c95ac57fb9dec1461 | [] | no_license | oatsuper/wfa-android | c943e9b1a9d93cc3273a48e27034194119a2872e | fe7527377bfc7a4985256212a5c924972841f5ea | refs/heads/master | 2021-01-10T05:52:22.258574 | 2015-12-15T13:44:06 | 2015-12-15T13:44:06 | 48,014,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package com.patilparagp.wfa.model;
public class ServerCredentials {
private String server;
private String userName;
private String password;
public ServerCredentials(String server, String userName, String password) {
this.server = server;
this.userName = userName;
this.password = password;
}
public String getServer() {
return server;
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
}
| [
"mailparaghere@gmail.com"
] | mailparaghere@gmail.com |
7e602541092d2fa16997642e2b05d9b72852ef0e | f6899a2cf1c10a724632bbb2ccffb7283c77a5ff | /glassfish-3.0/ejb/javax.ejb/src/main/java/javax/ejb/spi/EJBContainerProvider.java | d6964c62ebdaf141c765c06cfbf1de8463e257cc | [] | no_license | Appdynamics/OSS | a8903058e29f4783e34119a4d87639f508a63692 | 1e112f8854a25b3ecf337cad6eccf7c85e732525 | refs/heads/master | 2023-07-22T03:34:54.770481 | 2021-10-28T07:01:57 | 2021-10-28T07:01:57 | 19,390,624 | 2 | 13 | null | 2023-07-08T02:26:33 | 2014-05-02T22:42:20 | null | UTF-8 | Java | false | false | 2,018 | java | /*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the license at
* https://glassfish.dev.java.net/public/CDDLv1.0.html or
* glassfish/bootstrap/legal/CDDLv1.0.txt.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at glassfish/bootstrap/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* you own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
*/
package javax.ejb.spi;
import java.util.Map;
import javax.ejb.embeddable.EJBContainer;
import javax.ejb.EJBException;
/**
* The EJBContainerProvider SPI is used by the embeddable container bootstrap
* class to initialize a suitable embeddable container.
*/
public interface EJBContainerProvider {
/**
* Called by the embeddable container bootstrap process to find a suitable embeddable
* container implementation. An embeddable container provider may deem itself as
* appropriate for the embeddable application if any of the following are true :
*
* The javax.ejb.embeddable.initial property was included in the Map passed to
* createEJBContainer and the value of the property is the provider's implementation
* class.
*
* No javax.ejb.embeddable.initial property was specified.
*
* If a provider does not qualify as the provider for the embeddable application, it
* must return null.
*
* @return EJBContainer instance or null
*/
public EJBContainer createEJBContainer(Map<?,?> properties) throws EJBException;
}
| [
"ddimalanta@appdynamics.com"
] | ddimalanta@appdynamics.com |
695d8af6cfacdd68850695c134928d232ea75463 | 330d3048a6f950a2efde8d5043e4d22663391127 | /app/src/androidTest/java/com/github/slidedrawer/ExampleInstrumentedTest.java | 01fe65b92270dc55a7cb7fe5954735a842112b89 | [] | no_license | Wlazly/SlideDrawer | 85e7259ef8ea0d470e8e3f7b9fc1c8f46ae83845 | 66e63dbbc8e7ed578d11ca7c0c6e2a81f7198563 | refs/heads/master | 2022-09-22T19:53:19.370755 | 2022-09-08T09:27:38 | 2022-09-08T09:27:38 | 163,073,403 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.github.slidedrawer;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.github.slidedrawer", appContext.getPackageName());
}
}
| [
"wzhiqiang@jrdcom.com"
] | wzhiqiang@jrdcom.com |
1a54def2b3ee9240b43af29528fe59bbc2464058 | 9815617b1391c1d0d942eb6e965b554788d1210b | /src/PR1.java | 58634bafbbab2f0db7cffbbd5c162c14259a8fec | [] | no_license | amorphid/DataViewer | 123865e1a397047a2d6beece595516073976b35d | 5b6258f5414b21eeff7eb0918ef375445c5edf6c | refs/heads/master | 2021-01-18T16:11:56.150584 | 2015-01-14T17:56:30 | 2015-01-14T17:56:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,137 | java | import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JSplitPane;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
import java.util.Vector;
/**
* project 1 assignment
* Main class and controller.
*
* @author Eric Lewis
* @version 1
*/
public class PR1 extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
private final static String TITLE = "HW3: gracanin";
private final static String HELP = "Homework 3 version 1.";
private JMenuBar menuBar = null;
private JMenu fileMenu = null;
private JMenu editMenu = null;
private JMenu helpMenu = null;
private JMenuItem openMenuItem = null;
private JMenuItem closeMenuItem = null;
private JMenuItem saveMenuItem = null;
private JMenuItem quitMenuItem = null;
private JMenuItem copyMenuItem = null;
private JMenuItem pasteMenuItem = null;
private JMenuItem aboutMenuItem = null;
private PR1Model model = null;
private PR1View viewNE = null;
private PR1View viewSW = null;
private PR1View viewSE = null;
private PR1ViewGUI viewGUI = null;
private String clipboard = null;
private File file = null;
/**
* Creates an instance of PR1 class.
* The default title is used.
*/
public PR1() {
this(TITLE);
}
/**
* Creates an instance of <code>HW3</code> class.
*
* @param title The title of the application window.
*/
public PR1(String title) {
super(title);
try {
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (Exception e) {
e.printStackTrace();
}
menuBar = new JMenuBar();
fileMenu = new JMenu("File");
openMenuItem = new JMenuItem("Open");
openMenuItem.addActionListener(this);
openMenuItem.setActionCommand("O");
fileMenu.add(openMenuItem);
closeMenuItem = new JMenuItem("Close");
closeMenuItem.addActionListener(this);
closeMenuItem.setActionCommand("W");
fileMenu.add(closeMenuItem);
saveMenuItem = new JMenuItem("Save");
saveMenuItem.addActionListener(this);
saveMenuItem.setActionCommand("S");
fileMenu.add(saveMenuItem);
quitMenuItem = new JMenuItem("Quit");
quitMenuItem.addActionListener(this);
quitMenuItem.setActionCommand("Q");
fileMenu.add(quitMenuItem);
menuBar.add(fileMenu);
editMenu = new JMenu("Edit");
copyMenuItem = new JMenuItem("Copy");
copyMenuItem.addActionListener(this);
copyMenuItem.setActionCommand("C");
editMenu.add(copyMenuItem);
pasteMenuItem = new JMenuItem("Paste");
pasteMenuItem.addActionListener(this);
pasteMenuItem.setActionCommand("V");
editMenu.add(pasteMenuItem);
menuBar.add(editMenu);
helpMenu = new JMenu("Help");
aboutMenuItem = new JMenuItem("About Homework 3");
aboutMenuItem.addActionListener(this);
aboutMenuItem.setActionCommand("A");
helpMenu.add(aboutMenuItem);
menuBar.add(helpMenu);
setJMenuBar(menuBar);
model = new PR1Model();
viewGUI = new PR1ViewGUI(model);
viewNE = new PR1View(model);
viewSW = new PR1View(model);
viewSE = new PR1View(model);
JSplitPane splitPaneTop = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, viewGUI, viewNE);
splitPaneTop.setOneTouchExpandable(true);
splitPaneTop.setDividerLocation(400);
JSplitPane splitPaneBot = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, viewSW, viewSE);
splitPaneBot.setOneTouchExpandable(true);
splitPaneBot.setDividerLocation(400);
JSplitPane inceptionPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitPaneTop, splitPaneBot);
inceptionPane.setOneTouchExpandable(true);
inceptionPane.setDividerLocation(375);
Dimension minimumSize = new Dimension(100, 50);
viewGUI.setMinimumSize(minimumSize);
viewNE.setMinimumSize(minimumSize);
viewSW.setMinimumSize(minimumSize);
viewSE.setMinimumSize(minimumSize);
setLayout(new BorderLayout());
add(inceptionPane, BorderLayout.CENTER);
}
/**
* The main method.
*
* @param args Command line arguments.
*/
public static void main(String[] args) {
final PR1 app = new PR1();
app.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowevent) {
app.dispose();
System.exit(0);
}
});
app.setSize(800, 800);
app.setVisible(true);
}
/**
* The action event handler that determines the source of the event
* and processes the event accordingly.
*
* @param e The generated event.
*/
@Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
String command = null;
switch (source.getClass().getName()) {
case "javax.swing.JMenuItem":
command = ((JMenuItem) source).getActionCommand();
break;
default:
command = "";
}
switch (command) {
case "O":
JFileChooser fileChooser = new JFileChooser();
int returnVal = fileChooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
file = fileChooser.getSelectedFile();
model.setColumnCount(0);
try {
//Create input stream (a BufferdReader object) from the file.
BufferedReader inputStream = new BufferedReader(new FileReader(file));
//Read the first line to get the column names.
String line = null;
if ((line = inputStream.readLine()) != null) {
Scanner scanner = new Scanner(line);
scanner.useDelimiter(",");
while (scanner.hasNext()) {
model.addColumn(scanner.next());
}
scanner.close();
}
//Read the remaining lines to get the data.
while ((line = inputStream.readLine()) != null) {
Vector<String> tmpVector = new Vector<String>();
Scanner scanner = new Scanner(line);
scanner.useDelimiter(",");
while (scanner.hasNext()) {
tmpVector.add(scanner.next());
}
model.addRow(tmpVector);
scanner.close();
}
//Close the input stream.
inputStream.close();
//Update comboBoxs for each view
viewNE.updateComboBox();
viewSE.updateComboBox();
viewSW.updateComboBox();
setTitle(TITLE + ": " + file.getName());
repaint();
}
catch (IOException ex) {
System.err.println(ex);
}
}
break;
case "W":
file = null;
//Clear the model (erase the model data).
model.setRowCount(0);
model.setColumnCount(0);
setTitle(TITLE);
break;
case "S":
try {
// Create output stream (a BufferdReader object) from the file.
BufferedWriter outputStream = new BufferedWriter(new FileWriter(file));
// Write the first line to store the column names.
int columnCount = model.getColumnCount();
int rowCount = model.getRowCount();
if (columnCount > 0) {
for (int i = 0; i < columnCount -1; i++) {
outputStream.write(model.getColumnName(i) + ",");
}
outputStream.write(model.getColumnName(columnCount - 1) + "\n");
}
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < columnCount; j++) {
outputStream.write((j != 0 ? ", " : "") + model.getValueAt(i, j));
}
outputStream.write("\n");
}
outputStream.close();
}
catch (IOException ex) {
System.err.println(ex);
}
break;
case "Q":
System.exit(0);
break;
case "C":
int row = viewGUI.getEditingRow();
int col = viewGUI.getEditingColumn();
if (row >= 0 && col >= 0) {
clipboard = (String) model.getValueAt(row, col);
}
else {
clipboard = null;
}
break;
case "V":
row = viewGUI.getEditingRow();
col = viewGUI.getEditingColumn();
if (row >= 0 && col >= 0) {
viewGUI.setEditingColumn((col + 1) % model.getColumnCount());
model.setValueAt(clipboard, row, col);
}
break;
case "A":
JOptionPane.showMessageDialog(this, HELP);
break;
}
}
} | [
"airshp12@vt.edu"
] | airshp12@vt.edu |
62964fe812507f406f6cccfd96f8555b67f038ed | 9539a0bfad92a2293552e47ed22d4d3a73ad1757 | /src/main/java/ejercicio/ejer_t5_descarga/DescargaFase1.java | 6a92e16346f17644087f44c6e557a0d512ef883e | [
"Apache-2.0"
] | permissive | codeurjc/concurrencia-tema5 | 4371d6822556628511527c43a868fd27865e5f4a | 7971cef654e1b2cb56f98543fdb58a7efb9b644d | refs/heads/master | 2021-01-12T16:07:45.922599 | 2019-11-15T14:57:41 | 2019-11-15T14:57:41 | 71,943,652 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,845 | java | package ejercicio.ejer_t5_descarga;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class DescargaFase1 {
private static final boolean EXIT_ON_EXCEPTION = true;
private String downloadURL(URL website) throws IOException {
URLConnection connection = website.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null)
response.append(inputLine);
in.close();
return response.toString();
}
public List<String> loadURLs() throws IOException {
return Files.readAllLines(Paths.get("webs.txt"));
}
private void exec() throws Exception {
List<String> urls;
try {
urls = loadURLs();
} catch (IOException e) {
System.out
.println("Error reading webs.txt file: " + e.getMessage());
return;
}
List<DownloadedWeb> webs = new ArrayList<>();
int totalChars = 0;
long startTotalTime = System.currentTimeMillis();
for (String url : urls) {
try {
long startTime = System.currentTimeMillis();
System.out.println("Start downloading: " + url.trim());
String webContent = downloadURL(new URL(url));
int chars = webContent.length();
totalChars += chars;
long time = System.currentTimeMillis() - startTime;
System.out.println("Downloaded web " + url);
System.out.println(" Characters: " + chars);
System.out.println(
" First chars: " + webContent.substring(0, 100));
System.out.println(" Time: " + time + "ms");
System.out.println();
webs.add(new DownloadedWeb(url, webContent));
} catch (Exception e) {
System.out.println("Error downloading web " + url + ": "
+ e.getClass().getName());
webs.add(new DownloadedWeb(url, e));
if (EXIT_ON_EXCEPTION) {
break;
}
}
}
long totalTime = System.currentTimeMillis() - startTotalTime;
System.out.println();
System.out.println("Final report");
System.out.println();
System.out.println("Total downloaded chars: " + totalChars);
System.out.println("Total time: " + totalTime + "ms");
System.out.println();
for (DownloadedWeb web : webs) {
System.out.println("Web: " + web.getUrl());
String webContent = web.getWebContent();
if (webContent != null) {
System.out.println("Chars: " + web.getWebContent().length());
} else {
System.out.println(
"Error: " + web.getException().getClass().getName());
}
System.out.println();
}
}
public static void main(String[] args) throws Exception {
new DescargaFase1().exec();
}
}
| [
"micael.gallego@gmail.com"
] | micael.gallego@gmail.com |
7246948be259e5cfc0098393044508f54637a667 | 07d5341bce8ac343fe5e6753148f8d828c3723dc | /android/app/src/main/java/com/guer/MainActivity.java | 3f7ed9affcb82fab3ae07f269fba2fc0a7164249 | [] | no_license | guying-01/guer | e8725b1b51dfe2161f3b370e5fa8fd1c3d2c011b | 59f010df59d08472b47a031819a4e82cdcfc58fa | refs/heads/master | 2023-02-05T12:24:11.259091 | 2020-12-24T09:21:23 | 2020-12-24T09:21:23 | 291,638,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.guer;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "guer";
}
}
| [
"aries_man@126.com"
] | aries_man@126.com |
115e4d9d21815efe1cc72c50407254351174a95b | 8d935d44c34751b53895ce3383dde49073503251 | /src/main/java/org/iii/ideas/catering_service/rest/api/QueryStatisticResponse.java | 0ca76b99f66d7aad226e4045e7747567eb1593fa | [
"Apache-2.0"
] | permissive | NoahChian/Devops | b3483394b8e8189f4647a4ee41d8ceb8267eaebb | 3d310dedfd1bd07fcda3d5f4f7ac45a07b90489f | refs/heads/master | 2016-09-14T05:41:37.471624 | 2016-05-11T07:29:28 | 2016-05-11T07:29:28 | 58,521,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | package org.iii.ideas.catering_service.rest.api;
import java.util.ArrayList;
import java.util.List;
public class QueryStatisticResponse extends AbstractApiResponse{
private List<Object[]> result;
private Integer total;
private String msg;
private String[] header;
public void setResult(List<Object[]> result){
this.result=result;
}
public List<Object[]> getResult(){
return this.result;
}
public void setTotal(Integer total){
this.total=total;
}
public Integer getTotal(){
return this.total;
}
public void setMsg(String msg){
this.msg=msg;
}
public String getMsg(){
return this.msg;
}
public void setHeader(String[] header){
this.header=header;
}
public String[] getHeader(){
return this.header;
}
}
| [
"noahjian@iii.org.tw"
] | noahjian@iii.org.tw |
f610ffe109e3c315297614827be81bf9b0f365f9 | a090c3c160865f2825c01bd548e58c2a977f7a08 | /fluxtream-connectors/src/main/java/com/fluxtream/connectors/evernote/EvernotePhotoFacetVO.java | de68495f97227eda998c91e9e253fe86f6c2ecc2 | [
"Apache-2.0"
] | permissive | yaotiaojunzi/fluxtream-app | dac0927e061983606f7c47b7a207861c5dd0797d | ca351568aac27c9d5e67818fdb023ef019d6e8b0 | refs/heads/master | 2021-01-21T18:10:51.865269 | 2014-03-01T08:49:39 | 2014-03-01T08:49:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,179 | java | package com.fluxtream.connectors.evernote;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TimeZone;
import java.util.TreeMap;
import com.fluxtream.OutsideTimeBoundariesException;
import com.fluxtream.TimeInterval;
import com.fluxtream.connectors.vos.AbstractPhotoFacetVO;
import com.fluxtream.domain.GuestSettings;
import com.fluxtream.mvc.models.DimensionModel;
/**
* User: candide
* Date: 03/01/14
* Time: 17:06
*/
public class EvernotePhotoFacetVO extends AbstractPhotoFacetVO<EvernotePhotoFacet> {
public Map<Integer, String> thumbnailUrls = new HashMap<Integer, String>();
public SortedMap<Integer, Dimension> thumbnailSizes = new TreeMap<Integer, Dimension>();
public String thumbnailUrl;
public String photoUrl;
public float[] position;
@Override
protected void fromFacet(final EvernotePhotoFacet facet, final TimeInterval timeInterval, final GuestSettings settings) throws OutsideTimeBoundariesException {
deviceName = "Evernote";
channelName = "photo";
UID = facet.getId();
start = facet.start;
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.setTimeInMillis(start);
startMinute = c.get(Calendar.HOUR_OF_DAY)*60+c.get(Calendar.MINUTE);
int i = 0;
String homeBaseUrl = settings.config.get("homeBaseUrl");
final String thumbnailUrl = String.format("%severnote/res/%s/%s@w=150", homeBaseUrl, facet.apiKeyId, facet.guid);
this.thumbnailUrl = thumbnailUrl;
this.photoUrl = String.format("%severnote/res/%s/%s", homeBaseUrl, facet.apiKeyId, facet.guid);
thumbnailUrls.put(i, thumbnailUrl);
thumbnailSizes.put(i, new Dimension(150, 150));
i++;
// hereafter, flickr documentation specifies a number of pixels *on longest side* - since we don't have the
// original image's dimension, we just specify a square of that number
for (Integer width : new Integer[]{75, 100, 240, 320, 500, 640, 800, 1024}) {
thumbnailUrls.put(i, String.format("%severnote/res/%s/%s@w=%s", homeBaseUrl, facet.apiKeyId, facet.guid, width));
thumbnailSizes.put(i, new Dimension(width, width));
i++;
}
if (facet.resourceFacet.longitude!=null && facet.resourceFacet.latitude!=null){
position = new float[2];
position[0] = facet.resourceFacet.latitude.floatValue();
position[1] = facet.resourceFacet.longitude.floatValue();
}
}
@Override
public String getPhotoUrl() {
return photoUrl;
}
@Override
public String getThumbnail(final int index) {
return thumbnailUrls.get(index);
}
@Override
public List<DimensionModel> getThumbnailSizes() {
List<DimensionModel> dimensions = new ArrayList<DimensionModel>();
for (Dimension dimension : thumbnailSizes.values()) {
dimensions.add(new DimensionModel(dimension.width, dimension.height));
}
return dimensions;
}
}
| [
"candide@fluxtream.org"
] | candide@fluxtream.org |
eb2e303df8ecfdcfe920480d72642e4a10b155cb | 561792a13784c07f6bfef2d2370709de0f27e447 | /wtshop-model/src/main/java/com/wtshop/model/base/BaseAdmin.java | 99458a209127544628ba262272c4c4647295c46d | [] | no_license | 523570822/wtshop | a0b1d7390a6377af2307871ae20d8e669a8c4f4b | 6cfcf659babde3449df82ac57ce3b4bba5925ec4 | refs/heads/master | 2022-12-09T10:42:14.245989 | 2019-10-09T06:30:15 | 2019-10-09T06:30:15 | 139,920,178 | 0 | 1 | null | 2022-12-06T00:39:24 | 2018-07-06T01:52:39 | Java | UTF-8 | Java | false | false | 2,851 | java | package com.wtshop.model.base;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.IBean;
/**
* Generated by JFinal, do not modify this file.
*/
@SuppressWarnings("serial")
public abstract class BaseAdmin<M extends BaseAdmin<M>> extends Model<M> implements IBean {
public void setId(Long id) {
set("id", id);
}
public Long getId() {
return get("id");
}
public void setCreateDate(java.util.Date createDate) {
set("create_date", createDate);
}
public java.util.Date getCreateDate() {
return get("create_date");
}
public void setModifyDate(java.util.Date modifyDate) {
set("modify_date", modifyDate);
}
public java.util.Date getModifyDate() {
return get("modify_date");
}
public void setVersion(Long version) {
set("version", version);
}
public Long getVersion() {
return get("version");
}
public void setDepartment(String department) {
set("department", department);
}
public String getDepartment() {
return get("department");
}
public void setEmail(String email) {
set("email", email);
}
public String getEmail() {
return get("email");
}
public void setIsEnabled(Boolean isEnabled) {
set("is_enabled", isEnabled);
}
public Boolean getIsEnabled() {
return get("is_enabled");
}
public void setIsLocked(Boolean isLocked) {
set("is_locked", isLocked);
}
public Boolean getIsLocked() {
return get("is_locked");
}
public void setLockKey(String lockKey) {
set("lock_key", lockKey);
}
public String getLockKey() {
return get("lock_key");
}
public void setLockedDate(java.util.Date lockedDate) {
set("locked_date", lockedDate);
}
public java.util.Date getLockedDate() {
return get("locked_date");
}
public void setLoginDate(java.util.Date loginDate) {
set("login_date", loginDate);
}
public java.util.Date getLoginDate() {
return get("login_date");
}
public void setLoginFailureCount(Integer loginFailureCount) {
set("login_failure_count", loginFailureCount);
}
public Integer getLoginFailureCount() {
return get("login_failure_count");
}
public void setLoginIp(String loginIp) {
set("login_ip", loginIp);
}
public String getLoginIp() {
return get("login_ip");
}
public void setHasher(String hasher) {
set("hasher", hasher);
}
public String getHasher() {
return get("hasher");
}
public void setSalt(String salt) {
set("salt", salt);
}
public String getSalt() {
return get("salt");
}
public void setName(String name) {
set("name", name);
}
public String getName() {
return get("name");
}
public void setPassword(String password) {
set("password", password);
}
public String getPassword() {
return get("password");
}
public void setUsername(String username) {
set("username", username);
}
public String getUsername() {
return get("username");
}
}
| [
"523570822@qq.com"
] | 523570822@qq.com |
b56dca67b421ce82c1a03e3a97fdd0d3fd8bfd18 | 8a9d9bd9512d69ec1d5cb5303739599848cbb3f5 | /uva/marcus10452.java | a6e7abe9f373ab28f824358737df88c0f324f35a | [] | no_license | mavibirdesmi/cpcodes | 7b97510fc60a702746c3bff9333ce0bd79e1c33e | da8942d091068d4282704f65f25804d6b60a495a | refs/heads/master | 2022-11-13T06:35:11.122383 | 2020-07-08T23:50:24 | 2020-07-08T23:50:24 | 277,005,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,562 | java | import java.util.*;
import java.io.*;
//https://onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1393
class marcus10452 {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int l = sc.nextInt();
String key = "IEHOVA#";
for (int i = 0; i < l; i++) {
int n = sc.nextInt();
int m = sc.nextInt();
sc.nextLine();
char[][] grid = new char[n][m];
int sX = 0, sY = 0;
boolean found = false;
for (int k = 0; k < n; k++) {
String s = sc.nextLine();
grid[k] = s.toCharArray();
if (!found) {
for (int p = 0; p < m; p++) {
if (grid[k][p] == '@') {
sX = k;
sY = p;
found = true;
break;
}
}
}
}
int index = 0; // upto 6
String output = "";
while (index < 7) {
int[] adj1 = sX - 1 >= 0 ? new int[] {sX - 1, sY} : null; // forth
int[] adj2 = sY - 1 >= 0 ? new int[] {sX, sY - 1} : null; // left
int[] adj3 = sY + 1 < m ? new int[] {sX, sY + 1} : null; // right
String command;
if (adj1 != null && key.charAt(index) == grid[adj1[0]][adj1[1]]) {
sX = adj1[0];
sY = adj1[1];
command = "forth";
} else if (adj2 != null && key.charAt(index) == grid[adj2[0]][adj2[1]]) {
sX = adj2[0];
sY = adj2[1];
command = "left";
} else {
sX = adj3[0];
sY = adj3[1];
command = "right";
}
output += command;
if (index != 6) {
output += " ";
}
index++;
}
System.out.println(output);
}
sc.close();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
aaf6453c661df0ab7d4e859ce725ebd5e8f0b4e6 | cf6f9e7290b00aebb1fbb30b07d8850385c2e4ff | /src/comparators/OrdenaPorObjetivo.java | 9d807536a1ef3dabf50de57b82996b4181c1898c | [] | no_license | davibss/Psquiza | d346e0fb2c0032098eb89efb59d86588e29ba935 | 5afaeea61eec1b5beb9a6e977676481953357974 | refs/heads/master | 2022-03-02T09:50:43.399700 | 2019-11-21T12:40:40 | 2019-11-21T12:40:40 | 217,415,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,610 | java | package com.psquiza.comparators;
import com.psquiza.entidades.Pesquisa;
import java.util.Comparator;
/**
* Classe responsável por implementar uma interface Comparator Pesquisa e
* usar o método compare para ordenar as pesquisas por quantidade de objetivos e
* nome do objetivo.
*/
public class OrdenaPorObjetivo implements Comparator<Pesquisa> {
/**
* Método responsável por comparar 2 objetos do tipo pesquisa.
* A ordem vai de pesquisas com mais objetivos até as que tem menos objetivos.
* Em caso de empate, o objetivo de maior nome virá primeiro.
* @param p1 representação da primeira pesquisa passada para comparação.
* @param p2 representação da segunda pesquisa passada para comparação.
* @return um inteiro usado no método sort para ordenação.
*/
@Override
public int compare(Pesquisa p1, Pesquisa p2) {
if (p1.getObjetivos() > p2.getObjetivos()){
return -1;
}else if (p1.getObjetivos() < p1.getObjetivos()){
return 1;
}else{
String soString1 = p1.maiorObjetivo().replaceAll("[\\d.]", "");
String soString2 = p2.maiorObjetivo().replaceAll("[\\d.]", "");
if (soString1.equals(soString2)){
Integer soNumero1 = Integer.parseInt(p1.maiorObjetivo().replaceAll("\\D", ""));
Integer soNumero2 = Integer.parseInt(p2.maiorObjetivo().replaceAll("\\D", ""));
return soNumero1.compareTo(soNumero2) * -1;
}
return p1.maiorObjetivo().compareTo(p2.maiorObjetivo()) * -1;
}
}
}
| [
"dbssneon@gmail.com"
] | dbssneon@gmail.com |
ab2a4cde80c53172a9b29f9b48f9416b8b066bdd | 8e2001efd648760985892841138912c3d07328b0 | /src/com/tasomaniac/floodlight/model/Switch.java | c63b54324ac013fa50f3cbfb47d2553ca36d242d | [
"Apache-2.0"
] | permissive | tasomaniac/floodlight-android-ui | 2467f5f767bc884ab4be81fb5d75547cb4fb7d3a | f35ebe9c6e2a9bcc875289df31c90145028df519 | refs/heads/master | 2021-01-23T21:34:44.449714 | 2014-03-14T11:09:13 | 2014-03-14T11:09:13 | 6,427,331 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,210 | java | package com.tasomaniac.floodlight.model;
import java.util.ArrayList;
import java.util.List;
public class Switch {
String manufacturerDescription, hardwareDescription, softwareDescription, serialNumber, datapathDescription, dpid, packetCount, byteCount, flowCount;
List <Port> ports = new ArrayList<Port>();
List <Flow> flows= new ArrayList<Flow>();
public Switch(String dpid){
this.dpid = dpid;
}
public String getPacketCount() {
return packetCount;
}
public void setPacketCount(String packetCount) {
this.packetCount = packetCount;
}
public String getByteCount() {
return byteCount;
}
public void setByteCount(String byteCount) {
this.byteCount = byteCount;
}
public String getFlowCount() {
return flowCount;
}
public void setFlowCount(String flowCount) {
this.flowCount = flowCount;
}
public String getDpid() {
return dpid;
}
public void setDpid(String dpid) {
this.dpid = manufacturerDescription;
}
public String getManufacturerDescription() {
return manufacturerDescription;
}
public void setManufacturerDescription(String manufacturerDescription) {
this.manufacturerDescription = manufacturerDescription;
}
public String getHardwareDescription() {
return hardwareDescription;
}
public void setHardwareDescription(String hardwareDescription) {
this.hardwareDescription = hardwareDescription;
}
public String getSoftwareDescription() {
return softwareDescription;
}
public void setSoftwareDescription(String softwareDescription) {
this.softwareDescription = softwareDescription;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public String getDatapathDescription() {
return datapathDescription;
}
public void setDatapathDescription(String datapathDescription) {
this.datapathDescription = datapathDescription;
}
public List<Port> getPorts() {
return ports;
}
public void setPorts(List<Port> ports) {
this.ports = ports;
}
public List<Flow> getFlows(){
return flows;
}
public void setFlows(List<Flow> flows) {
this.flows = flows;
}
@Override
public String toString() {
return dpid;
}
}
| [
"tasomaniac@gmail.com"
] | tasomaniac@gmail.com |
d8f1b4699cd311f7ebbb3170aeeccebc153c640a | 443dd8e635e746dded1b6e9665eca7a00f7af5bb | /src/main/java/com/ysu/hotel/dao/impl/UserDaoImpl.java | 851be57dbdad458eb1411ae13694b643c8f7ffff | [] | no_license | 1761890266/hotel | 07eb80e8dd3120db5ce37cbea4fd50a372ffb0f4 | dfdc0009e53526e346fb1d968ce63311d7590c90 | refs/heads/master | 2022-10-22T17:35:08.265301 | 2020-06-18T02:18:23 | 2020-06-18T02:18:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | package com.ysu.hotel.dao.impl;
import com.ysu.hotel.dao.UserDao;
import com.ysu.hotel.entity.User;
import com.ysu.hotel.util.JdbcUtil;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
* @author lixuhui
* @date 2020/6/18
*/
public class UserDaoImpl implements UserDao {
@Override
public User findById(Integer id) throws SQLException {
Connection connection = JdbcUtil.getConnection();
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("select * from user where id = 1");
User user = new User();
while (resultSet.next()) {
user.setId(resultSet.getInt("id"));
user.setLogin(resultSet.getString("login"));
user.setName(resultSet.getString("name"));
user.setPassword(resultSet.getString("password"));
user.setNote(resultSet.getString("note"));
user.setPermissions(resultSet.getInt("permissions"));
}
return user;
}
}
| [
"oncwnuHnDUoMjXEWV6TTOKa96foE@git.weixin.qq.com"
] | oncwnuHnDUoMjXEWV6TTOKa96foE@git.weixin.qq.com |
9bdad149cc0dfcd6a03870a37dbba481110e5151 | c42d84c8981a9dbd8acca790797b01af7b04d4ae | /src/main/java/wang/huaichao/web/dao/UserDao.java | a1ce28e49ef82049805efe02910b0eea80a8e2a6 | [] | no_license | doodlecoge/website | cadaa85927f4752ee6093f3c4b4c44f2363b4a07 | 1626f95d70765943d34ee346a7045aabcfe6b795 | refs/heads/master | 2016-09-06T04:59:16.521861 | 2015-07-02T14:10:12 | 2015-07-02T14:10:12 | 32,562,632 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,888 | java | package wang.huaichao.web.dao;
import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.classic.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import wang.huaichao.web.model.Image;
import wang.huaichao.web.model.User;
import java.util.List;
import java.util.Set;
/**
* Created by Administrator on 2015/1/6.
*/
@Repository
public class UserDao extends TheDao {
public User getUser(String username) {
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria(User.class);
criteria.add(Restrictions.eq("username", username));
return (User) criteria.uniqueResult();
}
public void delete(String username) {
Session session = sessionFactory.getCurrentSession();
final User user = new User();
user.setUsername(username);
session.delete(user);
}
public void add(User user) {
Session session = sessionFactory.getCurrentSession();
session.save(user);
}
public void update(User user) {
Session session = sessionFactory.getCurrentSession();
session.update(user);
}
@SuppressWarnings("unchecked")
public List<User> getUsers() {
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria(User.class);
return criteria.list();
}
public List<Image> getImages(String username) {
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria(User.class)
.add(Restrictions.eq("username", username));
User user = (User) criteria.uniqueResult();
Hibernate.initialize(user.getImages());
return user.getImages();
}
}
| [
"doodlecoge@163.com"
] | doodlecoge@163.com |
59c3d4f315b33b264a823d00951433a74b5a007f | af884fcc818beaa788fb93739d67cc14a72eedcb | /app/src/main/java/me/flooz/app/UI/Tools/OnSwipeTouchListener.java | 95d2b812c15bc8c193ec0f1f8d00055c0a4893a7 | [] | no_license | larafale/flooz-android | 14350cb3560a473829e7bb0c2b344ad463aef546 | ecb1dca27d69f0b00bb73a38a9ebe4159c56d8c6 | refs/heads/master | 2021-03-27T10:56:01.438279 | 2018-11-28T16:30:24 | 2018-11-28T16:30:24 | 23,538,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,477 | java | package me.flooz.app.UI.Tools;
/**
* Created by Flooz on 2/11/15.
*/
import android.content.Context;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
public class OnSwipeTouchListener implements OnTouchListener {
private final GestureDetector gestureDetector;
public OnSwipeTouchListener (Context ctx){
gestureDetector = new GestureDetector(ctx, new GestureListener());
}
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
private final class GestureListener extends SimpleOnGestureListener {
private static final int SWIPE_THRESHOLD = 80;
private static final int SWIPE_VELOCITY_THRESHOLD = 100;
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
onClick();
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
boolean result = false;
try {
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) {
onSwipeRight();
} else {
onSwipeLeft();
}
}
result = true;
}
else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) {
if (diffY > 0) {
onSwipeBottom();
} else {
onSwipeTop();
}
}
result = true;
} catch (Exception exception) {
exception.printStackTrace();
}
return result;
}
}
public void onClick() {
}
public void onSwipeRight() {
}
public void onSwipeLeft() {
}
public void onSwipeTop() {
}
public void onSwipeBottom() {
}
}
| [
"olivier.mouren@epitech.eu"
] | olivier.mouren@epitech.eu |
4467a500414425106dd226178f2424dab13e077f | 0721305fd9b1c643a7687b6382dccc56a82a2dad | /src/app.zenly.locator_4.8.0_base_source_from_JADX/sources/com/bumptech/glide/request/target/C9234e.java | 9da9d13b3a202300eeb57236bf6aff01f8534e10 | [] | no_license | a2en/Zenly_re | 09c635ad886c8285f70a8292ae4f74167a4ad620 | f87af0c2dd0bc14fd772c69d5bc70cd8aa727516 | refs/heads/master | 2020-12-13T17:07:11.442473 | 2020-01-17T04:32:44 | 2020-01-17T04:32:44 | 234,470,083 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.bumptech.glide.request.target;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
/* renamed from: com.bumptech.glide.request.target.e */
public class C9234e extends C9235f<Drawable> {
public C9234e(ImageView imageView) {
super(imageView);
}
/* access modifiers changed from: protected */
/* renamed from: a */
public void mo24906a(Drawable drawable) {
((ImageView) this.f24006f).setImageDrawable(drawable);
}
}
| [
"developer@appzoc.com"
] | developer@appzoc.com |
8364aee513bb5e6109ad21f5a5b918bf0851dbee | 12daebd5e6399d367c147ff88fad236c66b40786 | /src/main/java/com/refinedmods/refinedstorage/api/network/IWirelessTransmitter.java | fe8ca140d893ae77dec2133412c772949d31e7fd | [
"MIT"
] | permissive | refinedmods/refinedstorage | 767b2acbcc2bd498d7633308f589062b89e77ab8 | e46046418fca514b58c3abb93e1b9b98d5361ce7 | refs/heads/develop | 2023-09-01T14:33:35.870033 | 2023-07-08T13:02:37 | 2023-07-08T13:02:37 | 47,563,072 | 181 | 115 | MIT | 2023-07-05T09:32:58 | 2015-12-07T16:05:16 | Java | UTF-8 | Java | false | false | 642 | java | package com.refinedmods.refinedstorage.api.network;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
/**
* Represents a node that can send a wireless signal.
*/
public interface IWirelessTransmitter {
/**
* @return the range in blocks of this transmitter, starting from {@link IWirelessTransmitter#getOrigin()}
*/
int getRange();
/**
* @return the position where the wireless signal starts
*/
BlockPos getOrigin();
/**
* @return the dimension in which the transmitter is
*/
ResourceKey<Level> getDimension();
}
| [
"raoulvdberge@gmail.com"
] | raoulvdberge@gmail.com |
6aa46011c3521ecaee77fc3e75fb22272bef3794 | eba2254e90b9c0b9895504ffd2aba1050206db0f | /src/alg77777777/p2/RapidoFatal.java | 49ab54cec5c1262c25bb2f0166b0b01afd9809c4 | [
"Unlicense"
] | permissive | Llambi/Algoritmia | 77008e1d94f343adeab925ca8b107b538fcd0263 | 2f3845adda75e1a3fff79eb670720fe5422152ee | refs/heads/master | 2020-04-20T03:57:34.265933 | 2019-05-02T16:19:50 | 2019-05-02T16:19:50 | 168,613,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,941 | java | package alg77777777.p2;
import alg77777777.p2.Vector;
/** Este programa sirve para ordenar n elementos con un algoritmo QUICKSORT
Pero como selecciona como pivote el elemento primero de la partición, si se
le mete el array ordenado tiene un comportamiento fatal (cuadrático).
*/
public class RapidoFatal extends Vector
{
public static void main (String arg [] )
{
// VAMOS AHORA PROBAR QUE ES CUADRATICO (FATAL)
// EN EL CASO ORDENADO SELECIONANDO COMO PIVOTE
// EL PRIMERO EN CADA PARTICION
System.out.println ("Tiempos para el caso FATAL comentado");
long t1,t2;
int n;
for (n=100;n<10000;n*=2)
{
Vector v = new RapidoFatal(n);
v.ordenDirecto();
t1 = System.currentTimeMillis();
for (int nVeces=1;nVeces<=1000;nVeces++) v.ordenar(); // microsegundos
t2 = System.currentTimeMillis();
System.out.println ("n="+n+"**TIEMPO="+(t2-t1)+" MICROSEGUNDOS");
} // de for
} //fin de main
public RapidoFatal(int nElementos) {
super(nElementos);
}
/** Deja el pivote en una posición tal que a su izquierda no hay
ningún mayor, ni a la derecha ningún menor.
es un proceso lineal O(n).
*/
private int particion (int iz, int de)
{
int i, pivote;
pivote= this.elements[iz]; //el pivote es el primero
i= iz;
for (int s= iz+1; s <= de; s++)
if (this.elements[s] <= pivote)
{
i++;
intercambiar(i, s);
}
intercambiar(iz, i);
//se restituye el pivote donde debe estar
return i; // retorna la posicion en que queda el pivote
}
private void rapirec (int iz, int de)
{
int m;
if (de>iz)
{
m=particion(iz, de);
rapirec(iz, m-1);
rapirec(m+1, de);
}
}
//Antes se llamaba 'rapido2'
@Override
public void ordenar() {
rapirec(0,this.elements.length-1);
}
@Override
public String getNombre() {
return "Rápido pivote inicial";
}
}
| [
"hugopf.mail@gmail.com"
] | hugopf.mail@gmail.com |
2b11e7ae5dd2f812cad2a7c7a8030119a635c824 | e315f03bc5e32224a27cc81bc485260399c16043 | /topjobs2/src/main/java/com/niit/web/ShowResumeJobSeekerServlet.java | 9ebf82558ccd0da24fda9e4b49354db665abbc40 | [] | no_license | diwakarsaini/web | dabe33b28025dff9dceb38657aa84f99a38865ea | 8111cfe985c4692fadef0f2e9465be1988513d29 | refs/heads/master | 2020-04-15T21:15:08.502266 | 2019-01-30T06:37:15 | 2019-01-30T06:37:15 | 165,026,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,852 | java | package com.niit.web;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.niit.domain.JobSeeker;
import com.niit.domain.User;
import com.niit.ro.ResumeRequest;
import com.niit.service.ResumeService;
/**
* Servlet implementation class ShowResumeJobSeekerServlet
*/
public class ShowResumeJobSeekerServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ShowResumeJobSeekerServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
ResumeRequest req=new ResumeRequest();
JobSeeker jobSeeker=new JobSeeker();
jobSeeker.setUser_name(request.getRemoteUser());
req.setJobSeeker(jobSeeker);
ResumeService res=new ResumeService();
req=res.viewResumeJobSeeker(req);
request.setAttribute("resume", req);
System.out.println(req);
RequestDispatcher rd=request.getRequestDispatcher("/showresume");
rd.forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"Diwakar@192.168.0.5"
] | Diwakar@192.168.0.5 |
076155d91c003f2321fc0e64486f3733b218bfac | d6fc5638cf2911a4af7eec5d7890988bcc42ddaa | /app/src/main/java/ru/by/rsa/FtpSyncparamActivity.java | 6114782ff8c1e875887c03ea39c1f672c1920a9b | [] | no_license | artem-shevchuk84/RSA_sources | e77f2633ddf20026197e435cabd14454cff4b640 | 968c5fdfe2a4c3f3594b4ee98d9782e434bdbe12 | refs/heads/master | 2020-03-07T09:25:23.194667 | 2018-03-30T09:09:59 | 2018-03-30T09:09:59 | 127,407,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,728 | java | package ru.by.rsa;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
/**
* Activity for setting up Email-transport parameters
* and save them in SharedPreferences of app
* @author Komarev Roman
* Odessa, neo3da@mail.ru, +380503412392
*/
public class FtpSyncparamActivity extends Activity {
SharedPreferences def_pref;
private TextWatcher mWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if (def_pref.getBoolean("encoded", false)) {
def_pref.edit().putBoolean("encoded", false).commit();
Toast.makeText(getApplicationContext(), "Вы отключили шифрование",
Toast.LENGTH_SHORT).show();
}
}
};
public void onCreate(Bundle savedInstanceState) {
boolean lightTheme = getSharedPreferences(RsaDb.PREFS_NAME_MAIN, Context.MODE_PRIVATE).getBoolean(RsaDb.LIGHTTHEMEKEY, false);
if (lightTheme) {
setTheme(R.style.Theme_Custom);
} else {
setTheme(R.style.Theme_CustomBlack2);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.ftpsendprm);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
def_pref = PreferenceManager.getDefaultSharedPreferences(this);
/** Bind Applay button on display with variable */
Button btnApplay = (Button)findViewById(R.id.btnApply_ftpSendprm);
EditText edtLogin = (EditText)findViewById(R.id.edtLogin_ftpSendprm);
EditText edtPass = (EditText)findViewById(R.id.edtPass_ftpSendprm);
EditText edtServer = (EditText)findViewById(R.id.edtServer_ftpSendprm);
EditText edtPort = (EditText)findViewById(R.id.edtPort_ftpSendprm);
EditText edtInbox = (EditText)findViewById(R.id.edtInbox_ftpSendprm);
EditText edtOutbox = (EditText)findViewById(R.id.edtOutbox_ftpSendprm);
/** Get Shared Preferences and fill EditText boxes with it */
SharedPreferences prefs = getSharedPreferences(RsaDb.PREFS_NAME, Context.MODE_PRIVATE);
edtLogin.setText(prefs.getString(RsaDb.FTPUSER, "") );
edtPass.setText(prefs.getString(RsaDb.FTPPASSWORD, "") );
edtServer.setText(prefs.getString(RsaDb.FTPSERVER, "") );
edtPort.setText(prefs.getString(RsaDb.FTPPORT, "") );
edtInbox.setText(prefs.getString(RsaDb.FTPINBOX, "") );
edtOutbox.setText(prefs.getString(RsaDb.FTPOUTBOX, "") );
edtLogin.addTextChangedListener(mWatcher);
edtPass.addTextChangedListener(mWatcher);
// Set Listener when button click performed
btnApplay.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0)
{
EditText edtLogin = (EditText)findViewById(R.id.edtLogin_ftpSendprm);
EditText edtPass = (EditText)findViewById(R.id.edtPass_ftpSendprm);
EditText edtServer = (EditText)findViewById(R.id.edtServer_ftpSendprm);
EditText edtPort = (EditText)findViewById(R.id.edtPort_ftpSendprm);
EditText edtInbox = (EditText)findViewById(R.id.edtInbox_ftpSendprm);
EditText edtOutbox = (EditText)findViewById(R.id.edtOutbox_ftpSendprm);
String login = edtLogin.getText().toString().replace(" ", "");
edtServer.setText(edtServer.getText().toString().replace(" ", ""));
String port = edtPort.getText().toString().replace(" ", "");
if (port.length()<1) {
port = "21";
}
edtPort.setText(port);
/** Set Shared Preferences with data from EditText boxes*/
SharedPreferences prefs = getSharedPreferences(RsaDb.PREFS_NAME, Context.MODE_PRIVATE);
prefs.edit().putString(RsaDb.FTPUSER, login).commit();
prefs.edit().putString(RsaDb.FTPPASSWORD, edtPass.getText().toString()).commit();
prefs.edit().putString(RsaDb.FTPSERVER, edtServer.getText().toString()).commit();
prefs.edit().putString(RsaDb.FTPPORT, edtPort.getText().toString()).commit();
prefs.edit().putString(RsaDb.FTPINBOX, edtInbox.getText().toString()).commit();
prefs.edit().putString(RsaDb.FTPOUTBOX, edtOutbox.getText().toString()).commit();
Toast.makeText(getApplicationContext(),R.string.sendprm_saved,Toast.LENGTH_SHORT).show();
}});
}
/**
* Method that starts if system trying to destroy activity
*/
@Override
protected void onDestroy()
{
super.onDestroy();
SharedPreferences prefs;
prefs = getSharedPreferences(RsaDb.PREFS_NAME, Context.MODE_PRIVATE);
prefs.edit().putBoolean(RsaDb.ACTIVESYNCKEY, false).commit();
}
/**
* If Back-button on device pressed then do...
*/
@Override
public void onBackPressed()
{
/** Get Shared Preferences and fill special field of message with it */
SharedPreferences prefs;
prefs = getSharedPreferences(RsaDb.PREFS_NAME, Context.MODE_PRIVATE);
if (prefs.getBoolean(RsaDb.ACTIVESYNCKEY, true))
{
Toast.makeText(getApplicationContext(),R.string.sendprm_wait,Toast.LENGTH_SHORT).show();
return;
}
finish();
}
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
}
| [
"Ghjuhfvth16"
] | Ghjuhfvth16 |
7db6d32784b5f1449ac0eede7919a489c6cf070a | c201d9022ba35acf9788fa25c0f4ee552933aaf3 | /app/src/main/java/com/danielmerrill/gettingwarmer/ActionsFragment.java | dedc72fafe444f0fc7a3b282fe2ec31aff27c8f5 | [] | no_license | computerjazz/Getting-Warmer | 8664d5bde259c7031e0e13efcc2c362cd1175cee | 8b373d0d7700df3ed3328d2c0c20e74df66035c5 | refs/heads/master | 2020-04-14T12:42:48.176527 | 2016-10-04T01:35:24 | 2016-10-04T01:35:24 | 61,386,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,147 | java | package com.danielmerrill.gettingwarmer;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.os.Bundle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.AppCompatButton;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;
public class ActionsFragment extends android.support.v4.app.Fragment {
// GPSTracker class
GPSTracker gps;
EditText friendUserName_input;
private ImageView closeDrawer;
private AppCompatButton addFriendIcon;
private ListView flv;
private ListView rlv;
private NoScrollListView requestsListView;
private LinearLayout layout_requests;
private TextView distFromTarget;
private TextView friendListTitle;
private NoScrollListView friendsListView;
private String username;
private boolean hasLocation;
private boolean isNewLocation;
private ArrayList<String> friendsList;
private ArrayList<String> requestsList;
private ArrayList<String> friendsWithNewLocations;
private int ANIMATION_DURATION = 200;
private DrawerLayout mDrawerLayout;
private ColorActivity colorActivity;
private double targetLatitude;
private double targetLongitude;
private UsernameValidator usernameValidator;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_actions, container, false);
hasLocation = false;
isNewLocation = false;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
username = prefs.getString("username", "");
TextView userView = (TextView) v.findViewById(R.id.username_view);
userView.setText(username);
friendUserName_input = (EditText)v.findViewById(R.id.input_friendUsername);
flv = (ListView) v.findViewById(R.id.friends_list);
flv.setDivider(null);
flv.setDividerHeight(0);
rlv = (ListView) v.findViewById(R.id.requests_list);
rlv.setDivider(null);
rlv.setDividerHeight(0);
friendListTitle = (TextView) v.findViewById(R.id.textview_friends);
friendsListView = (NoScrollListView) v.findViewById(R.id.friends_list);
closeDrawer = (ImageView) v.findViewById(R.id.closeDrawer);
mDrawerLayout = (DrawerLayout) getActivity().findViewById(R.id.drawer_layout);
addFriendIcon = (AppCompatButton) v.findViewById(R.id.btn_addfriendIcon);
layout_requests = (LinearLayout) v.findViewById(R.id.layout_requests);
usernameValidator = new UsernameValidator();
friendsList = new ArrayList<>();
requestsList = new ArrayList<>();
friendsWithNewLocations = new ArrayList<>();
setRequestsList(new ArrayList<String>());
setFriendsList(new ArrayList<String>(), new ArrayList<String>());
colorActivity = (ColorActivity) getActivity();
getFriendsWithNewLocation();
refreshFriendsList();
refreshRequestsList();
// Set up a listener to run request friend from softkeyboard
friendUserName_input.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "enter" button
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
// Perform action on key press
requestFriend(v);
return true;
}
return false;
}
});
// set up friend request list click handler to accept requests
rlv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,int position, long id)
{
final String selectedFromList = (rlv.getItemAtPosition(position).toString());
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("FRIEND REQUEST");
builder.setMessage(selectedFromList + " wants to be your friend");
builder.setCancelable(true);
builder.setIcon(R.drawable.ic_account_circle_grey_24dp);
builder.setTitle(selectedFromList.toUpperCase());
builder.setPositiveButton(
"Accept",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
acceptFriend(selectedFromList);
dialog.cancel();
}
});
builder.setNegativeButton(
"Deny",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
deleteRelationship(selectedFromList);
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
flv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final Friend friendObj = (Friend) flv.getItemAtPosition(position);
final String friend = friendObj.name;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(friend.toUpperCase());
builder.setCancelable(true);
builder.setIcon(R.drawable.ic_person_pin_circle_grey_24dp);
builder.setMessage("Sending your location will overwrite any past locations sent to " + friend);
builder.setPositiveButton(
"Find",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
colorActivity.reset();
colorActivity.setFriendUsername(friend);
dialog.cancel();
mDrawerLayout.closeDrawers();
}
});
builder.setNegativeButton(
"Send",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
sendLocation(friend);
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
});
flv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int pos, long id) {
// get location info
// create class object
Friend friendObj = (Friend)flv.getItemAtPosition(pos);
final String friend =friendObj.name;
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("UNFRIEND");
builder.setMessage("Remove " + friend + " from your friends?");
builder.setCancelable(true);
builder.setIcon(R.drawable.ic_delete_grey_24dp);
builder.setPositiveButton(
"Remove",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
deleteRelationship(friend);
dialog.cancel();
}
});
builder.setNegativeButton(
"Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
return true;
}
});
closeDrawer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDrawerLayout.closeDrawers();
}
});
addFriendIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
requestFriend(v);
}
});
return v;
}
// Set location of friend with username 'f'
private void sendLocation(String friendUsername) {
final String friend = friendUsername;
gps = new GPSTracker(getActivity());
// check if GPS enabled
if(gps.canGetLocation()){
double latitude = gps.getLatitude();
double longitude = gps.getLongitude();
//Creating Rest Services
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method -- sending 0.0 is ugly but restInterface won't take null
restInterface.setLocation(friend, username, latitude, longitude, 0.0, 0.0, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //setlocation Success
Toast.makeText(getActivity().getApplicationContext(), "Sent your current location to " + friend, Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("0")) {
} else if (model.getStatus().equals("2")) {
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity().getApplicationContext(), merror, Toast.LENGTH_LONG).show();
}
});
//Toast.makeText(getActivity().getApplicationContext(), "Setting location - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
} else {
// can't get location
// GPS or Network is not enabled
// Ask user to enable GPS/network in settings
gps.showSettingsAlert();
}
}
public void refresh() {
getFriendsWithNewLocation();
refreshFriendsList();
refreshRequestsList();
}
//TODO
private boolean isLocationSet(String friendName) {
boolean locationSet = false;
//Creating Rest Services
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method
restInterface.getLocation(username, friendName, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //getlocation Success
if (model.getLatitudeTarget() == null && model.getLongitudeTarget() == null) {
hasLocation = false;
} else {
hasLocation = true;
if (model.getIsNew().equals("1")) { // check if location is new
isNewLocation = true;
} else {
isNewLocation = false;
}
}
} else if (model.getStatus().equals("0")) {
} else if (model.getStatus().equals("2")) {
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity(), merror, Toast.LENGTH_SHORT).show();
}
});
return hasLocation;
}
private void deleteRelationship(String friendName) {
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
final String friend = friendName;
//Creating Rest Services
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method to signup
restInterface.deleteRelationship(username, friend, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //Delete relationship Success
refresh();
Toast.makeText(getActivity().getApplicationContext(), "Removed " + friend, Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("0")) { // Friend add failure
Toast.makeText(getActivity().getApplicationContext(), friend + " does not exist", Toast.LENGTH_SHORT).show();
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity().getApplicationContext(), merror, Toast.LENGTH_LONG).show();
}
});
}
public void acceptFriend(String friendName) {
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
final String friend = friendName;
//Creating Rest Services
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method to signup
restInterface.requestFriend(username, friend, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //AddFriend Success
refreshFriendsList();
Toast.makeText(getActivity().getApplicationContext(), "Accepted friend request from " + friend, Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("0")) { // Friend add failure
Toast.makeText(getActivity().getApplicationContext(), friend + " does not exist", Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("3")) { // previous request from friend was already sent, so add friends
refreshFriendsList();
refreshRequestsList();
// hide keyboard
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
if (getActivity().getCurrentFocus() != null) {
imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
}
Toast.makeText(getActivity(), "Now friends with " + friend, Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("4")) { // already sent request
Toast.makeText(getActivity().getApplicationContext(), "Request to " + friend + " already sent", Toast.LENGTH_SHORT).show();
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity().getApplicationContext(), merror, Toast.LENGTH_LONG).show();
}
});
}
public void requestFriend(View v) {
final String friendUserName = friendUserName_input.getText().toString();
//setContentView(R.layout.progressbar_layout);
//making object of RestAdapter
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
//Creating Rest Services
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method to signup
if (friendUserName.toLowerCase().equals(username.toLowerCase())) {
Animation shake = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.shake);
friendUserName_input.startAnimation(shake);
Toast.makeText(getActivity().getApplicationContext(), "That's you!", Toast.LENGTH_SHORT).show();
} else if (isValid(friendUserName, friendUserName_input)) {
restInterface.requestFriend(username, friendUserName, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //AddFriend Success
refreshFriendsList();
Toast.makeText(getActivity().getApplicationContext(), "Sent a friend request to " + friendUserName, Toast.LENGTH_SHORT).show();
friendUserName_input.setText("");
// hide keyboard
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
} else if (model.getStatus().equals("0")) { // Friend add failure
Animation shake = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.shake);
friendUserName_input.startAnimation(shake);
Toast.makeText(getActivity().getApplicationContext(), friendUserName + " does not exist", Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("3")) { // previous request from friend was already sent, so add to friends
refreshFriendsList();
refreshRequestsList();
friendUserName_input.setText("");
// hide keyboard
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
Toast.makeText(getActivity().getApplicationContext(), "Now friends with " + friendUserName, Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("4")) { // already sent request
// hide keyboard
friendUserName_input.setText("");
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
Animation shake = AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.shake);
friendUserName_input.startAnimation(shake);
Toast.makeText(getActivity().getApplicationContext(), "Request to " + friendUserName + " already sent", Toast.LENGTH_SHORT).show();
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity().getApplicationContext(), merror, Toast.LENGTH_LONG).show();
}
});
}
}
//checking field are empty
private boolean isValid(String s, EditText e){
if(s.equals("")) {
e.setError("There's nothing here!");
}
return usernameValidator.validate(s);
}
private void setFriendsList(ArrayList<String> fl, ArrayList<String> friendsWithNewLocations) {
if (getActivity() == null) return;
Friend friend_data[] = new Friend[fl.size()];
for (int i = 0; i < fl.size(); i++) {
friend_data[i] = new Friend(fl.get(i), friendsWithNewLocations);
}
FriendAdapter friendAdapter = new FriendAdapter(
getActivity(),
R.layout.listview_item,
friend_data);
flv.setAdapter(friendAdapter);
}
private void setRequestsList(ArrayList<String> rl) {
if (getActivity() != null) {
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
getActivity(),
R.layout.custom_listitem,
rl);
rlv.setAdapter(arrayAdapter);
showOrHideRequestsList(rl);
}
}
private void showOrHideRequestsList(List<String> requestList) {
if (requestList.size() == 0) {
layout_requests.setVisibility(View.GONE);
} else {
layout_requests.setVisibility(View.VISIBLE);
}
}
public void refreshFriendsList() {
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
//Creating Rest Services
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method to get friends list
restInterface.getFriends(username, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //get friends Success
ArrayList<String> friends = (ArrayList<String>) model.getFriends();
Collections.sort(friends, String.CASE_INSENSITIVE_ORDER);
if (!friends.equals(friendsList)) {
setFriendsList(friends, friendsWithNewLocations);
friendsList = friends;
}
} else if (model.getStatus().equals("2")) { // database error
Toast.makeText(getActivity().getApplicationContext(), "Couldn't get friends", Toast.LENGTH_SHORT).show();
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity().getApplicationContext(), merror, Toast.LENGTH_LONG).show();
}
});
}
public void refreshRequestsList() {
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
//Creating Rest Services
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method to get friends list
restInterface.getRequests(username, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //get friend requests Success
ArrayList<String> requests = (ArrayList<String>) model.getRequests();
Collections.sort(requests, String.CASE_INSENSITIVE_ORDER);
//Toast.makeText(getActivity().getApplicationContext(), "Got: " + requests.size() + " Had: " + requestsList.size(), Toast.LENGTH_SHORT).show();
if (!requests.equals(requestsList)) {
requestsList = requests;
setRequestsList(requests);
}
} else if (model.getStatus().equals("2")) { // database error
Toast.makeText(getActivity().getApplicationContext(), "Couldn't get friend requests", Toast.LENGTH_SHORT).show();
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity().getApplicationContext(), merror, Toast.LENGTH_LONG).show();
}
});
}
public void getFriendsWithNewLocation() {
RestAdapter adapter = new RestAdapter.Builder().setEndpoint(RestInterface.url).build();
//Creating Rest Services
final RestInterface restInterface = adapter.create(RestInterface.class);
//Calling method to get friends list
restInterface.getFriendsWithNewLocation(username, new Callback<LoginModel>() {
@Override
public void success(LoginModel model, Response response) {
if (model.getStatus().equals("1")) { //get friends Success
ArrayList<String> friends = (ArrayList<String>) model.getFriendsWithNewLocation();
Collections.sort(friends, String.CASE_INSENSITIVE_ORDER);
if (!friendsWithNewLocations.equals(friends)) {
friendsWithNewLocations = friends;
setFriendsList(friendsList, friendsWithNewLocations);
}
//Toast.makeText(getActivity(), friends.toString(), Toast.LENGTH_SHORT).show();
} else if (model.getStatus().equals("2")) { // database error
Toast.makeText(getActivity().getApplicationContext(), "Couldn't refresh locations", Toast.LENGTH_SHORT).show();
}
}
@Override
public void failure(RetrofitError error) {
String merror = error.getMessage();
Toast.makeText(getActivity().getApplicationContext(), merror, Toast.LENGTH_LONG).show();
}
});
}
}
| [
"daniel.r.merrill@gmail.com"
] | daniel.r.merrill@gmail.com |
9f5deb619b5705a536408ac6b05031f7a9e3653d | 5d97d2132cd4b387f4970e54d75808d8b5073347 | /rpc-api/src/main/java/st/rpc/api/HelloObject.java | 37d5634324ab1b9f40cf5fc5eaf11461aa088507 | [] | no_license | smilesboy/simpleRPC | afe904500cd25faaa39d1efb1b8ca690e5812147 | d8a920fad88f8f8d7c504ab16ef1e50dae831059 | refs/heads/master | 2022-12-27T07:17:56.523077 | 2020-10-06T09:06:43 | 2020-10-06T09:06:43 | 289,894,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package st.rpc.api;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author sutian
* @Date 2020/8/17
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HelloObject implements Serializable {
private Integer id;
private String message;
}
| [
"email@1563400360@qq.com"
] | email@1563400360@qq.com |
1abcea991c20fcd20f35fa0a2d1568237383be38 | 922746e28e43f54a086d1cdcff2cfe426b173dd7 | /wang/src/main/java/com/jc/oa/network/service/IToaNetworkTenanciesService.java | 99ec9b56e61693b33f302fb2e2528a297a0dffb3 | [] | no_license | wtfc/springboot-shyt | f934161c6cdf37ba99515257ffba7f8d50822b5c | 1b67918f7a129ffef16ca61be0738c241029866f | refs/heads/master | 2020-04-09T05:24:39.017913 | 2018-12-02T17:42:27 | 2018-12-02T17:42:27 | 160,063,362 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package com.jc.oa.network.service;
import com.jc.foundation.service.IBaseService;
import com.jc.system.CustomException;
import com.jc.oa.network.domain.ToaNetworkTenancies;
/**
* @author mrb
* @version 退租客户记录表
*/
public interface IToaNetworkTenanciesService extends IBaseService<ToaNetworkTenancies>{
public Integer deleteByIds(ToaNetworkTenancies toaNetworkTenancies) throws CustomException;
}
| [
"1226105567@qq.com"
] | 1226105567@qq.com |
fc1ea12bc39e0949de56625357c74d661db4c453 | bb44f38e59f6ffe125ada8e5df8bb0b72d6750fe | /A1-HadoopMapReduce/Question1/src/data/paloalto/categories/UniqueCategoriesMapper.java | c0b7eb37bc082d5e028f533a8201ec90bf229f4b | [] | no_license | ShrutiHarihar/BigData | ff012e689583cf454ca072118eddd229a2f9399d | f57b2ee24a809113e54f7e96c465145d987cfee8 | refs/heads/master | 2021-06-26T16:03:25.762017 | 2017-09-12T17:06:42 | 2017-09-12T17:06:42 | 102,981,857 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 973 | java | package data.paloalto.categories;
import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class UniqueCategoriesMapper extends Mapper<LongWritable, Text, Text, NullWritable> {
static String record = "";
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
Text business_category = new Text();
record = record.concat(value.toString());
String[] fields = record.split("::");
if (fields.length == 3) {
if ((fields[1].contains("Palo Alto"))) {
String[] category_line = fields[2].toString().split("(List\\()|(\\))|(,)");
for (String category : category_line) {
business_category.set(category.trim());
NullWritable nullObject = NullWritable.get();
context.write(business_category, nullObject);
}
}
record = "";
}
}
}
| [
"shrutiharihar624@gmail.com"
] | shrutiharihar624@gmail.com |
b684acfdbb27a4aff7cd94581507a6c1da8fce55 | bf9a7847239ac858aaabef43bbc99195646c4096 | /app/src/main/java/com/example/lzp/ganhuo/fragment/BaseFragment.java | da3bd8d4abf87bff4afd71289b5aa94dc0fc127c | [] | no_license | initLiu/GanHuo | 7f5b278a04e5fa32f4cdb60ca3454f627b6af036 | 3fcc7304dccbc3c3d1599259159ae3ea2c765ebc | refs/heads/master | 2021-01-18T11:26:44.750897 | 2017-05-11T17:34:04 | 2017-05-11T17:34:04 | 84,325,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.example.lzp.ganhuo.fragment;
import android.support.v4.app.Fragment;
/**
* Created by lzp on 2017/3/9.
*/
public class BaseFragment extends Fragment {
public static final String TAG = BaseFragment.class.getSimpleName();
public int getTitle() {
return 0;
}
public void add() {
}
public void decrease() {
}
}
| [
"xianyue_pan@163.com"
] | xianyue_pan@163.com |
44ef731e99df1bdad63c25e291dd356320243624 | 254f8d1e5b589919def5385007a713df06b9ef5a | /src/main/java/com/pingchuan/api/dto/calc/Forecast.java | a3f29c6797e874a1bca353c7739ea418a77b05e0 | [] | no_license | xiaowuler/nanjing-grid-api | 68fcce33e8aec1de222c3b5514c96eab696e4af7 | fc42e8cfb9b16d64dd49677379cbcd60884974e2 | refs/heads/master | 2022-07-19T17:36:40.374954 | 2019-11-27T14:57:34 | 2019-11-27T14:57:34 | 221,595,158 | 0 | 0 | null | 2022-06-21T02:13:55 | 2019-11-14T02:34:27 | Java | UTF-8 | Java | false | false | 1,121 | java | package com.pingchuan.api.dto.calc;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Field;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
public class Forecast {
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@Field("forecast_time")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Date forecastTime;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@Field("start_forecast_time")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Date startForecastTime;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@Field("end_forecast_time")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Date endForecastTime;
@Field("time_effect")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer timeEffect;
@JsonInclude(JsonInclude.Include.NON_NULL)
private List<Location> locations;
}
| [
"xiaowuler@163.com"
] | xiaowuler@163.com |
42e4269dd387f47c0a8b52ae2dbd824f6a13d056 | 48d4ca5f9263ca29669f4f79016962f56d44c390 | /src/MapConcept/TreeMapConcept.java | fb3b24ad60de9f505e48979aad1de4d4b4ec7067 | [] | no_license | vaibhav870/CollectionJAVA | 0628431fc2ce17974306fabb523bd16136947e7a | dfc2b936ad2dd9a478aa264f74296739d163adfd | refs/heads/master | 2023-02-06T06:25:06.774899 | 2020-12-21T17:31:54 | 2020-12-21T17:31:54 | 323,033,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | package MapConcept;
import java.util.Set;
import java.util.TreeMap;
public class TreeMapConcept {
public static void main(String[] args) {
TreeMap<Integer,String> map= new TreeMap<>();
map.put(50000, "VM");
map.put(40000, "BA");
map.put(600000, "XYZ");
map.forEach((k,v)->System.out.println("key"+k+"Value "+v));
System.out.println(map.lastKey());
System.out.println(map.firstKey());
Set<Integer> less5=map.headMap(50000).keySet();
System.out.println(less5);
Set<Integer> greater5=map.tailMap(50000).keySet();
System.out.println(greater5);
}
}
| [
"vaibhav.muddebihalkar@gmail.com"
] | vaibhav.muddebihalkar@gmail.com |
4650115bceb9a4f2b88ead2b23a77808ae5ea9e3 | 6a2dc98a0f77963f273b4b0b540f67d6e30780e7 | /src/main/java/com/gabriel/web/rest/DTO/StateDTO.java | 6d924b314ca161122de7071985f1166ba3ca20b0 | [] | no_license | flying3615/cv | abf76e91938c815e9ffdda1c82814d61ebc5944e | 14bb8f207523a1e6ad96eecd230cebf13202c2c4 | refs/heads/master | 2021-01-13T10:46:03.038819 | 2017-03-20T12:31:29 | 2017-03-20T12:31:29 | 72,390,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.gabriel.web.rest.DTO;
import java.util.List;
import java.util.Map;
/**
* Created by liuyufei on 12/11/16.
*/
public class StateDTO {
private String word;
public StateDTO(String word, List<Long> jobID, Long value, Map<String, String> statsticMap) {
this.word = word;
this.value = value;
this.statsticMap = statsticMap;
}
private Long value;
private Map<String, String> statsticMap;
public String getWord() {
return word;
}
public Long getValue() {
return value;
}
public Map<String, String> getStatsticMap() {
return statsticMap;
}
}
| [
"gabriel.liu@centling.com"
] | gabriel.liu@centling.com |
ee340c0040fb87eb34c46b9f26a3c51ebd021b3b | b5141ab963431f5581ce53b96fe9fd07172a47b6 | /dd_trec/src/main/java/db/DBWriter.java | 0e4859f5631924add8b4b51c1a1d3ec6faa294c0 | [] | no_license | TrecDD2016/trec_dd | 38b387fe7a3ea597edc13e66194cae8ab2dc9563 | 777083bf80ba42e03d4254010e2987f2f9a8f158 | refs/heads/master | 2020-04-06T06:58:04.846230 | 2017-05-12T02:52:18 | 2017-05-12T02:52:18 | 62,687,702 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 14,207 | java | package db;
import util.Constants;
import util.Segmenter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class DBWriter {
private static int INSERT_PER_BATCH = 10000;
private static HashMap<String, Integer> cMap = new HashMap<String, Integer>(); //语料库中词和次数
private static HashMap<String, Integer> numDocsContainsTerm = new HashMap<String, Integer>(); //全部文档中包含某一词的文档个数
private static int cLength = 0;
private static int docsCount = 0; //全部文档总数
private static HashMap<String, Integer> docLengthMap = new HashMap<String, Integer>();
private static DBReader3 dbService = new DBReader3();
private static long BATCH_SIZE = 10000;
private static boolean updatePstds = false;
private static boolean updateTds= false;
private static boolean updateTd = false;
public static void initializeDatabase(boolean ifUpdatePustdAndPstd,boolean ifUpdateTd, boolean ifUpdateTds) {
updatePstds = ifUpdatePustdAndPstd;
updateTds = ifUpdateTds;
updateTd = ifUpdateTd;
if (updatePstds) {
DBUtility.executeTruncate();
}
if (updateTds){
DBUtility.executeTruncate2();
}
mysqlScanCorpus();
System.out.println("Corpus Initialized!");
mysqlScanDocs();
System.out.println("Docs Initialized!");
if (updateTds) {
HashMap<String, Double> idfMap = new HashMap<String, Double>();
for (Entry<String, Integer> e : numDocsContainsTerm.entrySet()) {
double idf = Math.log(((double)docsCount) / e.getValue()); //TODO 这个log以多少为底?
idfMap.put(e.getKey(), idf);
}
System.out.println(numDocsContainsTerm.size());
writeIdf(idfMap);
System.out.println("Idfs Initialized!");
HashMap<String, Double> tcMap = new HashMap<String, Double>();
for (Entry<String, Integer> e : cMap.entrySet()) {
double tc = Math.log(((double) e.getValue()) / cLength); //TODO 这个log以多少为底?
tcMap.put(e.getKey(), tc);
}
writeTC(tcMap);
System.out.println("tc Initialized!");
}
if (updateTd){
writeDocLength(docLengthMap);
System.out.println("docLength Initialized!");
}
}
private static void writeDocLength(HashMap<String, Integer> m) {
StringBuffer sb = new StringBuffer();
int numInBatch = 1; //当前行是在本批中的第几个
for (Entry<String, Integer> e : m.entrySet()) {
String word = e.getKey().replaceAll("'", "''");
if (numInBatch == 1) {
sb.append("insert into dlength(doc, length) values('");
sb.append(word).append("',").append(e.getValue()).append(")");
numInBatch++;
}else if (numInBatch > INSERT_PER_BATCH) {
DBUtility.executeInsert(sb.toString());
sb.setLength(0);
numInBatch = 1;
}else {
sb.append(",('").append(word).append("',").append(e.getValue()).append(")");
numInBatch++;
}
}
if (sb.length() != 0) {
DBUtility.executeInsert(sb.toString());
}
}
public static void backup() {
DBUtility.executeConsoleCommand("mysqldump -uroot -p123456 mdp pustd > pustd_bak.sql");
DBUtility.executeConsoleCommand("mysqldump -uroot -p123456 mdp pstd > pstd_bak.sql");
}
public static void restore() {
DBUtility.executeConsoleCommand("mysql -uroot -p123456 mdp < pustd_bak.sql");
DBUtility.executeConsoleCommand("mysql -uroot -p123456 mdp < pstd_bak.sql");
}
public static void mysqlScanCorpus() {
int i = 0;
Map<String, String> docMap;
while (true) {
docMap = dbService.getDocs((i++)*BATCH_SIZE, BATCH_SIZE);
for (Entry<String, String> entry : docMap.entrySet()) {
String content = entry.getValue();
updateCMap(content);
}
if (docMap.entrySet().size() == 0) break;
}
}
private static void updateCMap(String content) {
ArrayList<String> ss = Segmenter.segment(content);
for (String word : ss) {
// 把所有的non-printable字符删除了,否则数据库会把包含非可见字符的键当成相同主键而拒绝写入
// therefore, 需要检查删除后的字符串是否为空
word = word.replaceAll("\\p{C}", "");
if (word.length() > 0) {
if (cMap.containsKey(word)) {
cMap.put(word, cMap.get(word) + 1);
} else {
cMap.put(word, 1);
}
++cLength;
}
}
}
private static int updateWordCountMap(HashMap<String, Integer> map, String content) {
int wordNum = 0;
ArrayList<String> ss = Segmenter.segment(content);
for (String word : ss) {
// 把所有的non-printable字符删除了,否则数据库会把包含非可见字符的键当成相同主键而拒绝写入
// therefore, 需要检查删除后的字符串是否为空
word = word.replaceAll("\\p{C}", "");
if (word.length() > 0) {
if (map.containsKey(word)) {
map.put(word, map.get(word) + 1);
} else {
map.put(word, 1);
}
++wordNum;
}
}
return wordNum;
}
public static void mysqlScanDocs() {
int i = 0;
Map<String, String> docMap;
HashMap<String, Integer> wordCountMap = new HashMap<String, Integer>();
int docLength = 0;
while (true) {
docMap = dbService.getDocs((i++) * BATCH_SIZE, BATCH_SIZE);
for (Entry<String, String> entry : docMap.entrySet()) {
// reset map and length
wordCountMap.clear();
docLength = 0;
String docName = entry.getKey();
String content = entry.getValue();
docLength += updateWordCountMap(wordCountMap, content);
if (updatePstds) {
updatePstdAndPustd(wordCountMap, docLength, docName);
}
if (updateTd) {
writeTD(docName, wordCountMap);
}
docLengthMap.put(docName, docLength);
docsCount++;
}
if (docMap.entrySet().size() == 0) break;
}
}
private static void writeTC(HashMap<String, Double> m) {
StringBuffer sb = new StringBuffer();
int numInBatch = 1; //当前行是在本批中的第几个
for (Entry<String, Double> e : m.entrySet()) {
String word = e.getKey().replaceAll("'", "''");
if (numInBatch == 1) {
sb.append("insert into tc(term, tc) values('");
sb.append(word).append("',").append(e.getValue()).append(")");
numInBatch++;
}else if (numInBatch > INSERT_PER_BATCH) {
DBUtility.executeInsert(sb.toString());
sb.setLength(0);
numInBatch = 1;
}else {
sb.append(",('").append(word).append("',").append(e.getValue()).append(")");
numInBatch++;
}
}
if (sb.length() != 0) {
DBUtility.executeInsert(sb.toString());
}
}
private static void writeIdf(HashMap<String, Double> m) {
StringBuffer sb = new StringBuffer();
int numInBatch = 1; //当前行是在本批中的第几个
for (Entry<String, Double> e : m.entrySet()) {
String word = e.getKey().replaceAll("'", "''");
if (numInBatch == 1) {
sb.append("insert into idf(term, idf) values('");
sb.append(word).append("',").append(e.getValue()).append(")");
numInBatch++;
}else if (numInBatch > INSERT_PER_BATCH) {
DBUtility.executeInsert(sb.toString());
sb.setLength(0);
numInBatch = 1;
}else {
sb.append(",('").append(word).append("',").append(e.getValue()).append(")");
numInBatch++;
}
}
if (sb.length() != 0) {
DBUtility.executeInsert(sb.toString());
}
}
private static void writeTD(String doc, HashMap<String, Integer> m) {
StringBuffer sb = new StringBuffer();
int numInBatch = 1; //当前行是在本批中的第几个
for (Entry<String, Integer> e : m.entrySet()) {
String word = e.getKey().replaceAll("'", "''");
if (numInBatch == 1) {
sb.append("insert into td(term, doc, td) values('");
sb.append(word).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
}else if (numInBatch > INSERT_PER_BATCH) {
DBUtility.executeInsert(sb.toString());
sb.setLength(0);
numInBatch = 1;
}else {
sb.append(",('").append(word).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
}
}
if (sb.length() != 0) {
DBUtility.executeInsert(sb.toString());
}
}
private static void updatePstdAndPustd(HashMap<String, Integer> map, long docLength, String docName) {
for (Entry<String, Integer> e : map.entrySet()) {
String s = e.getKey();
if (numDocsContainsTerm.containsKey(s)) {
numDocsContainsTerm.put(s, numDocsContainsTerm.get(s) + 1);
} else {
numDocsContainsTerm.put(s, 1);
}
}
HashMap<String, Double> pstdMap = new HashMap<String, Double>();
for (Entry<String, Integer> e : map.entrySet()) {
String s = e.getKey();
double pstd = (map.get(s) + Constants.u * cMap.get(s) / (double) cLength) / (Constants.u + docLength);
pstdMap.put(s, pstd);
}
writePstd(docName, pstdMap);
HashMap<String, Double> pustdMap = new HashMap<String, Double>();
for (Entry<String, Integer> e : map.entrySet()) {
String s = e.getKey();
double pustd = map.get(s) / (double) docLength;
pustdMap.put(s, pustd);
}
writePustd(docName, pustdMap);
}
private static void writePstd(String doc, HashMap<String, Double> m) {
StringBuffer sb = new StringBuffer();
int numInBatch = 1; //当前行是在本批中的第几个
for (Entry<String, Double> e : m.entrySet()) {
String word = e.getKey().replaceAll("'", "''");
if (numInBatch == 1) {
sb.append("insert into pstd(term, doc, pstd) values('");
sb.append(word).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
} else if (numInBatch > INSERT_PER_BATCH) {
DBUtility.executeInsert(sb.toString());
sb.setLength(0);
numInBatch = 1;
} else {
sb.append(",('").append(word).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
}
}
if (sb.length() != 0) {
DBUtility.executeInsert(sb.toString());
}
}
public static void updatePustdByTerm(String t, HashMap<String, Double> m) {
StringBuffer sb = new StringBuffer();
int numInBatch = 1; //当前行是在本批中的第几个
for (Entry<String, Double> e : m.entrySet()) {
String doc = e.getKey().replaceAll("'", "''");
if (numInBatch == 1) {
sb.append("insert into pustd_updated(term, doc, pustd) values('");
sb.append(t).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
} else if (numInBatch > INSERT_PER_BATCH) {
DBUtility.executeInsert(sb.toString());
sb.setLength(0);
numInBatch = 1;
} else {
sb.append(",('").append(t).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
}
}
sb.append(" ON DUPLICATE KEY UPDATE pustd=VALUES(pustd)");
if (sb.length() != 0) {
DBUtility.executeInsert(sb.toString());
}
}
public static void writePustd(String doc, HashMap<String, Double> m) {
StringBuffer sb = new StringBuffer();
int numInBatch = 1; //当前行是在本批中的第几个
for (Entry<String, Double> e : m.entrySet()) {
String word = e.getKey().replaceAll("'", "''");
if (numInBatch == 1) {
sb.append("insert into pustd(term, doc, pustd) values('");
sb.append(word).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
} else if (numInBatch > INSERT_PER_BATCH) {
DBUtility.executeInsert(sb.toString());
sb.setLength(0);
numInBatch = 1;
} else {
sb.append(",('").append(word).append("','").append(doc).append("',").append(e.getValue()).append(")");
numInBatch++;
}
}
if (sb.length() != 0) {
DBUtility.executeInsert(sb.toString());
}
}
public static void main(String[] args) {
DBWriter.initializeDatabase(false,true,false);
}
}
| [
"wjw14@sotfware.nju.edu.cn"
] | wjw14@sotfware.nju.edu.cn |
3b658acae3c5bd9b5530894ce2a8dd87dbb1a6ab | 5f63a60fd029b8a74d2b1b4bf6992f5e4c7b429b | /com/planet_ink/coffee_mud/Items/Armor/ScaleMail.java | 8bb73ee6c8f59bb83b41bec264d5a0db0bca3d05 | [
"Apache-2.0"
] | permissive | bozimmerman/CoffeeMud | 5da8b5b98c25b70554ec9a2a8c0ef97f177dc041 | 647864922e07572b1f6c863de8f936982f553288 | refs/heads/master | 2023-09-04T09:17:12.656291 | 2023-09-02T00:30:19 | 2023-09-02T00:30:19 | 5,267,832 | 179 | 122 | Apache-2.0 | 2023-04-30T11:09:14 | 2012-08-02T03:22:12 | Java | UTF-8 | Java | false | false | 2,170 | java | package com.planet_ink.coffee_mud.Items.Armor;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
/*
Copyright 2001-2023 Bo Zimmerman
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.
*/
public class ScaleMail extends StdArmor
{
@Override
public String ID()
{
return "ScaleMail";
}
public ScaleMail()
{
super();
setName("a suit of Scalemail");
setDisplayText("a suit of armor made of overlapping leather scales.");
setDescription("This suit of armor is made of overlapping leather scales and will provide protection for the torso, arms, and legs.");
properWornBitmap=Wearable.WORN_TORSO | Wearable.WORN_ARMS | Wearable.WORN_LEGS;
wornLogicalAnd=true;
basePhyStats().setArmor(29);
basePhyStats().setWeight(60);
basePhyStats().setAbility(0);
baseGoldValue=240;
recoverPhyStats();
material=RawMaterial.RESOURCE_STEEL;
}
}
| [
"bo@zimmers.net"
] | bo@zimmers.net |
0c4e913fa818ed2c9cade8e0c29e149e8424131a | 8d3718d5b18b63fd6ddcf0b0b338ef8e5030b9a6 | /app/src/main/java/com/codepath/gridimagesearch/helpers/ImageResultParcelable.java | 5c3363afa0e9e14b75e16014fcecc73d70907475 | [] | no_license | vlaljani/GridImageSearch | fd0ad34e933ef57cc72d751d7e97948280249fa2 | 9a92f6dbb256de464e89a81bbe29852b7d23cebf | refs/heads/master | 2016-09-05T14:30:38.907000 | 2015-02-16T05:01:45 | 2015-02-16T05:01:45 | 30,744,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,812 | java | package com.codepath.gridimagesearch.helpers;
import android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by vibhalaljani on 2/14/15.
*
* Parcelable for ImageResult so they can be passed around in intents and bundles
*/
public class ImageResultParcelable implements Parcelable {
private String url;
private String tbUrl;
private int width;
private int height;
private String title;
private int tbHeight;
private int tbWidth;
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public String getTbUrl() {
return tbUrl;
}
public void setTbUrl(String tbUrl) {
this.tbUrl = tbUrl;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getTbWidth() {
return tbWidth;
}
public void setTbWidth(int tbWidth) {
this.tbWidth = tbWidth;
}
public int getTbHeight() {
return tbHeight;
}
public void setTbHeight(int tbHeight) {
this.tbHeight = tbHeight;
}
public ImageResultParcelable(JSONObject jsonObject) {
try {
this.setHeight(jsonObject.getInt("height"));
this.setWidth(jsonObject.getInt("width"));
this.setTbHeight(jsonObject.getInt("tbWidth"));
this.setTbWidth(jsonObject.getInt("tbHeight"));
this.setTbUrl(jsonObject.getString("tbUrl"));
this.setTitle(jsonObject.getString("title"));
this.setUrl(jsonObject.getString("url"));
} catch (JSONException e) {
e.printStackTrace();
}
}
private ImageResultParcelable (Parcel in) {
this.url = in.readString();
this.tbUrl = in.readString();
this.width = in.readInt();
this.height = in.readInt();
this.title = in.readString();
this.tbHeight = in.readInt();
this.tbWidth = in.readInt();
}
// called upon ImageResult.fromJSONArray(...)
public static ArrayList<ImageResultParcelable> fromJSONArray(JSONArray jsonArray) {
ArrayList<ImageResultParcelable> imageResults = new ArrayList<>();
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject imageJSON = null;
try {
imageJSON = (JSONObject) jsonArray.get(i);
}
catch (JSONException e) {
e.printStackTrace();
}
ImageResultParcelable image = new ImageResultParcelable(imageJSON);
imageResults.add(image);
}
return imageResults;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(url);
dest.writeString(tbUrl);
dest.writeInt(width);
dest.writeInt(height);
dest.writeString(title);
dest.writeInt(tbHeight);
dest.writeInt(tbWidth);
}
public int describeContents() {
return 0;
}
public static final Parcelable.Creator<ImageResultParcelable> CREATOR
= new Parcelable.Creator<ImageResultParcelable>() {
public ImageResultParcelable createFromParcel(Parcel in) {
return new ImageResultParcelable(in);
}
public ImageResultParcelable[] newArray(int size) {
return new ImageResultParcelable[size];
}
};
}
| [
"vibhalaljani@gmail.com"
] | vibhalaljani@gmail.com |
35f50156aeea797b1f8ecc413be204fca1c09a8a | 5e714a2f42befccb6f7ab2690472806fcf673479 | /AndBackendTest/src/net/bible/service/format/OSISInputStreamTest.java | f3c2db9cf1d55fdb1bd1bb38477341e43435c679 | [] | no_license | tuomas2/and-bible | 8b92824ff094d2b234e6da51a2ed62f876c0da26 | 61aaa124d2b58d86d02ba3208598a225ff258560 | refs/heads/master | 2020-05-28T01:01:35.724708 | 2015-04-11T07:59:52 | 2015-04-11T07:59:52 | 37,821,990 | 2 | 0 | null | 2018-09-03T07:13:59 | 2015-06-21T19:09:47 | Java | UTF-8 | Java | false | false | 17,668 | java | /**
*
*/
package net.bible.service.format;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import junit.framework.TestCase;
import net.bible.service.common.ParseException;
import net.bible.service.format.osistohtml.OsisToHtmlParameters;
import net.bible.service.format.osistohtml.OsisToHtmlSaxHandler;
import org.crosswire.common.xml.SAXEventProvider;
import org.crosswire.jsword.book.Book;
import org.crosswire.jsword.book.BookCategory;
import org.crosswire.jsword.book.BookData;
import org.crosswire.jsword.book.BookFilters;
import org.crosswire.jsword.book.Books;
import org.crosswire.jsword.book.Defaults;
import org.crosswire.jsword.book.FeatureType;
import org.crosswire.jsword.book.sword.SwordBookDriver;
import org.crosswire.jsword.index.IndexStatus;
import org.crosswire.jsword.passage.Key;
import org.crosswire.jsword.passage.PassageKeyFactory;
import org.crosswire.jsword.versification.system.Versifications;
import org.xml.sax.ContentHandler;
/**
* @author denha1m
*
*/
public class OSISInputStreamTest extends TestCase {
private Book[] books;
private Book netBook;
private Book webBook;
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
SwordBookDriver swordBookDriver = new SwordBookDriver();
books = swordBookDriver.getBooks();
for (Book book : books) {
if (book.getInitials().startsWith("NET")) {
this.netBook = book;
}
if (book.getInitials().startsWith("WEB")) {
this.webBook = book;
}
// System.out.println(book.getOsisID());
}
}
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
}
/**
* Test method for {@link net.bible.service.format.scripture.service.sword.OSISInputStream#read()}.
* <!DOCTYPE div [<!ENTITY nbsp " "><!ENTITY copy "©">]><div><verse osisID='Gen.1.1'/><w lemma="strong:H07225">In the begin
ning</w> <w lemma="strong:H0430">God</w> <w lemma="strong:H0853 strong:H01254" morph="strongMorph:TH8804">created</w> <w lemma="st
rong:H08064">the heaven</w> <w lemma="strong:H0853">and</w> <w lemma="strong:H0776">the earth</w>.
</div>
*/
public void testReadKJV() throws Exception {
Book kjv = getBook("KJV");
// OSISInputStream osisInputStream = new OSISInputStream(kjv, kjv.getKey("Is 40:11"));
// OSISInputStream osisInputStream = new OSISInputStream(kjv, kjv.getKey("Mt 4:14"));
OSISInputStream osisInputStream = new OSISInputStream(kjv, kjv.getKey("Ps 67:1"));
String chapter = convertStreamToString(osisInputStream);
// int numOpeningDivs = count(chapter, "<div>");
// int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
}
public void testReadNETText() throws Exception {
Book book = getBook("NETtext");
// OSISInputStream osisInputStream = new OSISInputStream(kjv, kjv.getKey("Is 40:11"));
// OSISInputStream osisInputStream = new OSISInputStream(kjv, kjv.getKey("Mt 4:14"));
System.out.println(netBook.getInitials());
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("Gal 6:17"));
String chapter = convertStreamToString(osisInputStream);
System.out.println(chapter);
osisInputStream = new OSISInputStream(book, book.getKey("Gal 6:18"));
chapter = convertStreamToString(osisInputStream);
System.out.println(chapter);
}
public void testReadTitle() throws Exception {
Book book = getBook("WEB");
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("Hosea 1:2"));
String verse = convertStreamToString(osisInputStream);
System.out.println(verse);
osisInputStream = new OSISInputStream(book, book.getKey("Psalm 36:1"));
verse = convertStreamToString(osisInputStream);
System.out.println(verse);
}
public void testReadABPGRKJn1() throws Exception {
Book kjv = getBook("ABP");
OSISInputStream osisInputStream = new OSISInputStream(kjv, kjv.getKey("Jn 1:1"));
String chapter = convertStreamToString(osisInputStream);
// int numOpeningDivs = count(chapter, "<div>");
// int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
}
/**
* Test method for {@link net.bible.service.format.scripture.service.sword.OSISInputStream#read()}.
*/
public void testReadNetBible() throws Exception {
OSISInputStream osisInputStream = new OSISInputStream(netBook, netBook.getKey("Gen 4"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
}
public void testReadLastChapter() throws Exception {
for (Book book: books) {
if (book.getBookCategory().equals(BookCategory.BIBLE)) {
System.out.println("Book:"+book.getInitials());
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("3 John"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
// System.out.println(chapter);
assertEquals("wrong number of divs in "+book, numOpeningDivs, numClosingDivs);
}
}
}
public void testReadWordsOfChrist() throws Exception {
Book esv = getBook("ESV");
OSISInputStream osisInputStream = new OSISInputStream(esv, esv.getKey("Luke 14:3"));
String chapter = convertStreamToString(osisInputStream);
// int numOpeningDivs = count(chapter, "<div>");
// int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
// assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
}
public void testReadMergedVerse() throws Exception {
Book esv = getBook("TurNTB");
OSISInputStream osisInputStream = new OSISInputStream(esv, esv.getKey("Eph 2:4,5"));
String chapter = convertStreamToString(osisInputStream);
System.out.println(chapter);
}
/**
* Test method for {@link net.bible.service.format.scripture.service.sword.OSISInputStream#read()}.
*/
public void testReadSingleChapterBook() throws Exception {
OSISInputStream osisInputStream = new OSISInputStream(netBook, netBook.getKey("3 John"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
}
/**
* Test method for {@link net.bible.service.format.scripture.service.sword.OSISInputStream#read()}.
*/
public void testReadVeryLongBook() throws Exception {
Book esv = getBook("ESV");
OSISInputStream osisInputStream = new OSISInputStream(esv, esv.getKey("Ps 119"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
}
public void testTrickyWebChapters() throws Exception {
{
OSISInputStream osisInputStream = new OSISInputStream(webBook, PassageKeyFactory.instance().getKey(Versifications.instance().getVersification("KJV"), "Ps 1"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningLs = count(chapter, "<l>") + count(chapter, "<l ");
int numClosingLs = count(chapter, "</l>");
System.out.println(chapter);
assertEquals("wrong number of Ls", numOpeningLs, numClosingLs);
}
{
OSISInputStream osisInputStream = new OSISInputStream(webBook, PassageKeyFactory.instance().getKey(Versifications.instance().getVersification("KJV"), "Gen 49"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningLs = count(chapter, "<l>") + count(chapter, "<l ");
int numClosingLs = count(chapter, "</l>");
System.out.println(chapter);
assertEquals("wrong number of Ls", numOpeningLs, numClosingLs);
}
}
public void testReadDarbyBible() throws Exception {
Book book = getBook("Darby");
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("Gen 1"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
}
public void testReadRST() throws Exception {
Book rst = getBook("RST");
BookData data = new BookData(rst, rst.getKey("Col 1"));
SAXEventProvider osissep = data.getSAXEventProvider();
// canonical
try {
if (osissep != null) {
// OsisToHtmlSaxHandler osisToHtml = new OsisToHtmlSaxHandler();
ContentHandler osisToHtml = new OsisToCanonicalTextSaxHandler();
osissep.provideSAXEvents(osisToHtml);
String chapter = osisToHtml.toString();
System.out.println(chapter);
}
} catch (Exception e) {
fail("Parsing error");
throw new ParseException("Parsing error", e);
}
//html
try {
if (osissep != null) {
ContentHandler osisHandler = new OsisToHtmlSaxHandler(new OsisToHtmlParameters());
osissep.provideSAXEvents(osisHandler);
String chapter = osisHandler.toString();
System.out.println(chapter);
}
} catch (Exception e) {
fail("Parsing error");
throw new ParseException("Parsing error", e);
}
//
// OSISInputStream osisInputStream = new OSISInputStream(rst, rst.getKey("Col 1:1"));
// String chapter = convertStreamToString(osisInputStream);
// int numOpeningDivs = count(chapter, "<div>");
// int numClosingDivs = count(chapter, "</div>");
// System.out.println(chapter);
}
public void testReadESVAndBibeMethod() throws Exception {
Book book = getBook("ESV");
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("Phil 1:3"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println("START"+chapter+"END");
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
}
public void testReadESVPs117() throws Exception {
Book book = getBook("ESV");
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("Psalms 117"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println("START"+chapter+"END");
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
}
public void testReadESVJSwordMethod() throws Exception {
Book esv = getBook("ESV");
BookData data = new BookData(esv, esv.getKey("Phil 1:3"));
SAXEventProvider osissep = data.getSAXEventProvider();
// canonical
try {
if (osissep != null) {
// OsisToHtmlSaxHandler osisToHtml = new OsisToHtmlSaxHandler();
ContentHandler osisToHtml = new OsisToCanonicalTextSaxHandler();
osissep.provideSAXEvents(osisToHtml);
String chapter = osisToHtml.toString();
System.out.println("START"+chapter+"END");
}
} catch (Exception e) {
fail("Parsing error");
throw new ParseException("Parsing error", e);
}
//html
try {
if (osissep != null) {
ContentHandler osisHandler = new OsisToHtmlSaxHandler(new OsisToHtmlParameters());
osissep.provideSAXEvents(osisHandler);
String chapter = osisHandler.toString();
System.out.println(chapter);
}
} catch (Exception e) {
fail("Parsing error");
throw new ParseException("Parsing error", e);
}
//
// OSISInputStream osisInputStream = new OSISInputStream(rst, rst.getKey("Col 1:1"));
// String chapter = convertStreamToString(osisInputStream);
// int numOpeningDivs = count(chapter, "<div>");
// int numClosingDivs = count(chapter, "</div>");
// System.out.println(chapter);
}
public void testReadCommentaries() throws Exception {
for (Book book: books) {
System.out.println("?Book:"+book);
if (book.getBookCategory().equals(BookCategory.COMMENTARY) && !book.getInitials().equals("Personal")) {
// if (book.getInitials().equals("JFB")) {
System.out.println("Book:"+book.getInitials());
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("1 Cor 1:1"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
assertEquals("wrong number of divs in "+book, numOpeningDivs, numClosingDivs);
}
}
}
public void testRead1Peter1v10() throws Exception {
Book book = getBook("WEB");
OSISInputStream osisInputStream = new OSISInputStream(book, book.getKey("1 Peter 1"));
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
System.out.println(chapter);
}
public void testReadStrongs() throws Exception {
Book book = Defaults.getHebrewDefinitions();
assertEquals(book.getInitials(), "StrongsHebrew");
Key key = book.getKey("00430");
OSISInputStream osisInputStream = new OSISInputStream(book, key);
String chapter = convertStreamToString(osisInputStream);
int numOpeningDivs = count(chapter, "<div>");
int numClosingDivs = count(chapter, "</div>");
System.out.println(chapter);
assertEquals("wrong number of divs", numOpeningDivs, numClosingDivs);
System.out.println(chapter);
}
public void testFindAllStrongsRef() throws Exception {
List<Book> bibles = Books.installed().getBooks(BookFilters.getBibles());
for (Book book : bibles) {
try {
if (book.hasFeature(FeatureType.STRONGS_NUMBERS)) {
if (!book.getIndexStatus().equals(IndexStatus.DONE)) {
System.out.println("Unindexed:"+book);
} else {
Key resultsH = book.find("+[Gen 1:1] strong:h7225"); //beginning
Key resultsG = book.find("+[John 1:1] strong:g746"); //beginning
Key resultsGOT = book.find("+[Gen 1:1] strong:g746"); //beginning
if (resultsH.getCardinality()==0 && resultsG.getCardinality()==0 && resultsGOT.getCardinality()==0) {
System.out.println("No refs returned in"+book.getInitials());
} else {
System.out.println("Ok:"+book.getInitials()+" "+resultsH.getCardinality()+"/"+resultsG.getCardinality()+ "/" + resultsGOT.getCardinality());
}
// assertTrue("No refs returned in"+book.getInitials(), resultsH.getCardinality()>0 || resultsG.getCardinality()>0);
}
}
} catch (Exception e) {
System.out.println("Error:"+book.getInitials()+":"+e.getMessage());
}
}
}
private Book getKJV() {
return getBook("KJV");
}
private Book getBook(String initials) {
for (Book book : books) {
if (book.getInitials().equals(initials)) {
System.out.println("Found:"+book.getName());
return book;
}
}
return null;
}
// /**
// * Test method for {@link org.crosswire.jsword.book.sword.OSISInputStream#OSISInputStream(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)}.
// */
// public void testOSISInputStream() {
// fail("Not yet implemented");
// }
//
// /**
// * Test method for {@link java.io.InputStream#available()}.
// */
// public void testAvailable() {
// fail("Not yet implemented");
// }
//
// /**
// * Test method for {@link java.io.InputStream#read(byte[])}.
// */
// public void testReadByteArray() {
// fail("Not yet implemented");
// }
//
// /**
// * Test method for {@link java.io.InputStream#read(byte[], int, int)}.
// */
// public void testReadByteArrayIntInt() {
// fail("Not yet implemented");
// }
public String convertStreamToString(InputStream is) throws IOException {
/*
* To convert the InputStream to String we use the BufferedReader.readLine()
* method. We iterate until the BufferedReader return null which means
* there's no more data to read. Each line will appended to a StringBuilder
* and returned as String.
*/
if (is != null) {
StringBuilder sb = new StringBuilder();
String line;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
} finally {
is.close();
}
return sb.toString();
} else {
return "";
}
}
private int count(String base, String searchFor) {
int len = searchFor.length();
int result = 0;
if (len > 0) { // search only if there is something
int start = base.indexOf(searchFor);
while (start != -1) {
result++;
start = base.indexOf(searchFor, start+len);
}
}
return result;
}
}
| [
"mjdenham@gmail.com"
] | mjdenham@gmail.com |
138750fb03ba2492b16ef7d44e30ca2e729253e6 | 594724ec5035a341735ee84acfe78993b554024d | /voip/src/main/java/com/kinstalk/her/dialer/SpecialCharSequenceMgr.java | f9512181fe4743515b7a0f532d7d06aee739a164 | [] | no_license | lichao20000/V-O-W-I-F-I | 8cddb6a3cd6a917097b0a11839c7ba22cc40681f | e40d77f985638112d6e575c6d851ed3ee18c7089 | refs/heads/master | 2022-01-07T03:22:44.219181 | 2018-12-03T05:25:45 | 2018-12-03T05:25:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,034 | java | /*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.kinstalk.her.dialer;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DialogFragment;
import android.app.KeyguardManager;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Looper;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.Toast;
import com.kinstalk.her.common.common.io.MoreCloseables;
import com.kinstalk.her.contactscommon.common.compat.CompatUtils;
import com.kinstalk.her.contactscommon.common.compat.TelephonyManagerCompat;
import com.kinstalk.her.contactscommon.common.database.NoNullCursorAsyncQueryHandler;
import com.kinstalk.her.contactscommon.common.util.ContactDisplayUtils;
import com.kinstalk.her.contactscommon.common.widget.SelectPhoneAccountDialogFragment;
import com.kinstalk.her.contactscommon.common.widget.SelectPhoneAccountDialogFragment.SelectPhoneAccountListener;
import com.kinstalk.her.dialer.calllog.PhoneAccountUtils;
import com.kinstalk.her.dialer.util.TelecomUtil;
import com.kinstalk.her.vowifivoip.R;
import java.util.ArrayList;
import java.util.List;
/**
* Helper class to listen for some magic character sequences
* that are handled specially by the dialer.
*
* Note the Phone app also handles these sequences too (in a couple of
* relatively obscure places in the UI), so there's a separate version of
* this class under apps/Phone.
*
* TODO: there's lots of duplicated code between this class and the
* corresponding class under apps/Phone. Let's figure out a way to
* unify these two classes (in the framework? in a common shared library?)
*/
public class SpecialCharSequenceMgr {
private static final String TAG = "SpecialCharSequenceMgr";
private static final String TAG_SELECT_ACCT_FRAGMENT = "tag_select_acct_fragment";
private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
private static final String MMI_IMEI_DISPLAY = "*#06#";
private static final String MMI_REGULATORY_INFO_DISPLAY = "*#07#";
/**
* Remembers the previous {@link QueryHandler} and cancel the operation when needed, to
* prevent possible crash.
*
* QueryHandler may call {@link ProgressDialog#dismiss()} when the screen is already gone,
* which will cause the app crash. This variable enables the class to prevent the crash
* on {@link #cleanup()}.
*
* TODO: Remove this and replace it (and {@link #cleanup()}) with better implementation.
* One complication is that we have SpecialCharSequenceMgr in Phone package too, which has
* *slightly* different implementation. Note that Phone package doesn't have this problem,
* so the class on Phone side doesn't have this functionality.
* Fundamental fix would be to have one shared implementation and resolve this corner case more
* gracefully.
*/
private static QueryHandler sPreviousAdnQueryHandler;
public static class HandleAdnEntryAccountSelectedCallback extends SelectPhoneAccountListener{
final private Context mContext;
final private QueryHandler mQueryHandler;
final private SimContactQueryCookie mCookie;
public HandleAdnEntryAccountSelectedCallback(Context context,
QueryHandler queryHandler, SimContactQueryCookie cookie) {
mContext = context;
mQueryHandler = queryHandler;
mCookie = cookie;
}
@Override
public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle,
boolean setDefault) {
Uri uri = TelecomUtil.getAdnUriForPhoneAccount(mContext, selectedAccountHandle);
handleAdnQuery(mQueryHandler, mCookie, uri);
// TODO: Show error dialog if result isn't valid.
}
}
public static class HandleMmiAccountSelectedCallback extends SelectPhoneAccountListener{
final private Context mContext;
final private String mInput;
public HandleMmiAccountSelectedCallback(Context context, String input) {
mContext = context.getApplicationContext();
mInput = input;
}
@Override
public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle,
boolean setDefault) {
TelecomUtil.handleMmi(mContext, mInput, selectedAccountHandle);
}
}
/** This class is never instantiated. */
private SpecialCharSequenceMgr() {
}
@RequiresApi(api = Build.VERSION_CODES.M)
public static boolean handleChars(Context context, String input, EditText textField) {
//get rid of the separators so that the string gets parsed correctly
String dialString = PhoneNumberUtils.stripSeparators(input);
if (handleDeviceIdDisplay(context, dialString)
|| handleRegulatoryInfoDisplay(context, dialString)
|| handlePinEntry(context, dialString)
|| handleAdnEntry(context, dialString, textField)
|| handleSecretCode(context, dialString)) {
return true;
}
return false;
}
/**
* Cleanup everything around this class. Must be run inside the main thread.
*
* This should be called when the screen becomes background.
*/
public static void cleanup() {
if (Looper.myLooper() != Looper.getMainLooper()) {
Log.wtf(TAG, "cleanup() is called outside the main thread");
return;
}
if (sPreviousAdnQueryHandler != null) {
sPreviousAdnQueryHandler.cancel();
sPreviousAdnQueryHandler = null;
}
}
/**
* Handles secret codes to launch arbitrary activities in the form of *#*#<code>#*#*.
* If a secret code is encountered an Intent is started with the android_secret_code://<code>
* URI.
*
* @param context the context to use
* @param input the text to check for a secret code in
* @return true if a secret code was encountered
*/
static boolean handleSecretCode(Context context, String input) {
// Secret codes are in the form *#*#<code>#*#*
int len = input.length();
if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {
final Intent intent = new Intent(SECRET_CODE_ACTION,
Uri.parse("android_secret_code://" + input.substring(4, len - 4)));
context.sendBroadcast(intent);
return true;
}
return false;
}
/**
* Handle ADN requests by filling in the SIM contact number into the requested
* EditText.
*
* This code works alongside the Asynchronous query handler {@link QueryHandler}
* and query cancel handler implemented in {@link SimContactQueryCookie}.
*/
static boolean handleAdnEntry(Context context, String input, EditText textField) {
/* ADN entries are of the form "N(N)(N)#" */
TelephonyManager telephonyManager =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager == null
|| telephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) {
return false;
}
// if the phone is keyguard-restricted, then just ignore this
// input. We want to make sure that sim card contacts are NOT
// exposed unless the phone is unlocked, and this code can be
// accessed from the emergency dialer.
KeyguardManager keyguardManager =
(KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
if (keyguardManager.inKeyguardRestrictedInputMode()) {
return false;
}
int len = input.length();
if ((len > 1) && (len < 5) && (input.endsWith("#"))) {
try {
// get the ordinal number of the sim contact
final int index = Integer.parseInt(input.substring(0, len-1));
// The original code that navigated to a SIM Contacts list view did not
// highlight the requested contact correctly, a requirement for PTCRB
// certification. This behaviour is consistent with the UI paradigm
// for touch-enabled lists, so it does not make sense to try to work
// around it. Instead we fill in the the requested phone number into
// the dialer text field.
// create the async query handler
final QueryHandler handler = new QueryHandler(context.getContentResolver());
// create the cookie object
final SimContactQueryCookie sc = new SimContactQueryCookie(index - 1, handler,
ADN_QUERY_TOKEN);
// setup the cookie fields
sc.contactNum = index - 1;
sc.setTextField(textField);
// create the progress dialog
sc.progressDialog = new ProgressDialog(context);
sc.progressDialog.setTitle(R.string.simContacts_title);
sc.progressDialog.setMessage(context.getText(R.string.simContacts_emptyLoading));
sc.progressDialog.setIndeterminate(true);
sc.progressDialog.setCancelable(true);
sc.progressDialog.setOnCancelListener(sc);
sc.progressDialog.getWindow().addFlags(
WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
List<PhoneAccountHandle> subscriptionAccountHandles =
PhoneAccountUtils.getSubscriptionPhoneAccounts(context);
Context applicationContext = context.getApplicationContext();
boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(
TelecomUtil.getDefaultOutgoingPhoneAccount(applicationContext,
PhoneAccount.SCHEME_TEL));
if (subscriptionAccountHandles.size() <= 1 || hasUserSelectedDefault) {
Uri uri = TelecomUtil.getAdnUriForPhoneAccount(applicationContext, null);
handleAdnQuery(handler, sc, uri);
} else {
SelectPhoneAccountListener callback = new HandleAdnEntryAccountSelectedCallback(
applicationContext, handler, sc);
DialogFragment dialogFragment = SelectPhoneAccountDialogFragment.newInstance(
subscriptionAccountHandles, callback);
dialogFragment.show(((Activity) context).getFragmentManager(),
TAG_SELECT_ACCT_FRAGMENT);
}
return true;
} catch (NumberFormatException ex) {
// Ignore
}
}
return false;
}
private static void handleAdnQuery(QueryHandler handler, SimContactQueryCookie cookie,
Uri uri) {
if (handler == null || cookie == null || uri == null) {
Log.w(TAG, "queryAdn parameters incorrect");
return;
}
// display the progress dialog
cookie.progressDialog.show();
// run the query.
handler.startQuery(ADN_QUERY_TOKEN, cookie, uri, new String[]{ADN_PHONE_NUMBER_COLUMN_NAME},
null, null, null);
if (sPreviousAdnQueryHandler != null) {
// It is harmless to call cancel() even after the handler's gone.
sPreviousAdnQueryHandler.cancel();
}
sPreviousAdnQueryHandler = handler;
}
static boolean handlePinEntry(final Context context, final String input) {
if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) {
List<PhoneAccountHandle> subscriptionAccountHandles =
PhoneAccountUtils.getSubscriptionPhoneAccounts(context);
boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(
TelecomUtil.getDefaultOutgoingPhoneAccount(context, PhoneAccount.SCHEME_TEL));
if (subscriptionAccountHandles.size() <= 1 || hasUserSelectedDefault) {
// Don't bring up the dialog for single-SIM or if the default outgoing account is
// a subscription account.
return TelecomUtil.handleMmi(context, input, null);
} else {
SelectPhoneAccountListener listener =
new HandleMmiAccountSelectedCallback(context, input);
DialogFragment dialogFragment = SelectPhoneAccountDialogFragment.newInstance(
subscriptionAccountHandles, listener);
dialogFragment.show(((Activity) context).getFragmentManager(),
TAG_SELECT_ACCT_FRAGMENT);
}
return true;
}
return false;
}
// TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a
// hard-coded string.
@SuppressLint("MissingPermission")
@RequiresApi(api = Build.VERSION_CODES.M)
static boolean handleDeviceIdDisplay(Context context, String input) {
TelephonyManager telephonyManager =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager != null && input.equals(MMI_IMEI_DISPLAY)) {
int labelResId = (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) ?
R.string.imei : R.string.meid;
List<String> deviceIds = new ArrayList<String>();
if (TelephonyManagerCompat.getPhoneCount(telephonyManager) > 1 &&
CompatUtils.isMethodAvailable(TelephonyManagerCompat.TELEPHONY_MANAGER_CLASS,
"getDeviceId", Integer.TYPE)) {
for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) {
@SuppressLint("MissingPermission") String deviceId = telephonyManager.getDeviceId(slot);
if (!TextUtils.isEmpty(deviceId)) {
deviceIds.add(deviceId);
}
}
} else {
deviceIds.add(telephonyManager.getDeviceId());
}
AlertDialog alert = new AlertDialog.Builder(context)
.setTitle(labelResId)
.setItems(deviceIds.toArray(new String[deviceIds.size()]), null)
.setPositiveButton(android.R.string.ok, null)
.setCancelable(false)
.show();
return true;
}
return false;
}
private static boolean handleRegulatoryInfoDisplay(Context context, String input) {
if (input.equals(MMI_REGULATORY_INFO_DISPLAY)) {
Log.d(TAG, "handleRegulatoryInfoDisplay() sending intent to settings app");
Intent showRegInfoIntent = new Intent(Settings.ACTION_SHOW_REGULATORY_INFO);
try {
context.startActivity(showRegInfoIntent);
} catch (ActivityNotFoundException e) {
Log.e(TAG, "startActivity() failed: " + e);
}
return true;
}
return false;
}
/*******
* This code is used to handle SIM Contact queries
*******/
private static final String ADN_PHONE_NUMBER_COLUMN_NAME = "number";
private static final String ADN_NAME_COLUMN_NAME = "name";
private static final int ADN_QUERY_TOKEN = -1;
/**
* Cookie object that contains everything we need to communicate to the
* handler's onQuery Complete, as well as what we need in order to cancel
* the query (if requested).
*
* Note, access to the textField field is going to be synchronized, because
* the user can request a cancel at any time through the UI.
*/
private static class SimContactQueryCookie implements DialogInterface.OnCancelListener{
public ProgressDialog progressDialog;
public int contactNum;
// Used to identify the query request.
private int mToken;
private QueryHandler mHandler;
// The text field we're going to update
private EditText textField;
public SimContactQueryCookie(int number, QueryHandler handler, int token) {
contactNum = number;
mHandler = handler;
mToken = token;
}
/**
* Synchronized getter for the EditText.
*/
public synchronized EditText getTextField() {
return textField;
}
/**
* Synchronized setter for the EditText.
*/
public synchronized void setTextField(EditText text) {
textField = text;
}
/**
* Cancel the ADN query by stopping the operation and signaling
* the cookie that a cancel request is made.
*/
public synchronized void onCancel(DialogInterface dialog) {
// close the progress dialog
if (progressDialog != null) {
progressDialog.dismiss();
}
// setting the textfield to null ensures that the UI does NOT get
// updated.
textField = null;
// Cancel the operation if possible.
mHandler.cancelOperation(mToken);
}
}
/**
* Asynchronous query handler that services requests to look up ADNs
*
* Queries originate from {@link #handleAdnEntry}.
*/
private static class QueryHandler extends NoNullCursorAsyncQueryHandler {
private boolean mCanceled;
public QueryHandler(ContentResolver cr) {
super(cr);
}
/**
* Override basic onQueryComplete to fill in the textfield when
* we're handed the ADN cursor.
*/
@Override
protected void onNotNullableQueryComplete(int token, Object cookie, Cursor c) {
try {
sPreviousAdnQueryHandler = null;
if (mCanceled) {
return;
}
SimContactQueryCookie sc = (SimContactQueryCookie) cookie;
// close the progress dialog.
sc.progressDialog.dismiss();
// get the EditText to update or see if the request was cancelled.
EditText text = sc.getTextField();
// if the TextView is valid, and the cursor is valid and positionable on the
// Nth number, then we update the text field and display a toast indicating the
// caller name.
if ((c != null) && (text != null) && (c.moveToPosition(sc.contactNum))) {
String name = c.getString(c.getColumnIndexOrThrow(ADN_NAME_COLUMN_NAME));
String number =
c.getString(c.getColumnIndexOrThrow(ADN_PHONE_NUMBER_COLUMN_NAME));
// fill the text in.
text.getText().replace(0, 0, number);
// display the name as a toast
Context context = sc.progressDialog.getContext();
CharSequence msg = ContactDisplayUtils.getTtsSpannedPhoneNumber(
context.getResources(), R.string.menu_callNumber, name);
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
} finally {
MoreCloseables.closeQuietly(c);
}
}
public void cancel() {
mCanceled = true;
// Ask AsyncQueryHandler to cancel the whole request. This will fail when the query is
// already started.
cancelOperation(ADN_QUERY_TOKEN);
}
}
}
| [
"meng.zhaoxue@shuzijiayuan.com"
] | meng.zhaoxue@shuzijiayuan.com |
93e6d3c340aa50968a56267208d1ebbaf11b1a12 | 8cc5b90010b7000d9f12f452825d41f8f29da870 | /search-online/src/main/java/com/ani/se/on/entity/BasicSeEntity.java | cf3d95938f5dfbde2e45a4f5dc3b82df3929ae3b | [] | no_license | anicloud/ani-se | 361dcd911c9505aacacf90383d493c934a2ec1d3 | cdf41b194dc5a09453d5c4b6874a2c5e66a6d866 | refs/heads/master | 2021-01-20T08:41:25.479689 | 2016-05-24T09:57:42 | 2016-05-24T09:57:42 | 24,780,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 105 | java | package com.ani.se.on.entity;
/**
* Created by huangbin on 6/22/15.
*/
public class BasicSeEntity {
}
| [
"fantasyhb@gmail.com"
] | fantasyhb@gmail.com |
9c78f7fa43a5931400adf5761e12e59b83b3deaf | eb49d2eb816402a7282be9df3e6587d47e03dadd | /src/test/java/com/sapient/leaguestanding/service/LeagueStandingServiceTest.java | d1fdf63d3fac490da62ffc16fc57154392915a4c | [] | no_license | Tkt93/LeagueStanding | 8d18dd0a51d401aaf0cc0dca9ac5812057877e60 | 8d2ce7ba8f7a33df0d1c11fc7ec10cf9693b99e1 | refs/heads/main | 2023-02-18T06:53:58.127337 | 2021-01-23T08:00:05 | 2021-01-23T08:00:05 | 332,150,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,660 | java | package com.sapient.leaguestanding.service;
import com.sapient.leaguestanding.models.Country;
import com.sapient.leaguestanding.models.League;
import com.sapient.leaguestanding.models.Standings;
import com.sapient.leaguestanding.models.Team;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
@RunWith(MockitoJUnitRunner.class)
public class LeagueStandingServiceTest {
public LeagueStandingServiceTest() {
}
@Mock
private RestTemplate restTemplate;
@InjectMocks
private LeagueStandingService leagueStandingService = new LeagueStandingService();
@Test
public void testLeagueStandingService() {
List<Country> countries = new ArrayList<>();
ArrayList<League> leagues = new ArrayList<>();
ArrayList<Team> teamList = new ArrayList<>();
int countryId = 1;
int leagueId = 12;
teamList.add(new Team(14, "team1", 4));
leagues.add(new League(leagueId, "La Liga", teamList));
Country c1 = new Country(countryId, "Spain", leagues);
countries.add(c1);
Mockito.when(
restTemplate.getForEntity(leagueStandingService.getCountriesURL(), Country[].class))
.thenReturn(
new ResponseEntity<Country[]>(countries.toArray(new Country[0]),
HttpStatus.OK));
Mockito.when(
restTemplate.getForEntity(leagueStandingService.getLeaguesURL() + countryId, League[].class))
.thenReturn(new ResponseEntity<League[]>(leagues.toArray(new League[0]), HttpStatus.OK));
List<Standings> standings = new ArrayList<>();
Standings e = new Standings();
e.setCountryName("France");
e.setLeagueId(1);
e.setLeagueName("League1");
e.setOverallLeaguePosition("12");
standings.add(e);
Mockito.when(
restTemplate.getForEntity(leagueStandingService.getStandingsURL() + leagueId, Standings[].class))
.thenReturn(new ResponseEntity<Standings[]>(standings.toArray(new Standings[0]), HttpStatus.OK));
List<Country> countryWiseLeagueRanking = leagueStandingService
.getCountryWiseLeagueRanking();
Assert.assertEquals("Spain", countryWiseLeagueRanking.get(0).getCountryName());
}
} | [
"tushar@clevertap.com"
] | tushar@clevertap.com |
e0f5682dabf3f7260b5f73ef51d06e9bec745c24 | dd4d66ae4721d6d0dc28706a7457aa59aefba669 | /src/main/java/com/tj/dao/ShippingMapper.java | 60ed1475f1c955df38a30255eaa1932731fd356b | [] | no_license | tan-jin-mm/tanjin_shopping | 37d24d704e0318e70172c4b1296c82d828230924 | 30bab20c175e3309332941abb5c5d2feb7ba9850 | refs/heads/master | 2020-04-14T19:41:20.350868 | 2019-01-10T11:30:34 | 2019-01-10T11:30:34 | 164,067,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,497 | java | package com.tj.dao;
import com.tj.pojo.Shipping;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ShippingMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tj_shipping
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tj_shipping
*
* @mbg.generated
*/
int insert(Shipping record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tj_shipping
*
* @mbg.generated
*/
Shipping selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tj_shipping
*
* @mbg.generated
*/
List<Shipping> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tj_shipping
*
* @mbg.generated
*/
int updateByPrimaryKey(Shipping record);
/*
* 删除地址(防止横向越权,用userId和shippingId组合)
* */
int deleteByUserIdAndShippingId(@Param("userId") Integer userId,
@Param("shipping")Integer shipping);
/*
* 更新地址表
* */
int updateBySelectiveKey(Shipping shipping);
} | [
"532688846@qq.com"
] | 532688846@qq.com |
eadab8eb6278c5646bd096aa8195ab283e2565c8 | 93ee51eb61dd10c76c8388f79d111fddc89b8816 | /src/main/java/com/coap/example/SimpleCoapServer.java | 0c71750de40f865e5fa2b738f307d1da47b9663d | [] | no_license | TOBACCOCN/coap-example | 696e8b4cc3aed0fa9ebc48b8afeebe527a6d1da3 | 4ba02163a43f0bf60ddc42bb0cfed86bdce94a35 | refs/heads/master | 2022-07-09T21:17:38.081859 | 2020-08-18T07:08:25 | 2020-08-18T07:08:25 | 220,818,401 | 0 | 0 | null | 2022-06-17T02:38:10 | 2019-11-10T16:38:27 | Java | UTF-8 | Java | false | false | 8,348 | java | package com.coap.example;
import com.coap.example.CredentialsUtil.Mode;
import org.eclipse.californium.core.CoapServer;
import org.eclipse.californium.core.coap.CoAP;
import org.eclipse.californium.core.network.CoapEndpoint;
import org.eclipse.californium.core.network.Exchange;
import org.eclipse.californium.core.server.resources.CoapExchange;
import org.eclipse.californium.scandium.DTLSConnector;
import org.eclipse.californium.scandium.config.DtlsConnectorConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.util.*;
import java.util.stream.Stream;
import static com.coap.example.CredentialsUtil.DEFAULT_SERVER_MODES;
import static com.coap.example.CredentialsUtil.SERVER_NAME;
@Component
public class SimpleCoapServer {
private static Logger logger = LoggerFactory.getLogger(SimpleCoapServer.class);
private static final List<CredentialsUtil.Mode> SUPPORTED_MODES =
Arrays.asList(Mode.PSK, Mode.ECDHE_PSK, Mode.RPK, Mode.X509, Mode.WANT_AUTH, Mode.NO_AUTH);
// 服务端可以不需要受信任的证书
// private String[] args = new String[]{Mode.PSK.toString(), Mode.ECDHE_PSK.toString(), Mode.RPK.toString(),
// Mode.X509.toString(), Mode.WANT_AUTH.toString()};
private String[] args = new String[]{Mode.PSK.toString(), Mode.ECDHE_PSK.toString(), Mode.RPK.toString(),
Mode.WANT_AUTH.toString()};
private Map<String, Method> url2MethodMap = new HashMap<>();
@Autowired
private SimpleApplicationContextAware simpleApplicationContextAware;
@Value("${coap.port}")
private int port;
public void start() {
CoapServer coapServer = new CoapServer();
// 添加 DTLS 支持,也就是通过 coaps 安全方式访问
CoapEndpoint.Builder endpointBuilder = new CoapEndpoint.Builder();
endpointBuilder.setConnector(new DTLSConnector(initDtlsConfigBuilder()));
coapServer.addEndpoint(endpointBuilder.build());
Map<String, Object> coapHandlerMap =
simpleApplicationContextAware.getApplicationContext().getBeansWithAnnotation(CoapHandler.class);
// 进行 url 到 method 的映射
SimpleCoapResource mainCoapResource = null;
for (Object coapHandler : coapHandlerMap.values()) {
Class<?> clazz = coapHandler.getClass();
CoapMapping classCoapMapping = clazz.getAnnotation(CoapMapping.class);
String[] classMappingUrls = classCoapMapping == null ? new String[]{""} : classCoapMapping.value();
SimpleCoapResource classCoapResource = null;
for (Method method : clazz.getMethods()) {
CoapMapping methodCoapMapping = method.getAnnotation(CoapMapping.class);
if (methodCoapMapping != null) {
CoapMethod[] coapMethods = methodCoapMapping.method();
List<Integer> coapMethodValues = new ArrayList<>();
Stream.of(coapMethods).forEach(coapMethod -> coapMethodValues.add(coapMethod.value));
SimpleCoapResource methodCoapResource = null;
for (String classMappingUrl : classMappingUrls) {
SimpleCoapResource classUrlCoapResource = null;
for (String methodMappingUrl : methodCoapMapping.value()) {
String url = classMappingUrl + methodMappingUrl;
if (url.startsWith("/")) {
url = url.substring(1);
}
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
if (url2MethodMap.containsKey(url)) {
throw new IllegalStateException(">>>>> Ambiguous mapping. Cannot map \n[" + method +
"] \nto [" + url + "]\n. There is already \n[" + url2MethodMap.get(url) +
"]\n mapped.");
} else {
url2MethodMap.put(url, method);
}
String[] resources = url.split("/");
SimpleCoapResource methodUrlCoapResource = null;
for (int i = 0; i < resources.length; i++) {
if (resources.length == 1) {
methodUrlCoapResource = getBusinessCoapResource(coapHandler, method,
coapMethodValues, resources[i]);
} else {
if (i == 0) {
methodUrlCoapResource = new NotAllowedCoapResource(resources[i]);
} else if (i == resources.length - 1) {
methodUrlCoapResource =
methodUrlCoapResource.add(getBusinessCoapResource(coapHandler, method,
coapMethodValues, resources[i]));
} else {
methodUrlCoapResource = methodUrlCoapResource.add(new NotAllowedCoapResource(resources[i]));
}
}
}
classUrlCoapResource = adjustParentChild(classUrlCoapResource, methodUrlCoapResource);
}
methodCoapResource = adjustParentChild(methodCoapResource, classUrlCoapResource);
}
classCoapResource = adjustParentChild(classCoapResource, methodCoapResource);
}
}
mainCoapResource = adjustParentChild(mainCoapResource, classCoapResource);
}
coapServer.add(mainCoapResource);
coapServer.start();
}
private SimpleCoapResource adjustParentChild(SimpleCoapResource parent, SimpleCoapResource child) {
if (parent == null) {
parent = child;
} else if (child != null) {
parent.add(child);
}
return parent;
}
// https://github.com/eclipse/californium/blob/master/demo-apps/cf-secure/src/main/java/org/eclipse/californium/examples/SecureServer.java
private DtlsConnectorConfig initDtlsConfigBuilder() {
DtlsConnectorConfig.Builder builder = new DtlsConnectorConfig.Builder();
CredentialsUtil.setupCid(args, builder);
builder.setAddress(new InetSocketAddress(port));
builder.setRecommendedCipherSuitesOnly(false);
List<Mode> modes = CredentialsUtil.parse(args, DEFAULT_SERVER_MODES, SUPPORTED_MODES);
CredentialsUtil.setupCredentials(builder, SERVER_NAME, modes);
return builder.build();
}
private SimpleCoapResource getBusinessCoapResource(Object coapHandler, Method method,
List<Integer> coapMethodValues, String resource) {
return new SimpleCoapResource(resource) {
@Override
public void handleRequest(Exchange exchange) {
CoAP.Code code = exchange.getRequest().getCode();
try {
if (coapMethodValues.size() == 0 || coapMethodValues.contains(code.value)) {
method.invoke(coapHandler, new CoapExchange(exchange, this));
} else {
super.handleRequest(exchange);
}
} catch (Exception e) {
StringWriter stringWriter = new StringWriter();
e.printStackTrace(new PrintWriter(stringWriter, true));
logger.error(">>>>> INVOKE_METHOD_ERROR: [{}]", method.getName());
logger.error(stringWriter.toString());
}
}
};
}
}
| [
"zyonghong@eliteai.com.cn"
] | zyonghong@eliteai.com.cn |
97c56a71cdcd7b14d43a15d8a2411dcec0ce7016 | 6fb05fe9026efc8bd63ba15ece404b531de8d948 | /src/java/locdq/controller/DeleteProductController.java | 911118b07b5ae05059c1955a0235f40ff860f05b | [] | no_license | DQLok/FlowersShop | bfa55f4366c30aa271fba145523cb6a22f3eada5 | 713e833f77feb2c8e60ca04955196fb187e2ff1f | refs/heads/main | 2023-06-14T18:49:34.798929 | 2021-07-04T12:51:58 | 2021-07-04T12:51:58 | 382,850,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,172 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package locdq.controller;
import java.io.IOException;
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 locdq.daos.ProductDAO;
/**
*
* @author test
*/
@WebServlet(name = "DeleteProductController", urlPatterns = {"/DeleteProductController"})
public class DeleteProductController extends HttpServlet {
private static final String ERROR="SearchProductController";
private static final String SUCCESS="SearchProductController";
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String url=ERROR;
try {
String SearchProducts=request.getParameter("SearchProducts");
String productID=request.getParameter("productID");
ProductDAO dao=new ProductDAO();
boolean check=dao.delete(productID);
if (check){
url=SUCCESS+"?SearchProducts="+SearchProducts;
}
}catch(Exception e){
log("Error DeleteProdut"+e.toString());
}finally{
request.getRequestDispatcher(url).forward(request, response);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"wkhhkw01@gmail.com"
] | wkhhkw01@gmail.com |
ac75ea275a2e800fbe6e6508fef341ba59c8b267 | 938aa99eec9f17c8182309e510e17a50cdeac75e | /src/main/java/com/magic/weijd/mapper/ISuggestMapper.java | 1f448cb5f243d28d23b5d7fd8a89f31bd1fe8e43 | [] | no_license | lizuohuan/weijd | c5208d8909127f2b14c2e02415bcddc0bce4d4b9 | c3f5a2cf580ba8bcdd92578419b0a81597a2189c | refs/heads/master | 2021-04-30T11:10:10.067681 | 2018-02-13T02:53:32 | 2018-02-13T02:53:32 | 121,348,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.magic.weijd.mapper;
import com.magic.weijd.entity.Suggest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Created by Eric Xie on 2017/7/13 0013.
*/
@Mapper
public interface ISuggestMapper {
Integer addSuggest(Suggest suggest);
/**
* 后台页面 分页获取意见反馈
* @param map map
* @return
*/
List<Suggest> listForAdmin(Map<String, Object> map);
/**
* 后台页面 分页获取意见反馈 条数
* @param map map
* @return
*/
int listForAdminCount(Map<String, Object> map);
/**
* 删除意见反馈
* @param id
*/
void delete(@Param("id") Integer id);
}
| [
"kalen"
] | kalen |
fae1b0da9757bbc544ffc6b65312969fd1d85641 | 01b23223426a1eb84d4f875e1a6f76857d5e8cd9 | /icefaces3/scratchpads/ICE-8654/icefaces/ace/component/src/org/icefaces/ace/util/ComponentUtils.java | fd6e0bb75d5dca3c55ace533be93ad9232c22b3c | [
"Apache-2.0"
] | permissive | numbnet/icesoft | 8416ac7e5501d45791a8cd7806c2ae17305cdbb9 | 2f7106b27a2b3109d73faf85d873ad922774aeae | refs/heads/master | 2021-01-11T04:56:52.145182 | 2016-11-04T16:43:45 | 2016-11-04T16:43:45 | 72,894,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,295 | java | /*
* Original Code Copyright Prime Technology.
* Subsequent Code Modifications Copyright 2011-2012 ICEsoft Technologies Canada Corp. (c)
*
* 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.
*
* NOTE THIS CODE HAS BEEN MODIFIED FROM ORIGINAL FORM
*
* Subsequent Code Modifications have been made and contributed by ICEsoft Technologies Canada Corp. (c).
*
* Code Modification 1: Integrated with ICEfaces Advanced Component Environment.
* Contributors: ICEsoft Technologies Canada Corp. (c)
*
* Code Modification 2: [ADD BRIEF DESCRIPTION HERE]
* Contributors: ______________________
* Contributors: ______________________
*/
package org.icefaces.ace.util;
import org.icefaces.ace.renderkit.CoreRenderer;
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.application.ProjectStage;
import javax.faces.component.*;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.model.SelectItem;
import javax.faces.render.Renderer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ComponentUtils {
private final static Logger logger = Logger.getLogger(ComponentUtils.class.getName());
/**
* Algorithm works as follows;
* - If it's an input component, submitted value is checked first since it'd be the value to be used in case validation errors
* terminates jsf lifecycle
* - Finally the value of the component is retrieved from backing bean and if there's a converter, converted value is returned
* <p/>
* - If the component is not a value holder, toString of component is used to support Facelets UIInstructions.
*
* @param facesContext FacesContext instance
* @param component UIComponent instance whose value will be returned
* @return End text
*/
public static String getStringValueToRender(FacesContext facesContext, UIComponent component) {
if (component instanceof ValueHolder) {
if (component instanceof EditableValueHolder) {
Object submittedValue = ((EditableValueHolder) component).getSubmittedValue();
if (submittedValue != null) {
return submittedValue.toString();
}
}
ValueHolder valueHolder = (ValueHolder) component;
Object value = valueHolder.getValue();
if (value == null)
return "";
//first ask the converter
if (valueHolder.getConverter() != null) {
return valueHolder.getConverter().getAsString(facesContext, component, value);
}
//Try to guess
else {
ValueExpression expr = component.getValueExpression("value");
if (expr != null) {
Class<?> valueType = expr.getType(facesContext.getELContext());
if (valueType != null) {
Converter converterForType = facesContext.getApplication().createConverter(valueType);
if (converterForType != null)
return converterForType.getAsString(facesContext, component, value);
}
}
}
//No converter found just return the value as string
return value.toString();
} else {
//This would get the plain texts on UIInstructions when using Facelets
String value = component.toString();
if (value != null)
return value.trim();
else
return "";
}
}
/**
* Attempts to return the property accessed in a simple EL expression of the form
* ${someObject.property}.
*
* @param expression An EL expression to parse the property from.
* @return The property name of the EL expression.
*/
public static String resolveField(ValueExpression expression) {
String expressionString = expression.getExpressionString();
return expressionString.substring(expressionString.indexOf(".") + 1, expressionString.length() - 1);
}
/**
* Resolves the end text to render by using a specified value
*
* @param facesContext FacesContext instance
* @param component UIComponent instance whose value will be returned
* @return End text
*/
public static String getStringValueToRender(FacesContext facesContext, UIComponent component, Object value) {
if (value == null) return null;
ValueHolder valueHolder = (ValueHolder) component;
Converter converter = valueHolder.getConverter();
if (converter != null) {
return converter.getAsString(facesContext, component, value);
} else {
ValueExpression expr = component.getValueExpression("value");
if (expr != null) {
Class<?> valueType = expr.getType(facesContext.getELContext());
Converter converterForType = facesContext.getApplication().createConverter(valueType);
if (converterForType != null)
return converterForType.getAsString(facesContext, component, value);
}
}
return value.toString();
}
public static UIComponent findParentForm(FacesContext context, UIComponent component) {
UIComponent parent = component;
while (parent != null)
if (parent instanceof UIForm) break;
else parent = parent.getParent();
return parent;
}
public static void decorateAttribute(UIComponent component, String attribute, String value) {
String attributeValue = (String) component.getAttributes().get(attribute);
if (attributeValue != null) {
if (attributeValue.indexOf(value) == -1) {
String decoratedValue = attributeValue + ";" + value;
component.getAttributes().put(attribute, decoratedValue);
} else {
component.getAttributes().put(attribute, attributeValue);
}
} else {
component.getAttributes().put(attribute, value);
}
}
public static List<SelectItem> createSelectItems(UIComponent component) {
List<SelectItem> items = new ArrayList<SelectItem>();
Iterator<UIComponent> children = component.getChildren().iterator();
while (children.hasNext()) {
UIComponent child = children.next();
if (child instanceof UISelectItem) {
UISelectItem selectItem = (UISelectItem) child;
items.add(new SelectItem(selectItem.getItemValue(), selectItem.getItemLabel()));
} else if (child instanceof UISelectItems) {
Object selectItems = ((UISelectItems) child).getValue();
if (selectItems instanceof SelectItem[]) {
SelectItem[] itemsArray = (SelectItem[]) selectItems;
for (SelectItem item : itemsArray)
items.add(new SelectItem(item.getValue(), item.getLabel()));
} else if (selectItems instanceof Collection) {
Collection<SelectItem> collection = (Collection<SelectItem>) selectItems;
for (SelectItem item : collection)
items.add(new SelectItem(item.getValue(), item.getLabel()));
}
}
}
return items;
}
public static String escapeJQueryId(String id) {
return "#" + id.replaceAll(":", "\\\\\\\\:");
}
public static String findClientIds(FacesContext context, UIComponent component, String list) {
if (list == null) return "@none";
//System.out.println("ComponentUtils.findClientIds() component.clientId: " + component.getClientId(context) + " list: " + list);
String[] ids = list.split("[,\\s]+");
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < ids.length; i++) {
if (i != 0) buffer.append(" ");
String id = ids[i].trim();
//System.out.println("ComponentUtils.findClientIds() ["+i+"] id: " + id);
if (id.equals("@all") || id.equals("@none")) {
//System.out.println("ComponentUtils.findClientIds() ["+i+"] " + id);
buffer.append(id);
}
else if (id.equals("@this")) {
//System.out.println("ComponentUtils.findClientIds() ["+i+"] @this : " + component.getClientId(context));
buffer.append(component.getClientId(context));
}
else if (id.equals("@parent")) {
//System.out.println("ComponentUtils.findClientIds() ["+i+"] @parent: " + component.getParent().getClientId(context));
buffer.append(component.getParent().getClientId(context));
}
else if (id.equals("@form")) {
UIComponent form = ComponentUtils.findParentForm(context, component);
if (form == null)
throw new FacesException("Component " + component.getClientId(context) + " needs to be enclosed in a form");
buffer.append(form.getClientId(context));
}
else {
id = encodeNameSpace(context, id);
UIComponent comp = component.findComponent(id);
//System.out.println("ComponentUtils.findClientIds() ["+i+"] comp : " + (comp == null ? "null" : comp.getClientId(context)));
if (comp != null) {
buffer.append(comp.getClientId(context));
}
else {
if (context.getApplication().getProjectStage().equals(ProjectStage.Development)) {
logger.log(Level.INFO, "Cannot find component with identifier \"{0}\" in view.", id);
}
buffer.append(id);
}
}
}
return buffer.toString();
}
/**
* Environments like portlets need to namespace the components in order to uniquely identify them
* on the page in case there are multiple instances of the same portlet or different portlets that use
* the same ids. This method will prepend the namespace properly taking care to ensure that the
* namespace is not added twice and that a colon (:) is added if necessary.
*
* @param fc The current FacesContext instance
* @param id The id to encode
* @return The namespace encoded id
*/
public static String encodeNameSpace(FacesContext fc, String id){
if( id == null || id.trim().length() == 0){
return id;
}
String tempId = id;
ExternalContext ec = fc.getExternalContext();
String encodedId = ec.encodeNamespace(tempId);
//If no namespace was applied, we're done.
if( encodedId.equals(id)){
return id;
}
//Extract the actual namespace.
int idStart = encodedId.indexOf(id);
String ns = encodedId.substring(0,idStart);
//Check if the id already had the namespace. If so, we're done.
if( id.startsWith(ns) ){
return id;
}
//Need to ensure an absolute reference before adding the namespace so that it's
//a legal component id.
if( !id.startsWith(":")){
id = ":" + id;
}
//Add the namespace.
id = ns + id;
return id;
}
public static String findComponentClientId(String id) {
UIComponent component = null;
FacesContext facesContext = FacesContext.getCurrentInstance();
component = findComponent(facesContext.getViewRoot(), id);
return component.getClientId(facesContext);
}
public static UIComponent findComponent(UIComponent base, String id) {
if (id.equals(base.getId()))
return base;
UIComponent kid = null;
UIComponent result = null;
Iterator<UIComponent> kids = base.getFacetsAndChildren();
while (kids.hasNext() && (result == null)) {
kid = (UIComponent) kids.next();
if (id.equals(kid.getId())) {
result = kid;
break;
}
result = findComponent(kid, id);
if (result != null) {
break;
}
}
return result;
}
public static String getWidgetVar(String id) {
UIComponent component = findComponent(FacesContext.getCurrentInstance().getViewRoot(), id);
Renderer renderer = FacesContext.getCurrentInstance().getRenderKit()
.getRenderer(component.getFamily(), component.getRendererType());
if (component == null) throw new FacesException("Cannot find component " + id + " in view.");
else if (!(renderer instanceof CoreRenderer))
throw new FacesException("Component with id " + id + " is not derived from CoreRenderer.");
return ((CoreRenderer) renderer).resolveWidgetVar(component);
}
public static boolean isLiteralText(UIComponent component) {
return component.getFamily().equalsIgnoreCase("facelets.LiteralText");
}
} | [
"ken.fyten@8668f098-c06c-11db-ba21-f49e70c34f74"
] | ken.fyten@8668f098-c06c-11db-ba21-f49e70c34f74 |
f3057b5ab7df04c76efb2741d509ea40fdc2d120 | 0afcfdad624fe19bb160fb0beba6bd06ce32c316 | /src/DynamicProgramming/HitungFibonacci.java | 935b4466f72f41ad776a4d43be2eebd2bab6b0e2 | [] | no_license | StefanusRio/HitungFibonacci | bf28a536625e3680c58e506c88324a87e44efe04 | b8e653cc2386b49a82988058df115d906179e336 | refs/heads/master | 2020-03-28T13:41:58.051307 | 2018-09-14T13:06:37 | 2018-09-14T13:06:37 | 148,419,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,399 | java | package DynamicProgramming;
import java.math.BigInteger;
import java.util.Scanner;
public class HitungFibonacci {
public static void tampilJudul(String identitas)
{
System.out.println("Identitas : "+ identitas);
System.out.println("Hitung Fibonacci");
System.out.println("1, 1, 2, 3, 5, 8, 13, 21,......dst");
}
public static int tampilInput()
{
Scanner scanner = new Scanner(System.in);
System.out.print("Bilangan ke- ");
int n = scanner.nextInt();
return n;
}
private static BigInteger fibo(int n)
{
BigInteger[] hasil = new BigInteger[n];
hasil[0] = BigInteger.ONE;
hasil[1] = BigInteger.ONE;
for(int i = 2; i < n; i++)
{
hasil[i] = hasil[i-1].add(hasil[i-2]);
}
return hasil[n-1];
}
private static void tampilHasil(int n, BigInteger hasil)
{
System.out.println("Bilangan Fibonacci ke-"+n+" : " + hasil);
}
public static void main(String args[])
{
String identitas = "Stefanus Ario Prabowo / X RPL 3/ 37";
tampilJudul(identitas);
int n = tampilInput();
BigInteger hasil = fibo(n);
tampilHasil(n, hasil);
}
}
| [
"susan@asus"
] | susan@asus |
35ddfd3ffcda4dfd9da8bc566bde2f47dd36aa71 | 10240d4c0b8b47775787baa069a462e2a40e906a | /src/main/java/com/myapp/myserver/config/Constants.java | 56c27d83c5e4cb0bea5a0a5068e42846774c1fbc | [] | no_license | rafamotao/Awesome-Notes-Application-Server | 0940fc091517a9db2218c57278bea9000ad574e4 | 832a3370b8117f3913be033b857fc05905e90799 | refs/heads/master | 2021-06-28T23:11:00.859526 | 2018-12-07T23:16:40 | 2018-12-07T23:16:40 | 160,882,949 | 0 | 1 | null | 2020-09-18T11:17:27 | 2018-12-07T22:45:18 | Java | UTF-8 | Java | false | false | 423 | java | package com.myapp.myserver.config;
/**
* Application constants.
*/
public final class Constants {
// Regex for acceptable logins
public static final String LOGIN_REGEX = "^[_'.A-Za-z0-9-]*$";
public static final String SYSTEM_ACCOUNT = "system";
public static final String ANONYMOUS_USER = "anonymoususer";
public static final String DEFAULT_LANGUAGE = "en";
private Constants() {
}
}
| [
"motarafa@hotmail.com"
] | motarafa@hotmail.com |
3df1dbae01e4eac9377237908369baa87d85dc13 | 1041267f87e7701891a37b822ab2aa6d0b8fa4ba | /hackerRank/java/tutorials/statistics/Quartiles.java | a78c771a61bf9d6c471fc142cf19742698e2e1e2 | [] | no_license | gloriaJun/algorithm | 80fda764df9e0cc808f6c5ad65caf5c915faa152 | 31882297dd4302a3db317941ee335638d4243a65 | refs/heads/master | 2021-01-18T23:03:24.367886 | 2018-11-14T15:34:07 | 2018-11-14T15:34:07 | 87,084,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | package statistics;
import java.util.Arrays;
import java.util.Scanner;
/*
https://www.hackerrank.com/challenges/s10-quartiles/problem
*/
public class Quartiles {
private static int[] inputArrayScan(Scanner scanner, int size) {
int[] arr = new int[size];
for (int i=0; i < size; i++) {
int num = scanner.nextInt();
arr[i] = num;
}
return arr;
}
private static int findQuartiles(int[] arr, int start, int end) {
int size = start + end + 1;
int idx = size / 2;
return (size % 2 == 0)? (arr[idx-1] + arr[idx]) / 2 : arr[idx];
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int size = scanner.nextInt();
int[] arr= inputArrayScan(scanner, size);
scanner.close();
// sort
Arrays.sort(arr);
// get middle size
int mSize = size / 2;
// System.out.println(Arrays.toString(arr));
System.out.println(findQuartiles(arr, 0, mSize - 1));
System.out.println(findQuartiles(arr, 0, size - 1));
if (size % 2 == 0) {
System.out.println(findQuartiles(arr, mSize, size - 1));
} else {
System.out.println(findQuartiles(arr, mSize + 1, size - 1));
}
}
}
| [
"pureainu@gmail.com"
] | pureainu@gmail.com |
8408a3c2d3974eaa9e527c5c47d23f444745e0dc | 60f1564e071b6b4d24069b5e70765412c9d7a730 | /xc-service-manage-cms/src/test/java/com/xuecheng/cms/LoderHtmlTest.java | 1d0f2e7976ac04e9f1f51282582b894ae2b6972d | [] | no_license | xibinzhao/xuechengzaixian | 1866af1753203911918ab4e66a5c35241d25fcfe | 4e622917717661904114ccda1b33d50f4ff1e1b1 | refs/heads/dev-TS-1 | 2022-11-30T19:28:29.976908 | 2020-07-03T08:57:06 | 2020-07-03T08:57:06 | 251,279,846 | 0 | 0 | null | 2022-11-24T06:27:43 | 2020-03-30T11:06:20 | Java | UTF-8 | Java | false | false | 691 | java | package com.xuecheng.cms;
import com.xuecheng.api.cms.service.CmsPageService;
import com.xuecheng.manage_cms.ManageCmsApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = ManageCmsApplication.class)
@RunWith(SpringRunner.class)
public class LoderHtmlTest {
@Autowired
private CmsPageService cmsPageService;
@Test
public void test() {
String s = cmsPageService.pageHtml("5db689a0cb47ef264005b10f");
System.out.println(s);
}
}
| [
"1140877376@qq.com"
] | 1140877376@qq.com |
d10b277821b26c0c1962126aebb1a4efee47fb2c | 6eddc98adc0a91eda43dee7ca181e59f936edd36 | /src/main/java/kr/co/codemaker/user/classroom/exam/service/ExamScoreUserService.java | a2c23df571dd327bbabac5231bb00cba746929e5 | [] | no_license | hitobi1014/codemaker | 2903459e004cc3f2475c73ebf6dd3d1e103cc049 | a0a7b7ea571da2a642f4ab337ea37897dea91d44 | refs/heads/master | 2023-02-17T07:36:35.962158 | 2021-01-12T05:06:04 | 2021-01-12T05:06:04 | 315,828,576 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,805 | java | package kr.co.codemaker.user.classroom.exam.service;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import kr.co.codemaker.user.classroom.exam.dao.ExamScoreUserMapper;
import kr.co.codemaker.user.classroom.exam.vo.ExamScoreVO;
import kr.co.codemaker.user.classroom.exam.vo.ExamVO;
/**
*
* ExamScoreUserService.java
*
* @author 김미연
* @version 1.0
* @since 2020. 12. 14.
*
* 수정자 수정내용
* ------ ------------------------
* 김미연 최초 생성
*
*/
@Service("examScoreUserService")
public class ExamScoreUserService {
@Resource(name = "examScoreUserMapper")
private ExamScoreUserMapper examScoreUserMapper;
/**
* 회원의 모든 성적을 조회하는 메서드
*
* @author 김미연
* @param examVO
* @return
* @throws Exception
*/
public List<ExamScoreVO> selectAllExamScore(ExamVO examVO) throws Exception {
return examScoreUserMapper.selectAllExamScore(examVO);
}
/**
* 회원의 성적 1개를 조회하는 메서드
*
* @author 김미연
* @param examVO
* @return
* @throws Exception
*/
public ExamScoreVO selectExamScore(ExamVO examVO) throws Exception {
return examScoreUserMapper.selectExamScore(examVO);
}
/**
* 회원의 성적을 등록하는 메서드
*
* @author 김미연
* @param examScoreVO
* @return
* @throws Exception
*/
public int insertExamScore(ExamScoreVO examScoreVO) throws Exception {
return examScoreUserMapper.insertExamScore(examScoreVO);
}
/**
* 회원의 성적을 수정하는 메서드
*
* @author 김미연
* @param examScoreVO
* @return
* @throws Exception
*/
public int updateExamScore(ExamScoreVO examScoreVO) throws Exception {
return examScoreUserMapper.updateExamScore(examScoreVO);
}
}
| [
"miyeon03085@gmail.com"
] | miyeon03085@gmail.com |
84c1a41b60fe2e91afef83e2bdde6ccbc5678e36 | 67ae3c7cd9182b2753cc777dbd80aa2d1ddd5bc8 | /nimbleio-extend/src/main/java/com/generallycloud/nio/extend/security/AuthorityLoginCenter.java | ed9658aace4f4c01b5fb32371e0f6f609e57204e | [] | no_license | 52im/NimbleIO | 1ae07c558212f5625ffff0bcdd2811874eadcbba | 4482fa1570df75a59298f832c4443f1899183443 | refs/heads/master | 2021-04-06T02:27:54.407373 | 2016-09-02T01:02:16 | 2016-09-02T01:02:16 | 67,182,545 | 0 | 0 | null | 2020-06-18T12:39:31 | 2016-09-02T02:20:27 | Java | UTF-8 | Java | false | false | 4,163 | java | package com.generallycloud.nio.extend.security;
import java.util.HashMap;
import java.util.Map;
import com.generallycloud.nio.common.Logger;
import com.generallycloud.nio.common.LoggerFactory;
import com.generallycloud.nio.common.MD5Token;
import com.generallycloud.nio.common.SharedBundle;
import com.generallycloud.nio.common.UUIDGenerator;
import com.generallycloud.nio.component.Configuration;
import com.generallycloud.nio.component.Parameters;
import com.generallycloud.nio.component.Session;
import com.generallycloud.nio.extend.ApplicationContext;
import com.generallycloud.nio.extend.FixedSessionFactory;
import com.generallycloud.nio.extend.InitializeableImpl;
import com.generallycloud.nio.extend.LoginCenter;
import com.generallycloud.nio.extend.plugin.authority.AuthorityContext;
import com.generallycloud.nio.extend.plugin.authority.AuthoritySessionAttachment;
public class AuthorityLoginCenter extends InitializeableImpl implements LoginCenter {
private Logger logger = LoggerFactory.getLogger(AuthorityLoginCenter.class);
private Map<String, Authority> authorities = new HashMap<String, Authority>();
public boolean login(Session session, Parameters parameters) {
Authority authority = getAuthority(parameters);
logger.debug("__________________user_login__{}",authority);
if (authority == null) {
return false;
}
AuthorityContext authorityPlugin = AuthorityContext.getInstance();
AuthoritySessionAttachment attachment = (AuthoritySessionAttachment) session.getAttachment(authorityPlugin.getPluginIndex());
ApplicationContext context = ApplicationContext.getInstance();
RoleManager roleManager = context.getRoleManager();
AuthorityManager authorityManager = roleManager.getAuthorityManager(authority);
attachment.setAuthorityManager(authorityManager);
FixedSessionFactory sessionFactory = context.getSessionFactory();
sessionFactory.putSession(authority.getUsername(), session);
return true;
}
public boolean isLogined(Session session) {
AuthorityContext authorityPlugin = AuthorityContext.getInstance();
AuthoritySessionAttachment attachment = (AuthoritySessionAttachment) session.getAttachment(authorityPlugin.getPluginIndex());
return attachment.getAuthorityManager() != null;
}
public void logout(Session session) {
// 需要登出吗
}
public boolean isValidate(Parameters parameters) {
return getAuthority(parameters) != null;
}
protected Authority getAuthority(Parameters parameters) {
String username = parameters.getParameter("username");
String password = parameters.getParameter("password");
Authority authority = authorities.get(username);
if (authority == null) {
return null;
}
if(!authority.getPassword().equals(password)){
return null;
}
return authority;
}
public void initialize(ApplicationContext context, Configuration config) throws Exception {
String username = SharedBundle.instance().getProperty("SERVER.USERNAME", "admin");
String password = SharedBundle.instance().getProperty("SERVER.PASSWORD", "admin10000");
String UUID = SharedBundle.instance().getProperty("SERVER.UUID",UUIDGenerator.random());
Integer roleID = SharedBundle.instance().getIntegerProperty("SERVER.ROLEID");
Authority authority = new Authority();
authority.setUsername(username);
authority.setPassword(password);
authority.setRoleID(roleID);
authority.setUuid(UUID);
/* ------------------------------------------------------------- */
this.authorities.put(authority.getUsername(), authority);
authority = new Authority();
authority.setUsername("udp1");
authority.setPassword(MD5Token.getInstance().getLongToken("udp1", context.getEncoding()));
authority.setRoleID(0);
authority.setUuid("udp1");
this.authorities.put(authority.getUsername(), authority);
authority = new Authority();
authority.setUsername("udp2");
authority.setPassword(MD5Token.getInstance().getLongToken("udp2", context.getEncoding()));
authority.setRoleID(0);
authority.setUuid("udp2");
this.authorities.put(authority.getUsername(), authority);
}
}
| [
"8738115@qq.com"
] | 8738115@qq.com |
a62fa1320060eae75de679e3c33013d618bc1bf4 | 58680023432e35b3de190edcd5017ac119eb5316 | /connect-4-in-java/Player.java | 1b9b9364a58a7118e1ff6cb863cad22c57ec6b9c | [] | no_license | ama0322/Small-Projects-in-Java | bbc482a011ab4c75db1b6f1394faabd2c6342429 | abe2118a2bb0e7b41345eed92ac803c1cf13ec1e | refs/heads/master | 2021-08-29T12:02:57.898369 | 2017-12-13T22:33:03 | 2017-12-13T22:33:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | public class Player {
private String symbol;
private int currentDiskRow;
private int currentDiskCol;
public int getCurrentDiskRow(){
return currentDiskRow;
}
public int getCurrentDiskCol(){
return currentDiskCol;
}
public Player(String symbol){
this.symbol = symbol;
}
//Drop a disk into the selected column and return whether it was possible
public boolean dropDisk(int col){
boolean diskDropped = false;
col = col+ 2; //convert column into array index
//in that column, move up the rows, drop disk if that array spot is empty
for(int row = 8; row >= 3; row--){
if(Board.board[row][col].equals(" ")){
Board.board[row][col] = " " + this.symbol + " ";
this.currentDiskRow = row;
this.currentDiskCol = col;
diskDropped = true;
System.out.println("Dropped disk");
break;
}
}
return diskDropped;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
1cfc4be0357edba8d77b9a52d0b091fa8b04fab0 | b6dc7e2bb13ecc705989807a4b602e84a37ca2d3 | /epidemic/src/main/java/cn/edu/dgut/epidemic/pojo/RoleExample.java | ef8a226e3b343927f52a40d456f8cbf666d8d742 | [] | no_license | Small-house520/epidemic | cdfdf6b17c37f919daf15fa67e18f55b1539d8bc | 8ad22ef774dd34f0fd67b5646d54eab228e83961 | refs/heads/master | 2023-04-28T19:01:45.390172 | 2021-05-10T09:17:38 | 2021-05-10T09:17:38 | 349,876,346 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,228 | java | package cn.edu.dgut.epidemic.pojo;
import java.util.ArrayList;
import java.util.List;
public class RoleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public RoleExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andRoleIdIsNull() {
addCriterion("ROLE_ID is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("ROLE_ID is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Short value) {
addCriterion("ROLE_ID =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Short value) {
addCriterion("ROLE_ID <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Short value) {
addCriterion("ROLE_ID >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Short value) {
addCriterion("ROLE_ID >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Short value) {
addCriterion("ROLE_ID <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Short value) {
addCriterion("ROLE_ID <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Short> values) {
addCriterion("ROLE_ID in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Short> values) {
addCriterion("ROLE_ID not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Short value1, Short value2) {
addCriterion("ROLE_ID between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Short value1, Short value2) {
addCriterion("ROLE_ID not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleNameIsNull() {
addCriterion("ROLE_NAME is null");
return (Criteria) this;
}
public Criteria andRoleNameIsNotNull() {
addCriterion("ROLE_NAME is not null");
return (Criteria) this;
}
public Criteria andRoleNameEqualTo(String value) {
addCriterion("ROLE_NAME =", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotEqualTo(String value) {
addCriterion("ROLE_NAME <>", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameGreaterThan(String value) {
addCriterion("ROLE_NAME >", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameGreaterThanOrEqualTo(String value) {
addCriterion("ROLE_NAME >=", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameLessThan(String value) {
addCriterion("ROLE_NAME <", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameLessThanOrEqualTo(String value) {
addCriterion("ROLE_NAME <=", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameLike(String value) {
addCriterion("ROLE_NAME like", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotLike(String value) {
addCriterion("ROLE_NAME not like", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameIn(List<String> values) {
addCriterion("ROLE_NAME in", values, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotIn(List<String> values) {
addCriterion("ROLE_NAME not in", values, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameBetween(String value1, String value2) {
addCriterion("ROLE_NAME between", value1, value2, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotBetween(String value1, String value2) {
addCriterion("ROLE_NAME not between", value1, value2, "roleName");
return (Criteria) this;
}
public Criteria andRemarksIsNull() {
addCriterion("REMARKS is null");
return (Criteria) this;
}
public Criteria andRemarksIsNotNull() {
addCriterion("REMARKS is not null");
return (Criteria) this;
}
public Criteria andRemarksEqualTo(String value) {
addCriterion("REMARKS =", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksNotEqualTo(String value) {
addCriterion("REMARKS <>", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksGreaterThan(String value) {
addCriterion("REMARKS >", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksGreaterThanOrEqualTo(String value) {
addCriterion("REMARKS >=", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksLessThan(String value) {
addCriterion("REMARKS <", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksLessThanOrEqualTo(String value) {
addCriterion("REMARKS <=", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksLike(String value) {
addCriterion("REMARKS like", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksNotLike(String value) {
addCriterion("REMARKS not like", value, "remarks");
return (Criteria) this;
}
public Criteria andRemarksIn(List<String> values) {
addCriterion("REMARKS in", values, "remarks");
return (Criteria) this;
}
public Criteria andRemarksNotIn(List<String> values) {
addCriterion("REMARKS not in", values, "remarks");
return (Criteria) this;
}
public Criteria andRemarksBetween(String value1, String value2) {
addCriterion("REMARKS between", value1, value2, "remarks");
return (Criteria) this;
}
public Criteria andRemarksNotBetween(String value1, String value2) {
addCriterion("REMARKS not between", value1, value2, "remarks");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"1481697102@qq.com"
] | 1481697102@qq.com |
9900873d5b2d1306d6a476b85ec7536261a0bb5f | 08a10e77112a326311fcf128c788b5b66939b9d3 | /webapp/src/main/java/com/chanapp/chanjet/customer/restlet/v2/rest/init/mobile/Test.java | 3bc181e2b697e722ef5cd418f0303221a6b5d8b7 | [] | no_license | curarpikt/HelloWorld | 79ee9d4dd9730bcf1992b51b051e2870d0e2f722 | b66bb900437713821d71af7daaf517bf2f2379cd | refs/heads/master | 2021-01-12T06:42:34.586287 | 2016-12-27T01:40:39 | 2016-12-27T01:40:39 | 77,416,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.chanapp.chanjet.customer.restlet.v2.rest.init.mobile;
import com.chanapp.chanjet.web.restlet.BaseRestlet;
/**
* 测试虚机启动请求
*
* @author tds
*
*/
public class Test extends BaseRestlet {
@Override
public Object run() {
return null;
}
}
| [
"lufane@chanjet.com"
] | lufane@chanjet.com |
74ffee1c65e71abc874dde62fdf47b9cdff97040 | e62a39faf1d80d81e28174ed1c4faef84d76a3ad | /src/main/java/com/amazon/SSOF/ut/SSOFConfigFileNotFoundException.java | b876dad8e3a9b4c6c8c1ccb281736ccf4e245e49 | [] | no_license | zhjdenis/ut | d3e20b7c6cf85799bf74512455e3302beed15f21 | 189f2e695043b685516709e3b947465a21f78840 | refs/heads/master | 2021-03-12T22:25:39.760614 | 2012-09-14T06:42:34 | 2012-09-14T06:42:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.amazon.SSOF.ut;
public class SSOFConfigFileNotFoundException extends Exception {
private String cause;
public SSOFConfigFileNotFoundException(String cause) {
this.cause = cause;
}
}
| [
"hjzhou@CN_PEK_071931.ant.amazon.com"
] | hjzhou@CN_PEK_071931.ant.amazon.com |
850f6fc1dee3eea803d94b52f6354f3c8fb5cfd6 | 39ca0ffd95f31037069929e0d51f1bc54d59dda2 | /785/A/Main.java | bd09cb869720751ad4c7c51713a0d438cadc103a | [] | no_license | Dareten/Codeforces | 80de662d9d439520e52581d7d3ecdf4fb0985d57 | 9929f63ef03d3055f6698a4c8a1a5cf47f8e3ae1 | refs/heads/master | 2021-05-21T22:51:24.453100 | 2020-04-03T22:02:50 | 2020-04-03T22:02:50 | 252,843,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt(), c = 0;
scan.nextLine();
HashMap<String, Integer> map = new HashMap<>();
map.put("Tetrahedron", 4);
map.put("Cube", 6);
map.put("Octahedron", 8);
map.put("Dodecahedron", 12);
map.put("Icosahedron", 20);
for(int i=0;i<n;i++){
c += map.get(scan.nextLine());
}
System.out.println(c);
}
} | [
"daretens@gmail.com"
] | daretens@gmail.com |
4853e20726652b2885a0a459ee2b0239f0774536 | 71a3d8e5b9f912e4d6d8cac480848ad01ee1e2d4 | /DS_assignment-master/Messaging/app/src/main/java/com/DSAssignment/FriendZone/userLogInStuff/otherPlatform.java | a909bfc9acd2cfcc949c5fe1c207c75e5e2661ab | [] | no_license | shenwen2000/arhboy2000 | 119c1f97dac7512f14bfdb495146bb4c8ba7d7a1 | 7225a63469d7a37b801292d3e7ee843f66ca132a | refs/heads/master | 2021-07-22T07:51:11.021460 | 2020-09-04T07:06:04 | 2020-09-04T07:06:04 | 209,832,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package com.DSAssignment.FriendZone.userLogInStuff;
public interface otherPlatform {
public boolean checkAuthentication();
}
| [
"noreply@github.com"
] | noreply@github.com |
52e306307b55da97860a578fc0545719b18278c1 | 9f814f17b1a5fd6a84cf3938b2b6115c3f31e416 | /src/main/java/cn/mangowork/shop/constant/WebConst.java | c840f405e0f9c20abd7b293af72cbd460b0c5209 | [
"Apache-2.0"
] | permissive | mangoWork/shop-backend | e49250d2427b4e114ec7269b7c8a42e4ca7baa64 | 19a1c072b988e8219092e48abff8c8170a18bde0 | refs/heads/master | 2020-04-06T10:18:37.723098 | 2018-11-15T10:20:34 | 2018-11-15T10:20:36 | 157,375,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,206 | java | package cn.mangowork.shop.constant;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Donghua.Chen on 2018/4/29.
*/
@Component
public class WebConst {
/**
* 一些网站配置
*/
public static Map<String, String> initConfig = new HashMap<>();
/**
* session的key
*/
public static String LOGIN_SESSION_KEY = "login_user";
public static final String USER_IN_COOKIE = "S_L_ID";
/**
* aes加密加盐
*/
public static String AES_SALT = "0123456789abcdef";
/**
* 最大获取文章条数
*/
public static final int MAX_POSTS = 9999;
/**
* 最大页码
*/
public static final int MAX_PAGE = 100;
/**
* 文章最多可以输入的文字数
*/
public static final int MAX_TEXT_COUNT = 200000;
/**
* 文章标题最多可以输入的文字个数
*/
public static final int MAX_TITLE_COUNT = 200;
/**
* 点击次数超过多少更新到数据库
*/
public static final int HIT_EXCEED = 10;
/**
* 上传文件最大1M
*/
public static Integer MAX_FILE_SIZE = 1048576;
}
| [
"119229769@qq.com"
] | 119229769@qq.com |
467d6e31b59badd28035d05bf4b33bf9314c95ec | 34878670548580ef6442090a3ca7c166988635d4 | /objectOriented/CompanyList.java | acdbdbb2881ba12090ec46d5679a4c7ad6e888ad | [] | no_license | ShivrajMPujari/bridgeIt | e799c24e0b1008dbb43e2c344a1a448ef099ef2e | 9064ef845cf4cd5102a01c32982019e60ea4df45 | refs/heads/master | 2020-03-09T23:13:24.890998 | 2018-05-22T14:51:02 | 2018-05-22T14:51:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,995 | java |
package com.bridgeIt.objectOriented;
import java.io.FileWriter;
import java.io.IOException;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
public class CompanyList {
CompanyShares head;
CompanyShares next;
Integer totalSharePrice=0;
/**function adds the a particular company to the list
* @param company Company object
*/
void add(CompanyShares company){
if(head==null){
head=company;
totalSharePrice=totalSharePrice+company.shareprice;
return;
}
CompanyShares current=head;
while(current.next!=null){
current=current.next;
}
current.next=company;
totalSharePrice=totalSharePrice+company.shareprice;
}
/**Function removes particular user amount from the account
* @param name company symbol
* @param amount integer amount to be removed
* @return boolean true if user transaction has been done
*/
public boolean remove(String name,Integer amount,String date){
if(search(name)==false){
System.out.println("no such symbol available");
return false;
}
else{
CompanyShares current=head;
if(current.symbol.equals(name)){
if(current.shareprice-amount>0){
current.shareprice=current.shareprice-amount;
current.setDate(date);
return true;
}else{
System.out.println("Transaction can't be done");
return false;
}
}
if(current.next.symbol.equals(name)!=true){
current=current.next;
}
if(current.next.shareprice-amount>0){
current.next.setDate(date);
current.next.shareprice=current.next.shareprice-amount;
return true;
}else{
System.out.println("Transaction can't be done");
return false;
}
}
}
/**
* Function displays the Company list
*/
public void display(){
CompanyShares current=head;
if(current==null){
return;
}
while(current!=null){
System.out.println(current.symbol+" "+current.shareprice+" "+current.date);
current=current.next;
}
}
/**function write to the file of the user
* @param file String name of user file
* @param list CompanyList object
*/
@SuppressWarnings({ "resource", "unchecked" })
public void write(String file,CompanyList list,Integer totalSharePrice){
JSONObject object = new JSONObject();
JSONArray array=null;
try {
FileWriter filewrite= new FileWriter("//home//bridgeit//Downloads//shiv//JavaPrograms//src//com//bridgeIt//files//sharePerson//"+file+".json");
CompanyShares current=head;
if(current==null){
return;
}
while(current!=null){
array =new JSONArray();
System.out.println(current.symbol+" "+current.shareprice+" "+current.date);
array.add(current.symbol);
array.add(current.shareprice);
array.add(current.date);
object.put(current.symbol, array);
current=current.next;
}
object.put("totalSharePrice", totalSharePrice);
filewrite.write(object.toJSONString());
filewrite.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
/**Function searches the particular user from the list
* @param symbol String company symbol
* @return boolean true if user exist
*/
public boolean search(String symbol){
if (head==null){return false;}
CompanyShares current=head;
if(current.symbol.equals(symbol)){
return true;
}
while(current.next.symbol.equals(symbol)==false){
current=current.next;
if(current==null) return false;
}
return true;
}
/**Function adds particular user amount to his account
* @param symbol
* @param amount
*/
public boolean addAmount(String symbol,Integer amount,String date){
if (head==null){
CompanyShares share= new CompanyShares(symbol, amount,date);
head=share;
totalSharePrice=totalSharePrice+amount;
return true;
}
CompanyShares current=head;
CompanyShares previous=null;
while(current.symbol.equals(symbol)==false){
previous=current;
current=current.next;
if(current==null){
CompanyShares share= new CompanyShares(symbol, amount,date);
previous.next=share;
return true;
}
}
current.shareprice=current.shareprice+amount;
totalSharePrice=totalSharePrice+amount;
return true;
}
/*
public JSONObject editPerson(String file){
JSONParser parser = new JSONParser();
JSONObject stocksDetails=null;
try {
Object object=parser.parse(new FileReader("//home//bridgeit//Downloads//shiv//JavaPrograms//src//com//bridgeIt//files//sharePerson//"+file+".json"));
stocksDetails=(JSONObject)object;
} catch (IOException | ParseException e) {
e.printStackTrace();
}
return stocksDetails;
}
@SuppressWarnings("unchecked")
public JSONObject editBuy(JSONObject jsonObject,int amount, String symbol){
JSONArray newArray =new JSONArray();
Object object=jsonObject.get(symbol);
if(object!=null){
JSONArray array =(JSONArray)object;
System.out.println(array);
Long stockprice=(Long)array.get(1);
array.set(1, stockprice+amount);
System.out.println(array);
return jsonObject;
}
newArray.add(0, symbol);
newArray.add(1, amount);
System.out.println("Enter the date");
String date=Utility.inputString();
newArray.add(2,date);
jsonObject.put(symbol, newArray);
return jsonObject;
}
public JSONObject editSell(JSONObject jsonObject,int amount, String symbol){
Object object=jsonObject.get(symbol);
if(object==null){
System.out.println("Your transaction can't be done,Entered wrong symbol");
return jsonObject;
}
JSONArray array =(JSONArray)object;
long shareprice=(long) array.get(1);
if(shareprice-amount>0){
array.set(1, shareprice-amount);
return jsonObject;
}else{
System.out.println("Sorry can't do this transaction,Account out of balance");
return jsonObject;
}
}
public void editPrint(JSONObject jsonObject,String file){
System.out.println(file);
try {
FileWriter filewrite= new FileWriter("//home//bridgeit//Downloads//shiv//JavaPrograms//src//com//bridgeIt//files//sharePerson//"+file+".json");
filewrite.write(jsonObject.toJSONString());
filewrite.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
public void editDisplay(JSONObject jsonObject,String file){
System.out.println(jsonObject.toString());
}*/
class CompanyShares{
Integer shareprice ;
String date;
String symbol;
CompanyShares next;
CompanyShares(){}
CompanyShares(String symbol,Integer shareprice,String date){
this.symbol = symbol;
this.shareprice=shareprice;
this.date=date;
next = null;
}
/**getter method for share price
* @return integer value of share price
*/
public Integer getShareprice() {
return shareprice;
}
/**setter method for share price
*/
public void setShareprice(Integer shareprice) {
this.shareprice = shareprice;
}
/**getter method for date of transaction
* @return String value of date
*/
public String getDate() {
return date;
}
/**setter method to set the of date
* @param date string date
*/
public void setDate(String date) {
this.date = date;
}
/**getter method to get the value company symbol
* @return String value of symbol of company
*/
public String getSymbol() {
return symbol;
}
/**setter method set the value of Company symbol
* @param symbol company symbol
*/
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public CompanyShares getNext() {
return next;
}
public void setNext(CompanyShares next) {
this.next = next;
}
}
public static void main(String[] args) {
CompanyList list= new CompanyList();
CompanyList.CompanyShares comp1=list.new CompanyShares("tata", 1200, "12-4-15");
CompanyShares comp2= list.new CompanyShares("ta", 1200, "18-6-15");
list.add(comp2);
list.add(comp1);
list.display();
}
}
| [
"shivrajpujari62@gmail.com"
] | shivrajpujari62@gmail.com |
b5cf733340a42e3cecf4afc3ad3993ce229e9ba7 | 97aff36124621a00cdbb7b25e87aeb497b759fd2 | /src/T4.java | 1675c236c67535b9831981d5ac175a90670b4638 | [] | no_license | jirenhe/Thread-02 | fddbc552d173444c9be2558a1c47510bba84c8fa | fc325be4fc6891cecb5a68ba50fb4878ad8b4c4f | refs/heads/master | 2020-04-13T01:28:22.706755 | 2018-12-23T08:42:45 | 2018-12-23T08:42:45 | 162,875,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,114 | java | import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class T4 {
public static void main(String[] args) throws InterruptedException {
CDPlayer cdPlayer = new CDPlayer();
cdPlayer.start();
TimeUnit.MICROSECONDS.sleep(10);
cdPlayer.suspend();
TimeUnit.MICROSECONDS.sleep(10);
cdPlayer.resume();
TimeUnit.MICROSECONDS.sleep(10);
cdPlayer.suspend();
TimeUnit.MICROSECONDS.sleep(10);
cdPlayer.stop();
}
public static class CDPlayer implements Runnable {
private volatile int flag = 1;
private final Lock lock = new ReentrantLock();
private final Condition condition = lock.newCondition();
Thread thread = new Thread(this, "CDPlayer-thread");
public void start() {
thread.start();
}
@Override
public void run() {
while (!thread.isInterrupted()) {
lock.lock();
try {
while (flag == 2) {
try {
condition.await();
} catch (InterruptedException e) {
return;
}
}
singing();
} finally {
lock.unlock();
}
}
}
public void stop() {
thread.interrupt();
System.out.println("cdPlayer.stop");
}
public void resume() {
lock.lock();
try {
flag = 1;
condition.signalAll();
} finally {
lock.unlock();
}
System.out.println("cdPlayer.resume");
}
public void suspend() {
flag = 2;
System.out.println("cdPlayer.suspend");
}
private void singing() {
System.out.println("singing.....");
}
}
}
| [
"610009281@qq.com"
] | 610009281@qq.com |
83a6b299a11d62bf08972df3a7d3a5951982dcbc | 0400c6af93c707f4fc64b65ecfd077c1bfa91f6e | /src/com/sis/bib/service/ServiceResponse.java | b9c1085552c0bb87bb28cafa8ca7fea4c06b3eb0 | [] | no_license | blackjav/Sistema_bileoteca | 49219c72cef650ca3f50b2690209071c9e9fb6b9 | 01f84bc6e59fa0ef7a0b1404c022321e73cd4fc1 | refs/heads/master | 2020-06-19T05:43:07.127641 | 2016-12-15T06:29:27 | 2016-12-15T06:29:27 | 74,917,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package com.sis.bib.service;
import java.io.Serializable;
public class ServiceResponse implements Serializable{
/**
*
*/
private static final long serialVersionUID = 2055640693492482190L;
private String mensaje;
private boolean success;
private Object result;
public String getMensaje() {
return mensaje;
}
public void setMensaje(String mensaje) {
this.mensaje = mensaje;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
}
| [
"jav810@hotmail.com"
] | jav810@hotmail.com |
55f4b421e977cdffdc2c41997ccbf7d25b126ab2 | 3d3d5f8808671f4e909f918e91690a125fc7806b | /Employee.java | 57de49726515bf8a6d4d1a4c7652d38acdd5b4c1 | [] | no_license | InbasubethamalarRavi/casestudyassignone | a0f9a15d65a9bdcdd2172b5b3521d3756094502c | 4fcbffe0353a0bdae57a159e7c886273c457a30a | refs/heads/master | 2020-06-04T22:19:19.017197 | 2019-06-17T00:15:12 | 2019-06-17T00:15:12 | 192,213,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,704 | java | package com;
public class Employee {
private String first_name;
private String last_name;
private String company_name;
private String address;
private String city;
private String country;
private String state;
private String zip;
private String phone_num1;
private String phone_num2;
private String e_mail;
private String web_mail;
public Employee1(String first_name, String last_name, String company_name,
String address, String city, String country, String state,
String zip, String phone_num1, String phone_num2, String e_mail,
String web_mail) {
super();
this.first_name = first_name;
this.last_name = last_name;
this.company_name = company_name;
this.address = address;
this.city = city;
this.country = country;
this.state = state;
this.zip = zip;
this.phone_no1 = phone_num1;
this.phone_no2 = phone_num2;
this.e_mail = e_mail;
this.web_mail = web_mail;
}
public String getFirst_name() {
return first_name;
}
public void setFirst_name(String first_name) {
this.first_name = first_name;
}
public String getLast_name() {
return last_name;
}
public void setLast_name(String last_name) {
this.last_name = last_name;
}
public String getCompany_name() {
return company_name;
}
public void setCompany_name(String company_name) {
this.company_name = company_name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getPhone_num1() {
return phone_num1;
}
public void setPhone_num1(String phone_num1) {
this.phone_num1 = phone_num1;
}
public String getPhone_num2() {
return phone_num2;
}
public void setPhone_num2(String phone_num2) {
this.phone_num2 = phone_num2;
}
public String getE_mail() {
return e_mail;
}
public void setE_mail(String e_mail) {
this.e_mail = e_mail;
}
public String getWeb_mail() {
return web_mail;
}
public void setWeb_mail(String web_mail) {
this.web_mail = web_mail;
// TODO Auto-generated method stub
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c855194acdf7acd9f086a37df2bf956dd62c2173 | 0a61cb6d84525930a44a88c0ea5624222477b14f | /src/Node.java | ef2f50927dff855b490146c37ebd5891de6f22ad | [] | no_license | Wwriter22/Stack | cd8426026407e9f44e4cd7f9e40c9548741cc3fb | 5e43e0130dd20e3c27b68d30d791aba3a20bcdf9 | refs/heads/main | 2023-08-30T08:21:51.163858 | 2021-11-17T06:29:39 | 2021-11-17T06:29:39 | 425,991,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,406 | java | import java.util.Objects;
public class Node<T> {
private T data;
private Node<T> prev;
private Node<T> next;
public Node(){
prev = null;
next = null;
}
public Node(T Data){
this.data =Data;
}
public Node(T data, Node<T> prev, Node<T> next){
this.data = data;
this.prev = prev;
this.next = next;
}
public T get_data(){
return data;
}
public Node<T> getPrev(){
return prev;
}
public Node<T> getNext(){
return next;
}
public T set_data(T data){
return this.data = data;
}
public Node<T> set_prev(Node<T> prev){
return this.prev = prev;
}
public Node<T> set_next(Node<T> next){
return this.next = next;
}
public String toString(){
return "Node: "+ data;
}
@Override // Inteli J did this for me, but it is overriding the .equals method
public boolean equals(Object o) {
if (this == o) return true; // if they have the same memory location
if (o == null || getClass() != o.getClass()) return false;
Node<?> node = (Node<?>) o;
return Objects.equals(data, node.data) &&
Objects.equals(prev, node.prev) &&
Objects.equals(next, node.next);
}
@Override
public int hashCode() {
return Objects.hash(data, prev, next);
}
}
| [
"williamwriter@Williams-MacBook-Pro-2.local"
] | williamwriter@Williams-MacBook-Pro-2.local |
b8e7e94296547fe9ed0f21cd4837a31b3bc5b91f | 9e69f06b61c5c99061568ed27904f88528ca8f88 | /src/com/tgt/snake/ladder/Navigator.java | 749fb527039f0541270e32f6c138a41fb8d8a893 | [] | no_license | krsnadas/fungames | 07815e31dad28d05863815dd9095051bd0b346e2 | 178ee4b0d5092f89a1794f1a7565b1b4ca0c4c10 | refs/heads/master | 2021-01-21T10:22:08.185223 | 2017-09-01T05:55:46 | 2017-09-01T05:55:46 | 101,979,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,390 | java | package com.tgt.snake.ladder;
public class Navigator {
/**
* Navigate as per dice outcome and board rules. Returns the board state which follows the FSD.
* @param move
* @param boardState
* @return
* @throws AppException
*/
public BoardState navigate(PlayerMove move,BoardState boardState) throws AppException{
Player player = move.getPlayer();
/**
* dice outcome history
*/
boardState.getMoveHistory().get(player.getId()).push(move.getDice());
/**
* only when energy level is greater than zero
*/
if (player.getEnergyLevel()>0){
Position currentPos = player.getCurrentPos();
int result = currentPos.getPosition()+move.getDice();
int finalResult = (Math.min(Math.max(result, 1), currentPos.getSqrNum()*currentPos.getSqrNum()));
Position resPos = boardState.getPositionStates().stream().filter(p->p.getPosition()==finalResult).findFirst().get();
Integer finalPosVal = processPositionAndPlayer
(resPos,player,move.getDice(), boardState);
Position finalPos = boardState.getPositionStates().stream().filter(p->p.getPosition()==finalPosVal).findFirst().get();
player.setCurrentPos(finalPos);
/**
* player - position history
*/
player.addToPositionStack(finalPos.getPosition());
}
else {
Position initialPos = boardState.getPositionStates().stream().filter(p->p.getPosition()==1).findFirst().get();
player.setCurrentPos(initialPos);
player.setEnergyLevel((initialPos.getSqrNum()*initialPos.getSqrNum())/3);
/**
* player - position history
*/
player.addToPositionStack(initialPos.getPosition());
}
return boardState;
}
/**
* Process the player and position based on board rules following the dice outcome.
* @param position
* @param player
* @param dice
* @param boardState
* @return
*/
private Integer processPositionAndPlayer(Position position, Player player, Integer dice, BoardState boardState){
int result = -1;
ConstructExecutor conExecutor = new ConstructExecutor();
if (position.getIsMagicSqr()){
boolean toggle = !player.getIsMagicTricked();
player.setIsMagicTricked(toggle);
}
if (position.getIsPitStop()){
Integer energyLevel = player.getEnergyLevel()+position.getEnergyBoost();
player.setEnergyLevel(energyLevel);
}
if (position.getIsMemory()){
result = conExecutor.executeMemory(position, player, boardState);
}
if (null!=position.getConstruct()){
if (ConstructType.ELEVATOR.equals(position.getConstruct().getType())){
result = conExecutor.executeElevator(position, player, dice);
}
else if (ConstructType.TRAMP.equals(position.getConstruct().getType())){
result = conExecutor.executeTramp(position, player, dice);
}
else if (ConstructType.LADDER.equals(position.getConstruct().getType())){
result = conExecutor.executeLadder(position, player, boardState);
}
else if ((ConstructType.SNAKE.equals(position.getConstruct().getType()))){
result = conExecutor.executeSnake(position, player, boardState);
}
}
player.decrementEnergy();
if (-1 == result){
return (Math.min(Math.max(position.getPosition(), 1), position.getSqrNum()*position.getSqrNum()));
}
else {
return (Math.min(Math.max(result, 1), position.getSqrNum()*position.getSqrNum()));
}
}
} | [
"apple@Apples-MacBook-Pro.local"
] | apple@Apples-MacBook-Pro.local |
d9a0d73495bcf83615190fef011cd40227d2cbc2 | 129f58086770fc74c171e9c1edfd63b4257210f3 | /src/testcases/CWE89_SQL_Injection/CWE89_SQL_Injection__getCookies_Servlet_executeQuery_16.java | ba0254704b47ea199a1b8a6aaafde3b591c23f3b | [] | no_license | glopezGitHub/Android23 | 1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba | 6215d0684c4fbdc7217ccfbedfccfca69824cc5e | refs/heads/master | 2023-03-07T15:14:59.447795 | 2023-02-06T13:59:49 | 2023-02-06T13:59:49 | 6,856,387 | 0 | 3 | null | 2023-02-06T18:38:17 | 2012-11-25T22:04:23 | Java | UTF-8 | Java | false | false | 17,137 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE89_SQL_Injection__getCookies_Servlet_executeQuery_16.java
Label Definition File: CWE89_SQL_Injection.label.xml
Template File: sources-sinks-16.tmpl.java
*/
/*
* @description
* CWE: 89 SQL Injection
* BadSource: getCookies_Servlet Read data from the first cookie using getCookies()
* GoodSource: A hardcoded string
* Sinks: executeQuery
* GoodSink: Use prepared statement and executeQuery (properly)
* BadSink : data concatenated into SQL statment used in executeQuery(), which could result in SQL Injection
* Flow Variant: 16 Control flow: while(true) and while(local_f)
*
* */
package testcases.CWE89_SQL_Injection;
import testcasesupport.*;
import java.sql.*;
import javax.servlet.http.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.*;
public class CWE89_SQL_Injection__getCookies_Servlet_executeQuery_16 extends AbstractTestCaseServlet
{
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
boolean local_f = false; /* This local variable is used becuase the
Java compiler will generate an error on while(false) and similar
constructs that evaluate to false. This is the simplest construct
that will always be false and still compile. */
while(local_f)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
/* FIX: Use a hardcoded string */
data = "foo";
break;
}
while(true)
{
data = ""; /* initialize data in case there are no cookies */
/* Read data from cookies */
{
Cookie cookieSources[] = request.getCookies();
if (cookieSources != null)
{
/* POTENTIAL FLAW: Read data from the first cookie value */
data = cookieSources[0].getValue();
}
}
break;
}
while(true)
{
Connection conn_tmp2 = null;
Statement sqlstatement = null;
ResultSet sqlrs = null;
try
{
conn_tmp2 = IO.getDBConnection();
sqlstatement = conn_tmp2.createStatement();
/* POTENTIAL FLAW: data concatenated into SQL statment used in executeQuery(), which could result in SQL Injection */
sqlrs = sqlstatement.executeQuery("select * from users where name='"+data+"'");
IO.writeLine(sqlrs.getRow()); /* Use ResultSet in some way */
}
catch( SQLException se )
{
IO.logger.log(Level.WARNING, "Error getting database connection", se);
}
finally
{
try {
if( sqlrs != null )
{
sqlrs.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", e);
}
finally {
try {
if( sqlstatement != null )
{
sqlstatement.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Statement", e);
}
finally {
try {
if( conn_tmp2 != null )
{
conn_tmp2.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Connection", e);
}
}
}
}
break;
}
while(local_f)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
Connection conn_tmp2 = null;
PreparedStatement sqlstatement = null;
ResultSet sqlrs = null;
try
{
/* FIX: Use prepared statement and executeQuery (properly) */
conn_tmp2 = IO.getDBConnection();
sqlstatement = conn_tmp2.prepareStatement("select * from users where name=?");
sqlstatement.setString(1, data);
sqlrs = sqlstatement.executeQuery();
IO.writeLine(sqlrs.getRow()); /* Use ResultSet in some way */
}
catch( SQLException se )
{
IO.logger.log(Level.WARNING, "Error getting database connection", se);
}
finally
{
try {
if( sqlrs != null )
{
sqlrs.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", e);
}
finally {
try {
if( sqlstatement != null )
{
sqlstatement.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing PreparedStatment", e);
}
finally {
try {
if( conn_tmp2 != null )
{
conn_tmp2.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Connection", e);
}
}
}
}
break;
}
}
/* goodG2B() - use goodsource and badsink by changing the conditions on the first and second while statements */
private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
boolean local_f = false;
while(true)
{
/* FIX: Use a hardcoded string */
data = "foo";
break;
}
while(local_f)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
data = ""; /* initialize data in case there are no cookies */
/* Read data from cookies */
{
Cookie cookieSources[] = request.getCookies();
if (cookieSources != null)
{
/* POTENTIAL FLAW: Read data from the first cookie value */
data = cookieSources[0].getValue();
}
}
break;
}
while(true)
{
Connection conn_tmp2 = null;
Statement sqlstatement = null;
ResultSet sqlrs = null;
try
{
conn_tmp2 = IO.getDBConnection();
sqlstatement = conn_tmp2.createStatement();
/* POTENTIAL FLAW: data concatenated into SQL statment used in executeQuery(), which could result in SQL Injection */
sqlrs = sqlstatement.executeQuery("select * from users where name='"+data+"'");
IO.writeLine(sqlrs.getRow()); /* Use ResultSet in some way */
}
catch( SQLException se )
{
IO.logger.log(Level.WARNING, "Error getting database connection", se);
}
finally
{
try {
if( sqlrs != null )
{
sqlrs.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", e);
}
finally {
try {
if( sqlstatement != null )
{
sqlstatement.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Statement", e);
}
finally {
try {
if( conn_tmp2 != null )
{
conn_tmp2.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Connection", e);
}
}
}
}
break;
}
while(local_f)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
Connection conn_tmp2 = null;
PreparedStatement sqlstatement = null;
ResultSet sqlrs = null;
try
{
/* FIX: Use prepared statement and executeQuery (properly) */
conn_tmp2 = IO.getDBConnection();
sqlstatement = conn_tmp2.prepareStatement("select * from users where name=?");
sqlstatement.setString(1, data);
sqlrs = sqlstatement.executeQuery();
IO.writeLine(sqlrs.getRow()); /* Use ResultSet in some way */
}
catch( SQLException se )
{
IO.logger.log(Level.WARNING, "Error getting database connection", se);
}
finally
{
try {
if( sqlrs != null )
{
sqlrs.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", e);
}
finally {
try {
if( sqlstatement != null )
{
sqlstatement.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing PreparedStatment", e);
}
finally {
try {
if( conn_tmp2 != null )
{
conn_tmp2.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Connection", e);
}
}
}
}
break;
}
}
/* goodB2G() - use badsource and goodsink by changing the conditions on the third and fourth while statements */
private void goodB2G(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
String data;
boolean local_f = false;
while(local_f)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
/* FIX: Use a hardcoded string */
data = "foo";
break;
}
while(true)
{
data = ""; /* initialize data in case there are no cookies */
/* Read data from cookies */
{
Cookie cookieSources[] = request.getCookies();
if (cookieSources != null)
{
/* POTENTIAL FLAW: Read data from the first cookie value */
data = cookieSources[0].getValue();
}
}
break;
}
while(local_f)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
Connection conn_tmp2 = null;
Statement sqlstatement = null;
ResultSet sqlrs = null;
try
{
conn_tmp2 = IO.getDBConnection();
sqlstatement = conn_tmp2.createStatement();
/* POTENTIAL FLAW: data concatenated into SQL statment used in executeQuery(), which could result in SQL Injection */
sqlrs = sqlstatement.executeQuery("select * from users where name='"+data+"'");
IO.writeLine(sqlrs.getRow()); /* Use ResultSet in some way */
}
catch( SQLException se )
{
IO.logger.log(Level.WARNING, "Error getting database connection", se);
}
finally
{
try {
if( sqlrs != null )
{
sqlrs.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", e);
}
finally {
try {
if( sqlstatement != null )
{
sqlstatement.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Statement", e);
}
finally {
try {
if( conn_tmp2 != null )
{
conn_tmp2.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Connection", e);
}
}
}
}
break;
}
while(true)
{
Connection conn_tmp2 = null;
PreparedStatement sqlstatement = null;
ResultSet sqlrs = null;
try
{
/* FIX: Use prepared statement and executeQuery (properly) */
conn_tmp2 = IO.getDBConnection();
sqlstatement = conn_tmp2.prepareStatement("select * from users where name=?");
sqlstatement.setString(1, data);
sqlrs = sqlstatement.executeQuery();
IO.writeLine(sqlrs.getRow()); /* Use ResultSet in some way */
}
catch( SQLException se )
{
IO.logger.log(Level.WARNING, "Error getting database connection", se);
}
finally
{
try {
if( sqlrs != null )
{
sqlrs.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing ResultSet", e);
}
finally {
try {
if( sqlstatement != null )
{
sqlstatement.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing PreparedStatment", e);
}
finally {
try {
if( conn_tmp2 != null )
{
conn_tmp2.close();
}
}
catch( SQLException e )
{
IO.logger.log(Level.WARNING, "Error closing Connection", e);
}
}
}
}
break;
}
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B(request, response);
goodB2G(request, response);
}
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"guillermo.pando@gmail.com"
] | guillermo.pando@gmail.com |
6af93721d101a27187ed4c5e34a4db9bb007a59e | 68858df22fcb7522e416d537ca808d278e58f31c | /springboot-mybatis-study/src/main/java/club/mymmm/springbootmybatisstudy/controller/admin/UserController.java | 68967cf716c1d27f5e59a2c02c1520c0f06d219e | [] | no_license | ACCCG/SpringBoot_study | 235565387024b563d4ddf3a7abdb839a8003ece4 | 9db245232cdeff979392d7eb870086ddcfbfef44 | refs/heads/master | 2020-04-29T16:23:41.285229 | 2019-04-26T05:55:22 | 2019-04-26T05:55:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package club.mymmm.springbootmybatisstudy.controller.admin;
import club.mymmm.springbootmybatisstudy.entity.User;
import club.mymmm.springbootmybatisstudy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@RestController
public class UserController {
@Autowired
private UserService userService;
@RequestMapping("/displayAllData")
public List<User> displayAllData() {
return userService.findAll();
}
@RequestMapping("/findByIds")
public List<User> findByIds(HttpServletRequest request) {
return userService.findById(Integer.valueOf(request.getParameter("id")));
}
@RequestMapping("/addUser")
public void addUser(HttpServletRequest request) {
userService.create(new User(request.getParameter("email"),
request.getParameter("name"),
request.getParameter("password")));
}
@RequestMapping("/delete")
public void delete(HttpServletRequest request) {
userService.delete(Integer.valueOf(request.getParameter("id")));
}
@RequestMapping("/update")
public void update(HttpServletRequest request) {
userService.update(new User(request.getParameter("email"),
request.getParameter("name"),
request.getParameter("password")));
}
}
| [
"muyoumumumu@gmail.com"
] | muyoumumumu@gmail.com |
70ecf382a4e05b3590580b46a13d95faf3df8c7b | f27520a64516a6742260c9e88d5a2d54882b9721 | /components/org.wso2.identity.apps.common/src/main/java/org/wso2/identity/apps/common/util/AppPortalConstants.java | 30ea83687d6b30dc582ce006d34a55eb626069f3 | [
"Apache-2.0"
] | permissive | hasinidilanka/identity-apps | a196be4ecb0c93bf62adcb9b9b74bd0836f9cf48 | 9a42e7270ab8e47342a37a1c1a1c778da03b63da | refs/heads/master | 2020-09-20T05:09:28.714792 | 2019-11-27T08:32:15 | 2019-11-27T08:32:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,112 | java | /*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.identity.apps.common.util;
/**
* This class holds the constants related to app portal.
*/
public class AppPortalConstants {
public static final String INBOUND_AUTH2_TYPE = "oauth2";
public static final String EMAIL_CLAIM_URI = "http://wso2.org/claims/emailaddress";
public static final String DISPLAY_NAME_CLAIM_URI = "http://wso2.org/claims/displayName";
public static final String TOKEN_BINDING_TYPE = "cookie";
private AppPortalConstants() {
}
/**
* Data required for the initialisation of app portals.
*/
public enum AppPortal {
USER_PORTAL("USER_PORTAL", "This is the user portal application.", "USER_PORTAL", "/user-portal/login");
private final String name;
private final String description;
private final String consumerKey;
private final String path;
AppPortal(String name, String description, String consumerKey, String path) {
this.name = name;
this.description = description;
this.consumerKey = consumerKey;
this.path = path;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public String getConsumerKey() {
return consumerKey;
}
public String getPath() {
return path;
}
}
}
| [
"thanuja@wso2.com"
] | thanuja@wso2.com |
4632501f47ea8397d646dc3224882d0239a24807 | 0c7f0c61b497d139f95f778dd42d145787a53da8 | /src/p18io/p03lecture/p07network/Ex03ClientDownloadFile.java | c1f6b06a511e0d648ac2a1c717d8c9c5a4b28c47 | [] | no_license | HaejinYoon/java20210901 | 9900435378ff408eb51d99a3d9ad494e2fcccb3f | 7404b99e4f0db14f19350fe5785b2874db6124b7 | refs/heads/master | 2023-08-27T22:12:25.697876 | 2021-10-05T00:13:57 | 2021-10-05T00:13:57 | 401,895,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | package p18io.p03lecture.p07network;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
public class Ex03ClientDownloadFile {
public static void main(String[] args) throws Exception{
Socket socket = new Socket();
System.out.println("Connection try+++++++");
socket.connect(new InetSocketAddress("192.168.35.135", 33333));
System.out.println("Connection success+++");
//socket InputStream
//file OutputStream
OutputStream os = new FileOutputStream("C:\\Users\\Haejin\\Desktop\\iotest\\서버.jpg");
BufferedOutputStream bos = new BufferedOutputStream(os);
InputStream is = socket.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
System.out.println("File download starts++++");
int data =0;
while ((data=bis.read())!=-1) {
bos.write(data);
}
System.out.println("File download completed+");
bis.close();
bos.close();
socket.close();
}
}
| [
"hjyoomp@gmail.com"
] | hjyoomp@gmail.com |
31c3e861993ab7cce9d10340d7403727dcdb4915 | da7455d54e19b56bdd3853718aa04c8c84fe32e9 | /example/src/com/example/controller/JoinSuccessController.java | b6f27972ab9b1202b8d3248ac66edd7f97e654f8 | [] | no_license | asddq123456/study_source | 5ee356ee2f5811060a8e728a63b76d178237fef7 | 5158d16dfd4bd95bdaaa66ff2d3e1d70b5790c45 | refs/heads/master | 2021-05-05T02:50:16.202924 | 2020-06-01T08:11:22 | 2020-06-01T08:11:22 | 119,785,594 | 0 | 0 | null | 2018-02-01T05:05:39 | 2018-02-01T05:05:38 | null | UTF-8 | Java | false | false | 622 | java | package com.example.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/member/joinSuccess")
public class JoinSuccessController extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String url="/chap12/joinSuccess.jsp";
request.getRequestDispatcher(url).forward(request, response);
}
}
| [
"big-09@big-00-PC"
] | big-09@big-00-PC |
a6d7aef7fbbf49494aefe015f8e0f140826637e4 | bd1dd3ea37b3a6d5a21776656da0a662fd936171 | /src/ast/IdNode.java | d44bbcf0f54f3bda631219f605c6332f5f964a3d | [] | no_license | Rhuax/FOOL | 3fab6b422b2f83a37e684d770edd11b9382d8dc4 | 988d37018c0537b4f5646a1db8f6316a4688295c | refs/heads/master | 2021-03-16T10:28:53.021625 | 2017-07-11T12:39:13 | 2017-07-11T12:39:13 | 93,610,556 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,546 | java | package ast;
import util.Environment;
import util.MapClassNestLevel;
import util.SemanticError;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Objects;
import static java.lang.StrictMath.abs;
public class IdNode implements Node {
private String id;
boolean isAttribute = false;
public STentry getEntry() {
return entry;
}
private STentry entry;
private int nestinglevel;
public IdNode(String i) {
id = i;
}
public String toPrint(String s) {
return s + "Id:" + id + " at nestlev " + nestinglevel + "\n" + entry.toPrint(s + " ");
}
@Override
public ArrayList<SemanticError> checkSemantics(Environment env) {
//create result list
ArrayList<SemanticError> res = new ArrayList<SemanticError>();
ClassNode CurAnalyzedClass = MapClassNestLevel.getCurrentAnalyzedClass();
if (CurAnalyzedClass == null) {
int j = env.nestingLevel;
STentry tmp = null;
while (j >= 0 && tmp == null)
tmp = (env.symTable.get(j--)).get(id);
if (tmp == null)
res.add(new SemanticError("Id " + id + " not declared"));
else {
entry = tmp;
nestinglevel = env.nestingLevel;
}
} else {
int j = env.nestingLevel;
STentry temp = (env.symTable.get(j)).get(id);
while (temp == null && j >= MapClassNestLevel.getNestingLevelFromClass(MapClassNestLevel.getCurrentAnalyzedClass().getId())) {
temp = (env.symTable.get(j)).get(id);
if (temp == null)
j--;
}
boolean should = true;
while (temp == null && should) {
ClassNode inheritedClassNode = CurAnalyzedClass.getExtendedClass();
if (inheritedClassNode != null) {
String classInheritedName = inheritedClassNode.getId();
int nestingLevel = MapClassNestLevel.getNestingLevelFromClass(classInheritedName);
HashMap<String, STentry> t = env.symTable.get(nestingLevel);
temp = (t.get(id));
} else
should = false;
CurAnalyzedClass = inheritedClassNode;
}
if (temp == null || !should)
res.add(new SemanticError("Id " + id + " not declared in class " + MapClassNestLevel.getCurrentAnalyzedClass().getId()));
else {
entry = temp;
nestinglevel = env.nestingLevel;
int n = MapClassNestLevel.getNestingLevelFromClass(MapClassNestLevel.getCurrentAnalyzedClass().getId());
if (nestinglevel == n)
isAttribute = true;
else if (j <= n) {
ClassNode current = MapClassNestLevel.getCurrentAnalyzedClass();
for (VardecNode att : current.getTotalAttributes()) {
if (Objects.equals(att.getId(), this.id))
isAttribute = true;
}
}
}
}
return res;
}
public Node typeCheck() {
if (entry.getType() instanceof ArrowTypeNode) { //
System.out.println("Wrong usage of function identifier");
System.exit(0);
}
return entry.getType();
}
public String codeGeneration() {
String getAR = "";
//System.out.println(this.id+" sottrazione "+(nestinglevel-entry.getNestinglevel()));
if (MapClassNestLevel.getCurrentAnalyzedClass() == null)
for (int i = 0; i < nestinglevel - entry.getNestinglevel(); i++)
getAR += "lw\n";
String code = "";
if (isAttribute) {
code += "lfp\n" +
"push -1\n" +
"add\n" +
"lw\n" +
"push " + abs(this.getEntry().getOffset()) + "\n" +
"add\n" +
"lw\n";
} else {
code += "push " + entry.getOffset() + "\n" + //metto offset sullo stack
"lfp\n" + getAR + //risalgo la catena statica
"add\n" +
"lw\n"; //carico sullo stack il valore all'indirizzo ottenuto
}
return code;
}
} | [
"gelidcrow@gmail.com"
] | gelidcrow@gmail.com |
85646b2413ede5ddbb5385a27e0d722e4e49c66b | bd8b4e08ea4648b8eb919748644fa35d54c6c7b3 | /app/src/test/java/com/ivpomazkov/nerdlauncher/ExampleUnitTest.java | d7f6c467c774e26e9ea4125f49cc0bb96446a2d9 | [] | no_license | IgnatP/NerdLauncher | 18e249db5ff80f4da83889c4d06f10ec90f15a30 | f277b42e6d5724bef35781cc5fad012aff36a049 | refs/heads/master | 2021-01-01T03:43:10.457570 | 2016-05-19T12:41:19 | 2016-05-19T12:41:19 | 59,205,150 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.ivpomazkov.nerdlauncher;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"ipomazkov@icloud.com"
] | ipomazkov@icloud.com |
e26e2368fcea6f9548702eef7f39e180db708766 | 5f64135ea2b822c5ad2e203ef806c4ac4273f182 | /trunk_01/app/src/main/java/com/hbbc/util/HttpUtil.java | dec97bbfbd6a7d76bec2d3718c04d72e650b2985 | [] | no_license | snamper/sanbanxiguaUser | c3c3b459b390d859fa9af19ba5c19dccf53bffc8 | d4b6dc4ec9c8b77d270ac42dbf2e20f847761af8 | refs/heads/master | 2020-05-03T10:58:43.434773 | 2018-05-24T11:28:56 | 2018-05-24T11:28:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,546 | java | package com.hbbc.util;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;
import com.google.gson.Gson;
import com.hbbc.R;
import com.orhanobut.logger.Logger;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* 网络请求工具类,eg:new HttpUtil().callJson();
*/
public class HttpUtil {
private boolean callJson_isComplete; // 下载是否完成;
private int callJson_time = 2; // 用于计时,默认2秒;
private boolean callJson_isOpen = true; // 用于控制是否开启dialog,默认开启;
private int callJson_what = -1; //用于控制handler返回消息的区分,默认-1;
/**
* Result字段返回值
*/
private boolean isResultTrue(String text) {
try {
JSONObject jsonObject = new JSONObject(text);
if (jsonObject.has("Result") && jsonObject.getBoolean("Result")) {
return true;
} else {
return false;
}
} catch (JSONException e) {
return false;
}
}
/**
* 服务器异常
*/
private String getNotice(String text) {
//改成网络异常
String data = "网络异常,请稍后再试";
try {
JSONObject jsonObject = new JSONObject(text);
if (jsonObject.has("Notice"))
data = jsonObject.getString("Notice");
} catch (JSONException e) {
LogUtil.exception(e);
}
return data;
}
/**
* 调用时要在callJson前面调用,否则无用.在callJson里面会把值置会默认值,如果有需要,下次还要调用
*/
public void setDialogIsShow(boolean open, int times) {
callJson_isOpen = open;
callJson_time = times;
}
/**
* 显示对话框,设置是否在callJson之前调用
*/
public void setDialogIsShow(boolean open) {
setDialogIsShow(open, callJson_time);
}
/**
* 显示对话框,设置时长,默认为2秒
*/
public void setDialogIsShow(int times) {
setDialogIsShow(callJson_isOpen, times);
}
/**
* @param handler 进行子线程与UI线程进行传递消息
* @param context 上下文
* @param url 网络地址
* @param object Class文件
* @param strUrl String类型的数组上传时所用 前一个为字段名,紧跟着为数据,依次类推
*/
public void callJson(final Handler handler, final Context context,
final String url, final Class<?> object, final String... strUrl) {
//判断是否有网络
if (!isNetworkAvailable(context)) {
setWifiAlertDialog(context);
return;
}
callJson_isComplete = false;
// 用于计时作用
new Thread(new Runnable() {
@Override
public void run() {
int i = 0;
while (i < callJson_time) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (!callJson_isComplete && callJson_isOpen) {
handler.post(new Runnable() {
public void run() {
}
});
}
callJson_isOpen = true;
callJson_time = 2;
}
}).start();
// 用于下载数据
new Thread(new Runnable() {
@Override
public void run() {
try {
//把穿入的strUrl封装成JSON串
JSONObject ClickKey = new JSONObject();
for (int i = 0, N = strUrl.length; i < N; i += 2) {
if (i + 1 > N) {
ClickKey.put(strUrl[i], null);
} else {
ClickKey.put(strUrl[i], strUrl[i + 1]);
}
}
//向服务器端获取得到的数据
final String json = getJsonData(context, url, ClickKey);
Log.d("json:", json);
if (json.startsWith("Error")) {
showText(handler, context, json);
return;
}
callJson_isComplete = true;
Message msg = new Message();
handler.post(new Runnable() {
@Override
public void run() {
//loadingDialog.dismiss();
}
});
msg.what = callJson_what;
if (object == null) {
msg.obj = json;
} else {
Object obj = new Gson().fromJson(json, object);
msg.obj = obj;
}
LogUtil.debug(msg.obj.toString());
Logger.i(msg.obj.toString());
//将result和callJson_what恢复成默认值
callJson_what = -1;
handler.sendMessage(msg);//通过handler发送消息,携带json数据(如果存在object则返回object类型,否则返回值为String类型)
} catch (Exception e) {
LogUtil.exception(e);
}
}
}).start();
}
/**
* 返回数据时,显示Toast
*/
private void showText(Handler handler, final Context context, final String text) {
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
}
});
}
/**
* 从服务器端请求数据,无object形式
* 请求成功返回String
*/
public void callJson(Handler handler, Context context, String url,
String... strUrl) {
callJson_what = -1;
callJson(handler, context, url, null, strUrl);
}
/**
* 多次请求用what分辨返回String
*/
public void callJson(Handler handler, int mWhat, Context context,
String url, String... strUrl) {
callJson_what = mWhat;
callJson(handler, context, url, null, strUrl);
}
/**
* 多次请求用what分辨 返回类对象(object)
*/
public void callJson(Handler handler, int mWhat, Context context,
String url, Class<?> obj, String... strUrl) {
callJson_what = mWhat;
callJson(handler, context, url, obj, strUrl);
}
/**
* 检查联网情况(手机是否正常联网)。 eg:isNetworkAvailable(context);
*/
public boolean isNetworkAvailable(Context context) {
ConnectivityManager mgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] info = mgr.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
return false;
}
/**
* 从服务器请求JSON数据,放回String类型jsonback数据
*
* @param context
* @param strUrl 网络访问地址
* @param obj 向服务器端发送的请求数据
* @return jsonback为服务器端返回的数据
*/
public String getJsonData(Context context, String strUrl,
JSONObject obj) {
String jsonback = "";
if (!isNetworkAvailable(context)) {
LogUtil.debug("out-------->positon==0");
jsonback = "Error:网络异常,请稍后再试";
((BaseActivity) context).outputShort(jsonback);
} else {
try {
LogUtil.debug("out-------->positon==1.5");
URL url = new URL(strUrl);
LogUtil.debug("enter------>strUrl:" + strUrl);
// 开始封装JSON数据
String content = String.valueOf(obj);// 把JSON数据转换成String类型,使用输出流向服务器写
// 传输数据
HttpURLConnection urlConn = (HttpURLConnection) url
.openConnection();
urlConn.setConnectTimeout(5000);
urlConn.setDoInput(true); // 设置输入流采用字节流
urlConn.setDoOutput(true);// 设置输出流采用字节流
urlConn.setRequestMethod("POST");
urlConn.setUseCaches(false);
urlConn.setRequestProperty("ser-Agent", "Fiddler");
urlConn.setRequestProperty("Content-Type", "application/json");
urlConn.connect();// 连接既往服务端发送信息
OutputStream os = urlConn.getOutputStream();
os.write(content.getBytes());
os.close();
int code = urlConn.getResponseCode();//返回码
if (code == 200) {
InputStream is = urlConn.getInputStream();
int contentLength = urlConn.getContentLength();
LogUtil.debug("out------------->contentLength" + contentLength);
String TAG = "detail";
Log.e(TAG, "getJsonData: contentlength=" + contentLength);
// 以上是没有问题的!
String json = readString(is);
Log.e("detail", "getJsonData: json=" + json);
jsonback = json;
LogUtil.exception("json数据:" + json);
// 设置请求头
} else {
//改成网络异常
LogUtil.debug("out-------->positon==1");
jsonback = "Error:网络异常,请稍后再试";
}
} catch (Exception e) {
e.printStackTrace();
LogUtil.exception(e);
LogUtil.debug("out-------->positon==2");
jsonback = "Error:网络异常,请稍后再试";
}
}
Logger.d("out--------->jsondata" + jsonback);
Logger.d("out==------->jsonback");
return jsonback;
}
/**
* 输入流的字节转化byte数组
*/
public byte[] readBytes(InputStream is) {
try {
byte[] buffer = new byte[1024];//原来写的是1024
int len;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((len = is.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
return baos.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 将字节转换为字符
*/
public String readString(InputStream is) {
byte[] bytes = readBytes(is);
Log.d("detail", "readString: bytes=====" + bytes);
String s = new String(bytes);
return s;
}
/**
* 无网络时跳转到设置网络页面
*/
public void setWifiAlertDialog(final Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("" + context.getResources().getString(R.string.app_name));
builder.setMessage("网络不可用,请设置网络!");
builder.setPositiveButton("设置", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = null;
/**
* 判断手机系统的版本!如果API大于10 就是3.0+
* 因为3.0以上的版本的设置和3.0以下的设置不一样,调用的方法不同
*/
if (android.os.Build.VERSION.SDK_INT > 10) {
intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
} else {
intent = new Intent();
ComponentName component = new ComponentName(
"com.android.settings",
"com.android.settings.WirelessSettings");
intent.setComponent(component);
intent.setAction("android.intent.action.VIEW");
}
context.startActivity(intent);
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
builder.create();
builder.show();
}
}
| [
"1354848107@qq.com"
] | 1354848107@qq.com |
f1624600eefcaac061a7936a2c2353e6e15ba314 | 39e64b2ec0afdf297dcfa91c3254e154938dfc76 | /MethodOverloading.java | 0597e7be3a7cc8bfbd0fddf15acfdb7808bd6503 | [] | no_license | Mamun-Al-Babu-Shikder/Java-OOPs-Programming | 3c6b052e153fb70bbfd61e150718ae02efa00aec | 5239bcf55cc0dc78c4e42f4587e315a1883d0d5a | refs/heads/master | 2020-08-06T16:02:41.864143 | 2019-10-15T07:57:15 | 2019-10-15T07:57:15 | 213,067,165 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,757 | java | public class MethodOverloading {
public static void main(String[] args)
{
MethodOverloading obj = new MethodOverloading();
/*
* 'L' or 'l' for long type specifier
* 'F' or 'f' for float type specifier
* 'D' or 'd' for double type specifier
*/
obj.add(1, 2, 3); // This will call the 01 no. method.
obj.add(1, 2, 3, 4); // This will be call the 02 no. method
/*
* Here 1 & 2 can be int or long type but we don't specify them
* so by default it will call method no. 03
*/
obj.add(1, 2);
/*
* Here we specify the value type with suffix 'L'
* hence it call the method no. 04
*/
obj.add(1L, 2L);
/*
* Here 1.45 and 2.56 can be float or double type but don't specify them
* So by default it will call the method no. 06 which parameter is double type
*/
obj.add(1.45, 2.56);
/*
* Here we specify 42.45f and 25.55 with suffix 'f'
* hence it will call method no. 05 which parameter is float type
*/
obj.add(42.45f, 25.55f);
/*
* Type Promotion :
* byte -> short -> int
* int -> float
* int -> long
* int -> double
* long -> float
* long -> double
* float -> double
*/
/*
* If we specify those two value with suffix 'L' and 'F'
* that means one of them is long and another is float,
* In this case method called with type 'Promotion'
*/
obj.add(5, 2F);
obj.add(5, 2L);
obj.add(5, 2D);
obj.add(5L, 2F);
obj.add(5L, 2D);
obj.add(5F, 2D);
}
/*
* Following method with same name 'add'
*/
/*
* Method overloading by changing number of arguments
*/
// Method No : 01
// There have three parameter in this method
public void add(int a, int b, int c) {
System.out.println("add(int a, int b, int c) = "+(a+b+c));
}
// Method No : 02
// There have four parameter in this method
public void add(int a, int b, int c, int d) {
System.out.println("add(int a, int b, int c, int d) = "+(a+b+c+d));
}
/*
* Method overloading by changing the data type
*/
// Method No : 03
// Method with int type parameter
public void add(int a, int b) {
System.out.println("add(int a, int b) = "+(a+b));
}
// Method No : 04
// Method with long type parameter
public void add(long a, long b) {
System.out.println("add(long a, long b) = "+(a+b));
}
// Method No : 05
// Method with float type parameter
public void add(float a, float b) {
System.out.println("add(float a, float b) = "+(a+b));
}
// Method No : 06
// Method with double type parameter
public void add(double a, double b) {
System.out.println("add(double a, double b) = "+(a+b));
}
}
| [
"noreply@github.com"
] | noreply@github.com |
2d57769ce4734321ab635e81751d82acfc52d9d3 | 1b307344a0dd5590e204529b7cc7557bed02d2b9 | /sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/models/ApiIssueCommentsGetResponse.java | cfffbf575f97de66fe77794f6994fa3c829affcc | [
"LGPL-2.1-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0",
"LicenseRef-scancode-generic-cla"
] | permissive | alzimmermsft/azure-sdk-for-java | 7e72a194e488dd441e44e1fd12c0d4c1cacb1726 | 9f5c9b2fd43c2f9f74c4f79d386ae00600dd1bf4 | refs/heads/main | 2023-09-01T00:13:48.628043 | 2023-03-27T09:00:31 | 2023-03-27T09:00:31 | 176,596,152 | 4 | 0 | MIT | 2023-03-08T18:13:24 | 2019-03-19T20:49:38 | Java | UTF-8 | Java | false | false | 1,482 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.apimanagement.models;
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpRequest;
import com.azure.core.http.rest.ResponseBase;
import com.azure.resourcemanager.apimanagement.fluent.models.IssueCommentContractInner;
/** Contains all response data for the get operation. */
public final class ApiIssueCommentsGetResponse
extends ResponseBase<ApiIssueCommentsGetHeaders, IssueCommentContractInner> {
/**
* Creates an instance of ApiIssueCommentsGetResponse.
*
* @param request the request which resulted in this ApiIssueCommentsGetResponse.
* @param statusCode the status code of the HTTP response.
* @param rawHeaders the raw headers of the HTTP response.
* @param value the deserialized value of the HTTP response.
* @param headers the deserialized headers of the HTTP response.
*/
public ApiIssueCommentsGetResponse(
HttpRequest request,
int statusCode,
HttpHeaders rawHeaders,
IssueCommentContractInner value,
ApiIssueCommentsGetHeaders headers) {
super(request, statusCode, rawHeaders, value, headers);
}
/** @return the deserialized response body. */
@Override
public IssueCommentContractInner getValue() {
return super.getValue();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0ed34b557d88f693ea31f4a10acc4ac9a2f74a71 | 3224e61f14935d94b3133e5fb4a485ce8e127de6 | /src/praktikum1/HighLow.java | 1cbfcf78a0157187210027a99f24ba7707656885 | [] | no_license | Karmen32/Praktikumid | 0f89f973670daed307c945f428b1898e5cd9d411 | 340ff7ff5ed19ab2d83981e7db5f08d5323ebc1d | refs/heads/master | 2020-12-01T08:07:11.678790 | 2016-11-18T09:31:48 | 2016-11-18T09:31:48 | 67,687,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,762 | java | package praktikum1;
/**
* This program lets the user play HighLow, a simple card game
* that is described in the output statements at the beginning of
* the main() routine. After the user plays several games,
* the user's average score is reported.
*/
public class HighLow {
public static void main(String[] args) {
System.out.println("This program lets you play the simple card game,");
System.out.println("HighLow. A card is dealt from a deck of cards.");
System.out.println("You have to predict whether the next card will be");
System.out.println("higher or lower. Your score in the game is the");
System.out.println("number of correct predictions you make before");
System.out.println("you guess wrong.");
System.out.println();
int gamesPlayed = 0; // Number of games user has played.
int sumOfScores = 0; // The sum of all the scores from
// all the games played.
double averageScore; // Average score, computed by dividing
// sumOfScores by gamesPlayed.
boolean playAgain; // Record user's response when user is
// asked whether he wants to play
// another game.
do {
int scoreThisGame; // Score for one game.
scoreThisGame = play(); // Play the game and get the score.
sumOfScores += scoreThisGame;
gamesPlayed++;
System.out.print("Play again? ");
playAgain = TextIO.getlnBoolean();
} while (playAgain);
averageScore = ((double)sumOfScores) / gamesPlayed;
System.out.println();
System.out.println("You played " + gamesPlayed + " games.");
System.out.printf("Your average score was %1.3f.\n", averageScore);
} // end main()
/**
* Lets the user play one game of HighLow, and returns the
* user's score in that game. The score is the number of
* correct guesses that the user makes.
*/
private static int play() {
Deck deck = new Deck(); // Get a new deck of cards, and
// store a reference to it in
// the variable, deck.
Card currentCard; // The current card, which the user sees.
Card nextCard; // The next card in the deck. The user tries
// to predict whether this is higher or lower
// than the current card.
int correctGuesses ; // The number of correct predictions the
// user has made. At the end of the game,
// this will be the user's score.
char guess; // The user's guess. 'H' if the user predicts that
// the next card will be higher, 'L' if the user
// predicts that it will be lower.
deck.shuffle(); // Shuffle the deck into a random order before
// starting the game.
correctGuesses = 0;
currentCard = deck.dealCard();
System.out.println("The first card is the " + currentCard);
while (true) { // Loop ends when user's prediction is wrong.
/* Get the user's prediction, 'H' or 'L' (or 'h' or 'l'). */
System.out.print("Will the next card be higher (H) or lower (L)? ");
do {
guess = TextIO.getlnChar();
guess = Character.toUpperCase(guess);
if (guess != 'H' && guess != 'L')
System.out.print("Please respond with H or L: ");
} while (guess != 'H' && guess != 'L');
/* Get the next card and show it to the user. */
nextCard = deck.dealCard();
System.out.println("The next card is " + nextCard);
/* Check the user's prediction. */
if (nextCard.getValue() == currentCard.getValue()) {
System.out.println("The value is the same as the previous card.");
System.out.println("You lose on ties. Sorry!");
break; // End the game.
}
else if (nextCard.getValue() > currentCard.getValue()) {
if (guess == 'H') {
System.out.println("Your prediction was correct.");
correctGuesses++;
}
else {
System.out.println("Your prediction was incorrect.");
break; // End the game.
}
}
else { // nextCard is lower
if (guess == 'L') {
System.out.println("Your prediction was correct.");
correctGuesses++;
}
else {
System.out.println("Your prediction was incorrect.");
break; // End the game.
}
}
/* To set up for the next iteration of the loop, the nextCard
becomes the currentCard, since the currentCard has to be
the card that the user sees, and the nextCard will be
set to the next card in the deck after the user makes
his prediction. */
currentCard = nextCard;
System.out.println();
System.out.println("The card is " + currentCard);
} // end of while loop
System.out.println();
System.out.println("The game is over.");
System.out.println("You made " + correctGuesses
+ " correct predictions.");
System.out.println();
return correctGuesses;
} // end play()
} // end class HighLow | [
"kalillem@klass2-21-l.intra.itcollege.ee"
] | kalillem@klass2-21-l.intra.itcollege.ee |
eccbd66b9cf6c13422de9ed68fc95f3e02e5f9cf | 2669e5d930b1ff1a5c899362379bb36153191409 | /alura-jdbc/src/main/java/br/com/alura/jdbc/aula5/ConnectionPool.java | 3fd682b844a4e9790a301377bd6e400d964849dd | [] | no_license | kwakassa/cursos-alura | 9c5c2839a45cab7060f0c874f30dee4e0683c883 | 16f34c331c1ef9e11238b9d6b5c6cc94514483b6 | refs/heads/master | 2021-07-09T03:58:02.237680 | 2019-02-01T16:20:08 | 2019-02-01T16:20:08 | 114,280,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package br.com.alura.jdbc.aula5;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.hsqldb.jdbc.JDBCPool;
public class ConnectionPool {
private DataSource dataSource;
public ConnectionPool() {
JDBCPool pool = new JDBCPool();
pool.setUrl("jdbc:hsqldb:hsql://localhost/loja-virtual");
pool.setUser("SA");
pool.setPassword("");
this.dataSource = pool;
}
public Connection getConnectionDemorado() throws SQLException {
Connection connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/loja-virtual", "SA", "");
//Connection connection = dataSource.getConnection();
return connection;
}
public Connection getConnectionPool() throws SQLException {
//Connection connection = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/loja-virtual", "SA", "");
Connection connection = dataSource.getConnection();
return connection;
}
}
| [
"kazumitsu.wakassa@caixa.gov.br"
] | kazumitsu.wakassa@caixa.gov.br |
77513dbe3a92c889386607666c016c747c85ccc9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_cb7fbf4a019d65bd1c12342b6ca3e1824a0eb09a/ActivemqPubSub/13_cb7fbf4a019d65bd1c12342b6ca3e1824a0eb09a_ActivemqPubSub_s.java | c58f303541d92e85953b11aa801360595d264622 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 7,103 | java | /**
*
*/
package eu.indenica.common;
import java.net.URI;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.Topic;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.slf4j.Logger;
import eu.indenica.events.Event;
import eu.indenica.messaging.DiscoveryNameProvider;
/**
* Messaging fabric accessing JMS/ActiveMQ embedded brokers and multicast
* discovery to deliver messages in a distributed deployment.
*
* @author Christian Inzinger
*
*/
public class ActivemqPubSub implements PubSub, EventListener {
private final static Logger LOG = LoggerFactory.getLogger();
public final static String baseTopic = "indenica.event";
public final static String pathSeparator = ".";
private final URI brokerUri;
private final Connection connection;
/**
* Create and start the messaging infrastructure with default settings.
*
* @throws Exception
* when the broker fails to start.
*
*/
public ActivemqPubSub() throws Exception {
this(DiscoveryNameProvider.DEFAULT_BROKER_URI);
}
/**
* Create and start the messaging infrastructure connecting to the specified
* broker URI
*
* @param brokerUri
* the {@link URI} of the broker to connect to
* @throws Exception
* if something goes wrong
*/
protected ActivemqPubSub(URI brokerUri) throws Exception {
this.brokerUri = brokerUri;
LOG.info("Connecting to {}...", brokerUri);
ActiveMQConnectionFactory connectionFactory =
new ActiveMQConnectionFactory(brokerUri);
connection = connectionFactory.createConnection();
connection.start();
}
/**
* @see eu.indenica.common.PubSub#destroy()
*/
@Override
public void destroy() throws JMSException {
connection.close();
}
/*
* (non-Javadoc)
*
* @see
* eu.indenica.common.PubSub#publish(eu.indenica.common.RuntimeComponent,
* eu.indenica.events.Event)
*/
@Override
public void publish(final String source, final Event event) {
String topicName =
new StringBuilder().append(baseTopic).append(pathSeparator)
.append(source == null ? "null" : source)
.append(pathSeparator).append(event.getEventType())
.toString();
try {
Session session =
connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Message message = session.createObjectMessage(event);
MessageProducer producer = session.createProducer(null);
LOG.trace("Sending {} to topic {}", event, topicName);
producer.send(session.createTopic(topicName), message);
session.close();
} catch(JMSException e) {
LOG.error("Something went wrong!", e);
}
}
/*
* (non-Javadoc)
*
* @see
* eu.indenica.common.PubSub#publishAll(eu.indenica.common.EventEmitter)
*/
@Override
public void publishAll(final EventEmitter source) {
source.addEventListener(this);
}
/*
* (non-Javadoc)
*
* @see
* eu.indenica.common.PubSub#registerListener(eu.indenica.common.EventListener
* , eu.indenica.common.RuntimeComponent, eu.indenica.events.Event)
*/
@Override
public void registerListener(final EventListener listener,
final String source, final Event event) {
registerListener(listener, source, event.getEventType());
}
/*
* (non-Javadoc)
*
* @see
* eu.indenica.common.PubSub#registerListener(eu.indenica.common.EventListener
* , eu.indenica.common.RuntimeComponent, java.lang.String)
*/
@Override
public void registerListener(final EventListener listener,
final String source, final String eventType) {
String topicName =
new StringBuilder().append(baseTopic).append(pathSeparator)
.append(source == null ? "*" : source)
.append(pathSeparator)
.append(eventType == null ? "*" : eventType).toString();
try {
LOG.info("Registering listener for {}...", topicName);
Session session =
connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer =
session.createConsumer(session.createTopic(topicName));
consumer.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
if(!(message instanceof ObjectMessage)) {
LOG.error("Received unexpected message: {}", message);
throw new RuntimeException("Unexpected message!");
}
try {
// FIXME: get source component for event
String source =
((Topic) message.getJMSDestination())
.getTopicName();
Event receivedEvent =
(Event) ((ObjectMessage) message).getObject();
listener.eventReceived(source, receivedEvent);
} catch(JMSException e) {
LOG.error("Could not retrieve object from message", e);
}
}
});
} catch(JMSException e) {
LOG.error("Something went wrong!", e);
}
}
/*
* (non-Javadoc)
*
* @see eu.indenica.common.EventListener#eventReceived(eu.indenica.common.
* RuntimeComponent, eu.indenica.events.Event)
*/
@Override
public void eventReceived(final String source, final Event event) {
publish(source, event);
}
/**
* Returns a new instanc of the messaging fabric client
*
* @return a new instance of the messaging fabric client.
*/
public static synchronized PubSub getInstance() {
try {
return new ActivemqPubSub();
} catch(Exception e) {
LOG.error("Error creating pubsub instance!", e);
return null;
}
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return new StringBuilder().append("#<").append(getClass().getName())
.append(": ").append("DEFAULT_BROKER_URI: ").append(brokerUri)
.append(">").toString();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
430cf730fd5cb76d895137f4ac12685adf473e07 | d38a29d6d90d38bce612778e738b0472675d3108 | /buildinggame/1.11/src/com/gmail/stefvanschiedev/buildinggame/events/stats/unsaved/UnsavedStatsPlace.java | 8b58a4a5a003d9198634ce43f452c52e5c25c95f | [] | no_license | Outravez/buildinggame | 018595038862a1281206f547261dd9e3d47ba165 | c83364a1a8c047b85528092ae9e9c69ced8fb4dc | refs/heads/master | 2021-01-11T18:03:55.662985 | 2017-01-19T18:20:10 | 2017-01-19T18:20:10 | 79,482,268 | 0 | 0 | null | 2017-01-19T18:29:21 | 2017-01-19T18:29:21 | null | UTF-8 | Java | false | false | 895 | java | package com.gmail.stefvanschiedev.buildinggame.events.stats.unsaved;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import com.gmail.stefvanschiedev.buildinggame.managers.arenas.ArenaManager;
import com.gmail.stefvanschiedev.buildinggame.utils.GameState;
import com.gmail.stefvanschiedev.buildinggame.utils.arena.Arena;
public class UnsavedStatsPlace implements Listener {
@EventHandler(ignoreCancelled=true)
public void onBlockPlace(BlockPlaceEvent e) {
Player player = e.getPlayer();
Arena arena = ArenaManager.getInstance().getArena(player);
if (arena == null)
return;
if (arena.getState() != GameState.BUILDING)
return;
arena.getPlot(player).getGamePlayer(player).setBlocksPlaced(arena.getPlot(player).getGamePlayer(player).getBlocksPlaced() + 1);
}
} | [
"stefvanschiedev@gmail.com"
] | stefvanschiedev@gmail.com |
579264ee3c6966d39ff388460ebd6f3f8da20b57 | ce98420e0eb3f95f289ed50c4940b801b26ba595 | /GameCode/StartScreenText.java | 8633db67b1dcb9c692bea9687b36a91255b7ea5b | [] | no_license | nebulazee/fa19-202-los-jefes | a5f61b78552098c75462c2f7688defb7c64c5798 | b21db6192903fe6fa8cb2b51b5b668c25721326f | refs/heads/master | 2022-03-15T04:42:01.531486 | 2019-11-23T19:56:25 | 2019-11-23T19:56:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class StartScreenText here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class StartScreenText extends Actor
{
GreenfootImage img;
public StartScreenText()
{
img = new GreenfootImage("startpic.jpg");
setImage(img);
}
/**
* Act - do whatever the StartScreenText wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
}
}
| [
"harshravindrabhai.trivedi@sjsu.edu"
] | harshravindrabhai.trivedi@sjsu.edu |
e15a596efeed630d937edc0d0b05e7c7d01f319e | 9dc0f8b46d5802f4db57e57f657269c210b5560c | /ISHTAG/src/com/example/ishtag/TZ4_2sdActivity.java | cbe90162316a2cbc7b19d45cf69c2ac7f751d3d1 | [] | no_license | ljppff1/ISHTAG | 7cea819654e213428c59de76660181c5e0a9a122 | f14b0864779245731ca0044a83896f24cc4a1dc8 | refs/heads/master | 2021-01-23T14:56:09.633899 | 2015-10-15T08:48:58 | 2015-10-15T08:48:58 | 42,165,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,928 | java | package com.example.ishtag;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.example.fragment.Fragment1a;
import com.example.fragment.Fragment1b;
import com.example.fragment.Fragment1c;
import com.example.fragment.Fragment52m1;
import com.example.ishtag1.TZ5_1Activity;
import com.example.ishtag1.TZ5_1mActivity;
import com.example.ishtag1.TZ5_2Activity;
import com.example.ishtag1.TZ5_2mActivity;
import com.example.utils.AppManager;
import com.example.utils.TypeFace;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
public class TZ4_2sdActivity extends FragmentActivity {
private GridView mGvm1;
private RadioGroup rg1;
private RadioButton rb1;
private RadioButton rb2;
private RadioButton rb3;
private ViewPager vp;
private ArrayList<Fragment> list;
private Fragment52m1 fa;
private Fragment1b fb;
private Fragment1c fc;
private ImageView mTIvt41h1;
private ImageView mTIvt41f;
private ImageView mTIvt41g;
public static String SDPATH = Environment.getExternalStorageDirectory()
+ "/ISHTAG/";
private File tempFile1;
private ImageView mTIvt41i;
private EditText mTvss1;
private Typeface face1;
private Typeface face2;
private static final int TAKE_PICTURE = 0x000001;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
AppManager.getAppManager().addActivity(this);
setContentView(R.layout.t42sd);
face1 =new TypeFace().getTypeFace2(getApplicationContext());
face2 =new TypeFace().getTypeFace1(getApplicationContext());
initView();
}
private void initView() {
mTvss1 =(EditText)this.findViewById(R.id.mTvss1);
mTIvt41f =(ImageView)this.findViewById(R.id.mTIvt41f);
mTIvt41f.setOnClickListener(listener);
mTIvt41h1 =(ImageView)this.findViewById(R.id.mTIvt41h1);
mTIvt41h1.setOnClickListener(listener);
mTIvt41g =(ImageView)this.findViewById(R.id.mTIvt41g);
mTIvt41g.setOnClickListener(listener);
mTIvt41i =(ImageView)this.findViewById(R.id.mTIvt41i);
mTIvt41i.setOnClickListener(listener);
rg1 = (RadioGroup) this.findViewById(R.id.rg1);
rb1 = (RadioButton) this.findViewById(R.id.rb1);
rb2 = (RadioButton) this.findViewById(R.id.rb2);
rb3 = (RadioButton) this.findViewById(R.id.rb3);
rb1.setTypeface(face1);
rb2.setTypeface(face1);
rb3.setTypeface(face1);
mTvss1.setTypeface(face1);
vp=(ViewPager)this.findViewById(R.id.vp1);
vp.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int arg0) {
if (arg0==0) {
rb1.setChecked(true);
}
if(arg0==1){
rb2.setChecked(true);
}
if(arg0==2){
rb3.setChecked(true);
}
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
// TODO Auto-generated method stub
}
@Override
public void onPageScrollStateChanged(int arg0) {
// TODO Auto-generated method stub
}
});
list = new ArrayList<Fragment>();
fa=new Fragment52m1();
fb=new Fragment1b();
fc=new Fragment1c();
list.add(fa);
list.add(fb);
list.add(fc);
ZxzcAdapter zxzc = new ZxzcAdapter(getSupportFragmentManager(), list);
vp.setAdapter(zxzc);
zxzc.notifyDataSetChanged();
rg1.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int cheakedId) {
if (cheakedId == rb1.getId()) {
vp.setCurrentItem(0);
} else if (cheakedId == rb2.getId()) {
vp.setCurrentItem(1);
}else if (cheakedId == rb3.getId()) {
vp.setCurrentItem(2);
}
}
});
rb1.setChecked(true);
}
class ZxzcAdapter extends FragmentStatePagerAdapter {
List<Fragment> list;
public ZxzcAdapter(FragmentManager fm,List<Fragment> list) {
super(fm);
this.list=list;
}
@SuppressLint("ResourceAsColor")
@Override
public Fragment getItem(int arg0) {
return list.get(arg0);
}
@Override
public int getCount() {
return list.size();
}
}
OnClickListener listener =new OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.mTIvt41i:
startActivity(new Intent(getApplicationContext(), TZ5_2mActivity.class));
break;
case R.id.mTIvt41f:
startActivity(new Intent(getApplicationContext(), TZ5_2Activity.class));
break;
case R.id.mTIvt41h1:
startActivity(new Intent(getApplicationContext(), TZ4_2sActivity.class));
break;
case R.id.mTIvt41g:
photo();
break;
default:
break;
}
}
};
private void photo() {
Intent openCameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
String fileName = String.valueOf(System.currentTimeMillis());
if (!com.example.utils.FileUtils.isFileExist("")) {
try {
File tempf = com.example.utils.FileUtils.createSDDir("");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
File f = new File(SDPATH, fileName + ".jpg");
openCameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(f));
tempFile1=f;
startActivityForResult(openCameraIntent, TAKE_PICTURE);
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case TAKE_PICTURE:
if(tempFile1.getTotalSpace()!=0){
// Bitmap bitmap = BitmapFactory.decodeFile(tempFile1.getPath());
//Toast.makeText(getApplicationContext(), tempFile1.getPath(), 1).show();
Intent intent =new Intent(getApplicationContext(), TZ4_2pActivity.class);
intent.putExtra("PATH", tempFile1.getPath());
startActivity(intent);
}
break;
}
}
}
| [
"ljppff@163.com"
] | ljppff@163.com |
8b64678011de148b68bcd96d196fa2b5901b262d | bbc0c987b4a6f1fffe1f414446f9a8e4a39490e6 | /src/Polecenie/SitUp.java | 7c39327cea9925411bc8cc252f54d091f812a16f | [] | no_license | ChrisLepko/DesignPatternsJava | ae4ebbe5fcbc977420dbae24ba8087912dc0b41d | 3a83661763b4a07a70105295c4e5ee4d67a8f03e | refs/heads/master | 2023-05-14T21:06:22.291190 | 2021-06-04T16:53:33 | 2021-06-04T16:53:33 | 373,906,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package Polecenie;
public class SitUp implements Command {
@Override
public void execute() {
System.out.println("Zrób brzuszek!");
}
}
| [
"57542929+ChrisLepko@users.noreply.github.com"
] | 57542929+ChrisLepko@users.noreply.github.com |
e9e767edf2b6291e762e52436f3b73692c8abe64 | d9a244caa7110dbc9caf95b1aff8946c2a6ac60b | /javalib/src/java/io/Writer.java | 018aa62a85ce64b42f86dd51d556e50c2db9572d | [
"Unlicense"
] | permissive | wwwjames/miniJVM | e3aa082eec42ef662fed7a18d4e21c374b614a33 | ccc43dc73fa81c3e9acd746fbdaa23da980c84cc | refs/heads/master | 2020-03-26T14:45:23.730211 | 2018-08-16T13:20:04 | 2018-08-16T13:20:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,051 | java | /*
* Copyright C 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*/
package java.io;
/**
* Abstract class for writing to character streams. The only methods that a
* subclass must implement are write(char[], int, int), flush(), and close().
* Most subclasses, however, will override some of the methods defined here in
* order to provide higher efficiency, additional functionality, or both.
*
* @version 12/17/01 (CLDC 1.1)
* @author Mark Reinhold
* @since JDK1.1, CLDC 1.0
* @see java.io.OutputStreamWriter
* @see java.io.Reader
*/
public abstract class Writer implements Appendable{
/**
* Temporary buffer used to hold writes of strings and single characters
*/
private char[] writeBuffer;
/**
* Size of writeBuffer, must be >= 1
*/
private final int writeBufferSize = 1024;
/**
* The object used to synchronize operations on this stream. For
* efficiency, a character-stream object may use an object other than
* itself to protect critical sections. A subclass should therefore use
* the object in this field rather than <tt>this</tt> or a synchronized
* method.
*/
protected Object lock;
/**
* Create a new character-stream writer whose critical sections will
* synchronize on the writer itself.
*/
protected Writer() {
this.lock = this;
}
/**
* Create a new character-stream writer whose critical sections will
* synchronize on the given object.
*
* @param lock Object to synchronize on.
*/
protected Writer(Object lock) {
if (lock == null) {
throw new NullPointerException();
}
this.lock = lock;
}
/**
* Write a single character. The character to be written is contained in
* the 16 low-order bits of the given integer value; the 16 high-order bits
* are ignored.
*
* <p> Subclasses that intend to support efficient single-character output
* should override this method.
*
* @param c int specifying a character to be written.
* @exception IOException If an I/O error occurs
*/
public void write(int c) throws IOException {
synchronized (lock) {
if (writeBuffer == null){
writeBuffer = new char[writeBufferSize];
}
writeBuffer[0] = (char) c;
write(writeBuffer, 0, 1);
}
}
/**
* Write an array of characters.
*
* @param cbuf Array of characters to be written
*
* @exception IOException If an I/O error occurs
*/
public void write(char cbuf[]) throws IOException {
write(cbuf, 0, cbuf.length);
}
/**
* Write a portion of an array of characters.
*
* @param cbuf Array of characters
* @param off Offset from which to start writing characters
* @param len Number of characters to write
*
* @exception IOException If an I/O error occurs
*/
abstract public void write(char cbuf[], int off, int len) throws IOException;
/**
* Write a string.
*
* @param str String to be written
*
* @exception IOException If an I/O error occurs
*/
public void write(String str) throws IOException {
write(str, 0, str.length());
}
/**
* Write a portion of a string.
*
* @param str A String
* @param off Offset from which to start writing characters
* @param len Number of characters to write
*
* @exception IOException If an I/O error occurs
*/
public void write(String str, int off, int len) throws IOException {
synchronized (lock) {
char cbuf[];
if (len <= writeBufferSize) {
if (writeBuffer == null) {
writeBuffer = new char[writeBufferSize];
}
cbuf = writeBuffer;
} else { // Don't permanently allocate very large buffers.
cbuf = new char[len];
}
str.getChars(off, (off + len), cbuf, 0);
write(cbuf, 0, len);
}
}
/**
* Flush the stream. If the stream has saved any characters from the
* various write() methods in a buffer, write them immediately to their
* intended destination. Then, if that destination is another character or
* byte stream, flush it. Thus one flush() invocation will flush all the
* buffers in a chain of Writers and OutputStreams.
*
* @exception IOException If an I/O error occurs
*/
abstract public void flush() throws IOException;
/**
* Close the stream, flushing it first. Once a stream has been closed,
* further write() or flush() invocations will cause an IOException to be
* thrown. Closing a previously-closed stream, however, has no effect.
*
* @exception IOException If an I/O error occurs
*/
abstract public void close() throws IOException;
public Appendable append(final char c) throws IOException {
write((int) c);
return this;
}
public Appendable append(final CharSequence sequence) throws IOException {
return append(sequence, 0, sequence.length());
}
public Appendable append(CharSequence sequence, int start, int end)
throws IOException {
final int length = end - start;
if (sequence instanceof String) {
write((String) sequence, start, length);
} else {
final char[] charArray = new char[length];
for (int i = start; i < end; i++) {
charArray[i] = sequence.charAt(i);
}
write(charArray, 0, length);
}
return this;
}
}
| [
"digitalgust@163.com"
] | digitalgust@163.com |
867ad99b4b84e76a51ec7e3d601eec4fe574920e | 4fe55f2e033313e2a2a4c59078d80413e9bce2f9 | /PhoneGuard/src/com/onyas/phoneguard/test/TestTaskInfoEngine.java | 894800351888f53bac702f9984edd8aac1d8bee4 | [] | no_license | onyas/GraduationProject | ec8a3dfb5cc6203569df4895cbb4c1e708551b4b | 22bce95d1b3c24ca8a4b2c71c52aa0931ab5be81 | refs/heads/master | 2020-06-03T04:03:24.060824 | 2014-03-19T14:44:20 | 2014-03-19T14:44:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.onyas.phoneguard.test;
import java.util.List;
import android.test.AndroidTestCase;
import com.onyas.phoneguard.domain.TaskInfo;
import com.onyas.phoneguard.engine.TaskInfoEngine;
public class TestTaskInfoEngine extends AndroidTestCase {
public void testGetAll(){
TaskInfoEngine engine = new TaskInfoEngine(getContext());
List<TaskInfo> infos = engine.getAllTasks();
System.out.println(infos.size());
for(TaskInfo info :infos){
System.out.println(info.getAppname());
}
}
}
| [
"zheng0518@163.com"
] | zheng0518@163.com |
257f0911cb8ebe2ffa652c5c95d66b807e495a2a | dafdbbb0234b1f423970776259c985e6b571401f | /graphics/AllBinaryGraphicsJavaApplicationM/src/main/java/allbinary/graphics/pipeline/GraphicsPipeline.java | c08404a1bfa8128607770529af8e968b889e0a91 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | biddyweb/AllBinary-Platform | 3581664e8613592b64f20fc3f688dc1515d646ae | 9b61bc529b0a5e2c647aa1b7ba59b6386f7900ad | refs/heads/master | 2020-12-03T10:38:18.654527 | 2013-11-17T11:17:35 | 2013-11-17T11:17:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,721 | java | /*
* AllBinary Open License Version 1
* Copyright (c) 2011 AllBinary
*
* By agreeing to this license you and any business entity you represent are
* legally bound to the AllBinary Open License Version 1 legal agreement.
*
* You may obtain the AllBinary Open License Version 1 legal agreement from
* AllBinary or the root directory of AllBinary's AllBinary Platform repository.
*
* Created By: Travis Berthelot
*
*/
package allbinary.graphics.pipeline;
import allbinary.graphics.GPoint;
import allbinary.graphics.PointFactory;
import org.allbinary.util.BasicArrayList;
public class GraphicsPipeline extends BasicGraphicsPipeline
{
public GraphicsPipeline(BasicArrayList points)
{
super(points);
}
//Double rotate = new Double(Math.toRadians(angle.doubleValue()));
//graphicsPipe.rotate(rotate.doubleValue());
public void rotateTheta(double aTheta)
throws Exception
{
BasicArrayList newVector = new BasicArrayList();
int size = this.pointBasicArrayList.size();
for(int index = 0; index < size; index++)
{
GPoint secondPoint = (GPoint) pointBasicArrayList.get(index);
double secondX = (secondPoint.getX() * Math.cos(aTheta)) -
(secondPoint.getY() * Math.sin(aTheta));
double secondY = (secondPoint.getX() * Math.sin(aTheta)) +
(secondPoint.getY() * Math.cos(aTheta));
//LogUtil.put("Calculated: X: " + secondX + " Y: " + secondY, this, "rotate");
GPoint point = PointFactory.getInstance().getInstance(((int) secondX), ((int) secondY));
newVector.add(point);
}
this.pointBasicArrayList = newVector;
}
} | [
"travisberthelot@hotmail.com"
] | travisberthelot@hotmail.com |
3e6e3677c161b4c83e910cc859eb8931c6259bff | b3b7930300b1871ddba55b8b437bb31e49824f5e | /scratch/src/concurrency/golfballmonitor/SimpleAllocator.java | 752bf07f58b833a30c1c5c1f6495d9c1cf54061e | [] | no_license | sgupta59/Algorithms | 3a696e7bb1b3778d6c4f2f4b7a3c7f64ed61519c | 71d9900114674aacc73b0828e0fcada63e79f02e | refs/heads/master | 2020-03-27T05:31:16.529053 | 2016-01-10T22:05:07 | 2016-01-10T22:05:07 | 32,460,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | /********************************************************/
//
// SimpleAllocator Class
//
package threading.golfballmonitor;
public class SimpleAllocator implements Allocator{
private int available;
public SimpleAllocator(int n) { available = n; }
synchronized public void get(int n) throws InterruptedException {
while (n>available) wait();
available -= n;
}
synchronized public void put(int n) {
available += n;
notifyAll();
}
}
| [
"sgupta59_github"
] | sgupta59_github |
32fef61255b89dc54dd3a67916e4b35a445ed6a0 | b8e5302037590eb93ee15935962a28b48021c187 | /Data Structures in Java/CTCI/Chapter VI Big O/Permutation.java | afd2949efb6740b648220cf52267a15ac15fd6cb | [] | no_license | mukulbichkar19/Personal-Practice | 672c8c902037dbba279eeb0be90462541ea6a046 | e03198cd605d91e26bd4cac89956aa6b613b60ca | refs/heads/master | 2020-05-21T20:40:46.761731 | 2018-07-08T06:40:40 | 2018-07-08T06:40:40 | 59,961,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | public class Permutation{
private static void permutations(String str){
permutation(str, "");
}
private static void permutation(String str, String prefix){
if(str.length() == 0){
System.out.println(prefix);
}else{
for(int i=0;i<str.length();i++){
String rem = str.substring(0,i) + str.substring(i+1);
permutation(rem, prefix + str.charAt(i));
}
}
}
public static void main(String args[]){
String s = "abc";
permutations(s);
}
}
| [
"mukulbichkarpersonal@MacBook-Pro.local"
] | mukulbichkarpersonal@MacBook-Pro.local |
48b9b460e4218d2cf887d18b55a051b29792899e | a7d7e400555800899689ec5138e141ce2f462d36 | /java_app/com/htkj/cfdScenic/app/service/ShopUserService.java | 25d03062382f7d31e1eae6ab6c7f1ea886ad5c4a | [] | no_license | Brave-wan/cfdScenic-server | 23bcf016c45c9a848c567413ff2a261c1e7f9b38 | 2205834eb8bbf60e37e1fafac3c823d3637f884d | refs/heads/master | 2020-03-22T15:45:30.391632 | 2018-07-11T02:13:25 | 2018-07-11T02:13:25 | 140,275,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,141 | java | package com.htkj.cfdScenic.app.service;
import com.htkj.cfdScenic.app.dao.AlipayInfoDao;
import com.htkj.cfdScenic.app.dao.HtmlTextDao;
import com.htkj.cfdScenic.app.dao.PushMessageDao;
import com.htkj.cfdScenic.app.dao.ShopUserDao;
import com.htkj.cfdScenic.app.model.AlipayInfo;
import com.htkj.cfdScenic.app.model.PushMessage;
import com.htkj.cfdScenic.app.model.ShopUser;
import com.htrj.common.base.BaseService;
import com.htrj.common.exception.BusinessException;
import com.htrj.common.page.DataGrid;
import com.htrj.common.page.Page;
import com.htrj.common.page.PageRequest;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class ShopUserService extends BaseService{
@Autowired
private ShopUserDao shopUserDao;
@Autowired
private PushMessageDao pushMessageDao;
@Autowired
private HtmlTextDao htmlTextDao;
@Autowired
private AlipayInfoDao alipayInfoDao;
public Integer selectById(Long userId) {
return shopUserDao.selectById(userId);
}
public Long getShopUserIdByToken(String token)
{
return shopUserDao.getShopUserIdByToken(token);
}
public ShopUser selectByPhone(String telPhone) {
return shopUserDao.selectByPhone(telPhone);
}
public ShopUser selectByUserId(Long id) {
return shopUserDao.selectByUserId(id);
}
public void updateUUID(ShopUser userMessage) {
shopUserDao.updateUUID(userMessage);
}
public void update(ShopUser userMessage) {
shopUserDao.updatePassWord(userMessage);
}
public void updateInformationId(ShopUser userMessage) {
shopUserDao.updateInformationId(userMessage);
}
public void insertMessage(ShopUser user) {
shopUserDao.insertMessage(user);
}
public Map<String, Object> shopUserMessage(Long id) {
return shopUserDao.shopUserMessage(id);
}
public Map<String, Object> shopAutonymMessage(Long id) {
return shopUserDao.shopAutonymMessage(id);
}
public ShopUser login(String telephone, String password) throws BusinessException{
ShopUser user =new ShopUser();
try {
user = shopUserDao.selectByPhone(telephone);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
if(user==null){
throw new BusinessException("用户账户不存在!");
}
if(user.getState()==1){
throw new BusinessException("您的账户已被禁用!");
}
String pas = new Md5Hash(password).toHex();
String userPas = user.getPassWord();
if(!userPas.equals(pas)){
throw new BusinessException("密码错误!");
}
return user;
}
public Boolean selectByTelPhone(String telphone) {
ShopUser user = shopUserDao.selectByTelPhone(telphone);
boolean flag = true;
if (user != null) {
flag = false ;
}
return flag;
}
public void register(ShopUser shopUser) {
shopUserDao.register(shopUser);
}
public DataGrid getMyMessage(PageRequest<Map<String, Object>> pageRequest) {
Page returnPage = pushMessageDao.getMyMessage(pageRequest);
return DataGrid.pageToDataGrid(returnPage);
}
public String getAboutUs() {
return htmlTextDao.getAboutUs();
}
public String getDetailUrlbyId(Long detailId) {
return htmlTextDao.getDetailUrlbyId(detailId);
}
public DataGrid getByid(PageRequest<Map<String, Object>> pageRequest) {
Page returnPage = shopUserDao.getById(pageRequest);
return DataGrid.pageToDataGrid(returnPage);
}
public DataGrid getShopUserList(PageRequest<Map<String, Object>> pageRequest) {
Page returnPage = shopUserDao.getShopUserList(pageRequest);
return DataGrid.pageToDataGrid(returnPage);
}
public AlipayInfo getAlipayInfoBySiId(Long siId) {
return alipayInfoDao.getAlipayInfoBySiId(siId);
}
}
| [
"185214487@qq.com"
] | 185214487@qq.com |
013de199559e443528181baa4232862cf8ef3e88 | dce7912768983d16824d31df97be3cbf75bb4431 | /src/com/epam/jwd/task/app/Main.java | 1296ea17211f49a650b9c2e7dd9c1fe723fce2f5 | [] | no_license | Dosann/JWD-geometric-shapes | 7d1a69b43d58b193fa18e744764c4eddbd0bcf8d | e43d94cf5333886288b570801a2d3cdd2b20be7f | refs/heads/master | 2023-02-13T13:11:37.024530 | 2021-01-07T07:49:44 | 2021-01-07T07:49:44 | 315,112,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,684 | java | package com.epam.jwd.task.app;
import com.epam.jwd.task.builder.Specification;
import com.epam.jwd.task.exception.FigureException;
import com.epam.jwd.task.logic.ReportAction;
import com.epam.jwd.task.model.Color;
import com.epam.jwd.task.model.Figure;
import com.epam.jwd.task.model.FigureType;
import com.epam.jwd.task.model.Point;
import com.epam.jwd.task.service.impl.FigureCrudService;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Main {
private static final Logger LOGGER = LogManager.getLogger(Main.class);
private static final List<Point> POINTS_FOR_LINE = new ArrayList<>();
static {
POINTS_FOR_LINE.add(new Point(0.1, -9.4));
POINTS_FOR_LINE.add(new Point(0.1, 9.4));
}
private static final List<Point> POINTS_FOR_FIRST_TRIANGLE = new ArrayList<>();
static {
POINTS_FOR_FIRST_TRIANGLE.add(new Point(-1, 0));
POINTS_FOR_FIRST_TRIANGLE.add(new Point(-1, 3));
POINTS_FOR_FIRST_TRIANGLE.add(new Point(3, 0));
}
private static final List<Point> POINTS_FOR_SECOND_TRIANGLE = new ArrayList<>();
static {
POINTS_FOR_SECOND_TRIANGLE.add(new Point(3, 0));
POINTS_FOR_SECOND_TRIANGLE.add(new Point(-1, 3));
POINTS_FOR_SECOND_TRIANGLE.add(new Point(-1, 0));
}
private static final List<Point> POINTS_FOR_SQUARE = new ArrayList<>();
static {
POINTS_FOR_SQUARE.add(new Point(3, 3));
POINTS_FOR_SQUARE.add(new Point(10, 10));
POINTS_FOR_SQUARE.add(new Point(3, 10));
POINTS_FOR_SQUARE.add(new Point(10, 3));
}
private static final List<Point> POINTS_FOR_MULTI_ANGLE = new ArrayList<>();
static {
POINTS_FOR_MULTI_ANGLE.add(new Point(-2, 3));
POINTS_FOR_MULTI_ANGLE.add(new Point(0, 6.3));
POINTS_FOR_MULTI_ANGLE.add(new Point(-5.62, -13.6));
POINTS_FOR_MULTI_ANGLE.add(new Point(-5.4, 3.7));
POINTS_FOR_MULTI_ANGLE.add(new Point(1, 0.99));
}
public static void main(String[] args) {
testFigureCrudService();
}
private static void testFigureCrudService () {
FigureCrudService figureCrudService = FigureCrudService.INSTANCE;
try {
Figure square = figureCrudService.createFigure(FigureType.SQUARE, POINTS_FOR_SQUARE,
Color.PURPLE, "A square");
Figure triangle1 = figureCrudService.createFigure(FigureType.TRIANGLE, POINTS_FOR_FIRST_TRIANGLE,
Color.PURPLE, "ATriangle");
Figure triangle2 = figureCrudService.createFigure(FigureType.TRIANGLE, POINTS_FOR_SECOND_TRIANGLE,
Color.BLUE, "B Triangle");
ReportAction.printFigure(Arrays.asList(square, triangle1, triangle2));
figureCrudService.saveFigure(square);
figureCrudService.saveFigure(Arrays.asList(triangle1, triangle2));
LOGGER.log(Level.INFO, "Finding figure by specified id... {}",
figureCrudService.findFigureById(null));
Specification specification = Specification.builder()
.withAreaGreaterThan(6)
.withColor(Color.PURPLE)
.withPerimeterLessThan(50)
.build();
LOGGER.log(Level.INFO, "Figures found by specification: {}",
figureCrudService.findFigureByCriteria(specification));
} catch (FigureException e) {
LOGGER.log(Level.ERROR, "Exception occurred: {}", e.toString());
}
}
}
| [
"anndosova@gmail.com"
] | anndosova@gmail.com |
02c534e410e759a2677a73613c418cc14a5e73de | e64e33e7cac2035222f6812f2c9ebe02514f5e1e | /JPayroll/src/main/java/com/jpy/schema/eo/SchemaEO.java | a188817c2e76a4c15e6ef44861816063ef60964f | [] | no_license | ibukki/JPY | c87320c8afb53750a713fa2c2bdcd258b8dd7627 | da18e97fad7b5c7ac5599e8fdb80eea8a65b7c08 | refs/heads/master | 2021-01-23T17:58:38.485559 | 2014-08-11T09:49:07 | 2014-08-11T09:49:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,298 | java | package com.jpy.schema.eo;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
@Entity
@Table(name="SCHEMA")
public class SchemaEO implements Serializable{
/**
* serialVersion
*/
private static final long serialVersionUID = 1L;
@Id
@Column(name="SCHEMAID")
private String schemaId;
@Column(name="DESCRIPTION")
private String description;
@Lob
@Column(name="SCHEMACONTENT")
private byte[] content;
/**
* @return the schemaId
*/
public String getSchemaId() {
return schemaId;
}
/**
* @param schemaId the schemaId to set
*/
public void setSchemaId(String schemaId) {
this.schemaId = schemaId;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the content
*/
public byte[] getContent() {
return content;
}
/**
* @param content the content to set
*/
public void setContent(byte[] content) {
this.content = content;
}
}
| [
"ryan.huang@sap.com"
] | ryan.huang@sap.com |
5eda0a9c75af2c4dbae35016a45796f7375a9964 | befda1a73c438715abb11306671384597e344766 | /Vuelo.java | edb30c45e1b2269ba388646631efbf56f6686da1 | [] | no_license | LizNeira/JavaAppEmpresaAerea | 6a338e94b8d878888a2931b37c9e691e11dfa55b | b1414b58879830dd92af039462b0e3a6f1dea1f9 | refs/heads/master | 2020-07-24T12:13:44.949689 | 2019-09-11T23:11:38 | 2019-09-11T23:11:38 | 207,922,386 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,657 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaappempresaaerea;
import java.io.Serializable;
public class Vuelo implements Serializable{
private int numVuelo;
private int totalLug;
private int lugOcup;
private String destino;
public Vuelo(int num, int totalLug, int lugOcup) {
this.numVuelo = num;
this.totalLug = totalLug;
this.lugOcup = lugOcup;
}
public Vuelo(int numVuelo, int totalLug, int lugOcup, String destino) {
this.numVuelo = numVuelo;
this.totalLug = totalLug;
this.lugOcup = lugOcup;
this.destino = destino;
}
public Vuelo(int num, int totalLug) {
this(num,totalLug,0);
}
public int getNumVuelo() {
return numVuelo;
}
public void setNumVuelo(int numVuelo) {
this.numVuelo = numVuelo;
}
public int getTotalLug() {
return totalLug;
}
public void setTotalLug(int totalLug) {
this.totalLug = totalLug;
}
public int getLugOcup() {
return lugOcup;
}
public void setLugOcup(int lugOcup) {
this.lugOcup = lugOcup;
}
public String getDestino() {
return destino;
}
public void setDestino(String destino) {
this.destino = destino;
}
@Override
public String toString() {
return "numVuelo=" + numVuelo + ", totalLug=" + totalLug + ", lugOcup=" + lugOcup + ", destino=" + destino +"\n";
}
} | [
"noreply@github.com"
] | noreply@github.com |
53f2c855f66257012935104ed003f12fd40a622a | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/JxPath-13/org.apache.commons.jxpath.ri.model.dom.DOMNodePointer/BBC-F0-opt-80/14/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer_ESTest.java | ca53897ec34de1ee48052553191107f20f48422c | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 97,805 | java | /*
* This file was automatically generated by EvoSuite
* Thu Oct 21 00:49:40 GMT 2021
*/
package org.apache.commons.jxpath.ri.model.dom;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.util.LinkedList;
import java.util.Locale;
import org.apache.commons.jxpath.BasicVariables;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.ri.QName;
import org.apache.commons.jxpath.ri.compiler.NodeNameTest;
import org.apache.commons.jxpath.ri.compiler.NodeTest;
import org.apache.commons.jxpath.ri.compiler.NodeTypeTest;
import org.apache.commons.jxpath.ri.compiler.ProcessingInstructionTest;
import org.apache.commons.jxpath.ri.model.NodeIterator;
import org.apache.commons.jxpath.ri.model.NodePointer;
import org.apache.commons.jxpath.ri.model.VariablePointer;
import org.apache.commons.jxpath.ri.model.beans.NullPointer;
import org.apache.commons.jxpath.ri.model.dom.DOMNodePointer;
import org.apache.html.dom.HTMLAnchorElementImpl;
import org.apache.html.dom.HTMLBRElementImpl;
import org.apache.html.dom.HTMLBaseElementImpl;
import org.apache.html.dom.HTMLBodyElementImpl;
import org.apache.html.dom.HTMLDirectoryElementImpl;
import org.apache.html.dom.HTMLDocumentImpl;
import org.apache.html.dom.HTMLFieldSetElementImpl;
import org.apache.html.dom.HTMLFrameElementImpl;
import org.apache.html.dom.HTMLImageElementImpl;
import org.apache.html.dom.HTMLLabelElementImpl;
import org.apache.html.dom.HTMLLinkElementImpl;
import org.apache.html.dom.HTMLMapElementImpl;
import org.apache.html.dom.HTMLObjectElementImpl;
import org.apache.html.dom.HTMLOptGroupElementImpl;
import org.apache.html.dom.HTMLParagraphElementImpl;
import org.apache.html.dom.HTMLQuoteElementImpl;
import org.apache.html.dom.HTMLTableCellElementImpl;
import org.apache.html.dom.HTMLTableElementImpl;
import org.apache.html.dom.HTMLTableSectionElementImpl;
import org.apache.html.dom.HTMLTextAreaElementImpl;
import org.apache.wml.dom.WMLAnchorElementImpl;
import org.apache.wml.dom.WMLDoElementImpl;
import org.apache.wml.dom.WMLDocumentImpl;
import org.apache.wml.dom.WMLEmElementImpl;
import org.apache.wml.dom.WMLFieldsetElementImpl;
import org.apache.wml.dom.WMLIElementImpl;
import org.apache.wml.dom.WMLMetaElementImpl;
import org.apache.wml.dom.WMLNoopElementImpl;
import org.apache.wml.dom.WMLPElementImpl;
import org.apache.wml.dom.WMLRefreshElementImpl;
import org.apache.xerces.dom.AttrNSImpl;
import org.apache.xerces.dom.CDATASectionImpl;
import org.apache.xerces.dom.CommentImpl;
import org.apache.xerces.dom.CoreDocumentImpl;
import org.apache.xerces.dom.DeferredDocumentImpl;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.dom.DocumentTypeImpl;
import org.apache.xerces.dom.ElementDefinitionImpl;
import org.apache.xerces.dom.EntityImpl;
import org.apache.xerces.dom.EntityReferenceImpl;
import org.apache.xerces.dom.PSVIDocumentImpl;
import org.apache.xerces.dom.PSVIElementNSImpl;
import org.apache.xerces.dom.TextImpl;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.testdata.EvoSuiteFile;
import org.junit.runner.RunWith;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMException;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.Text;
import org.w3c.dom.html.HTMLElement;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class DOMNodePointer_ESTest extends DOMNodePointer_ESTest_scaffolding {
@Test(timeout = 4000)
public void test000() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLBodyElementImpl hTMLBodyElementImpl0 = new HTMLBodyElementImpl(hTMLDocumentImpl0, "deaultCcded");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) null);
Locale locale0 = Locale.PRC;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(hTMLBodyElementImpl0, locale0, (String) null);
QName qName0 = dOMNodePointer1.getName();
NodePointer nodePointer0 = dOMNodePointer1.createAttribute(jXPathContext0, qName0);
int int0 = dOMNodePointer1.compareChildNodePointers(nodePointer0, dOMNodePointer0);
assertEquals((-1), int0);
}
@Test(timeout = 4000)
public void test001() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "Cannot create a relative context for a non-existent node: ");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(documentTypeImpl0, locale0, (String) null);
NullPointer nullPointer0 = (NullPointer)dOMNodePointer0.getPointerByID((JXPathContext) null, "Factory is not set on the JXPathContext - cannot create path: ");
assertTrue(nullPointer0.isRoot());
}
@Test(timeout = 4000)
public void test002() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Text text0 = hTMLDocumentImpl0.createTextNode("9");
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
HTMLParagraphElementImpl hTMLParagraphElementImpl0 = new HTMLParagraphElementImpl(hTMLDocumentImpl0, "9");
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, hTMLParagraphElementImpl0);
String string0 = dOMNodePointer1.asPath();
assertEquals("/text()[1]/9[1]", string0);
}
@Test(timeout = 4000)
public void test003() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLFieldSetElementImpl hTMLFieldSetElementImpl0 = new HTMLFieldSetElementImpl(hTMLDocumentImpl0, "P|Qu]Ma&{>^J");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLFieldSetElementImpl0, locale0, "P|Qu]Ma&{>^J");
dOMNodePointer0.setValue("P|Qu]Ma&{>^J");
assertTrue(dOMNodePointer0.isActual());
}
@Test(timeout = 4000)
public void test004() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
boolean boolean0 = dOMNodePointer0.isLanguage("");
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test005() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLFrameElementImpl hTMLFrameElementImpl0 = new HTMLFrameElementImpl(hTMLDocumentImpl0, ":,LoQD@o~p3k3");
String string0 = DOMNodePointer.getPrefix(hTMLFrameElementImpl0);
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test006() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Element element0 = hTMLDocumentImpl0.createElementNS("n", "n", "n");
Locale locale0 = Locale.GERMAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, element0);
String string0 = dOMNodePointer1.getNamespaceURI();
assertNotNull(string0);
assertEquals("n", string0);
}
@Test(timeout = 4000)
public void test007() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "", (String) null, "rqd 2g'B#C;");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLNoopElementImpl wMLNoopElementImpl0 = new WMLNoopElementImpl(wMLDocumentImpl0, "xmlns:");
String string0 = DOMNodePointer.getLocalName(wMLNoopElementImpl0);
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test008() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Text text0 = hTMLDocumentImpl0.createTextNode("9");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
String string0 = dOMNodePointer0.getLanguage();
assertNull(string0);
}
@Test(timeout = 4000)
public void test009() throws Throwable {
Locale locale0 = Locale.PRC;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((Node) null, locale0);
Object object0 = dOMNodePointer0.getImmediateNode();
assertNull(object0);
}
@Test(timeout = 4000)
public void test010() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLTableSectionElementImpl hTMLTableSectionElementImpl0 = new HTMLTableSectionElementImpl(hTMLDocumentImpl0, "ffW$O8Q5^O{2+");
Locale locale0 = new Locale("F`", ":k7YqQpU$bq", "JNRR (");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLTableSectionElementImpl0, locale0);
Object object0 = dOMNodePointer0.getImmediateNode();
assertSame(object0, hTMLTableSectionElementImpl0);
}
@Test(timeout = 4000)
public void test011() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(deferredDocumentImpl0, "|", "|", "|");
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(documentTypeImpl0, locale0);
Object object0 = dOMNodePointer0.getBaseValue();
assertSame(documentTypeImpl0, object0);
}
@Test(timeout = 4000)
public void test012() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "Factory is not set on the JXPathContext - cannot create path: ");
String string0 = DOMNodePointer.findEnclosingAttribute(hTMLLabelElementImpl0, "Factory is not set on the JXPathContext - cannot create path: ");
assertNull(string0);
}
@Test(timeout = 4000)
public void test013() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Text text0 = hTMLDocumentImpl0.createTextNode("9");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
QName qName0 = new QName("org.apache.wml.dom.WMLOptionElementImpl");
NodeIterator nodeIterator0 = dOMNodePointer0.attributeIterator(qName0);
assertEquals(0, nodeIterator0.getPosition());
}
@Test(timeout = 4000)
public void test014() throws Throwable {
QName qName0 = new QName("weZTv^$]&JcNT6", "/");
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0, "/");
// Undeclared exception!
// try {
DOMNodePointer.testNode((Node) null, (NodeTest) nodeNameTest0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test015() throws Throwable {
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((Node) null, locale0);
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("org.apache.html.dom.HTMLAnchorElementImpl@0000000019");
// Undeclared exception!
// try {
dOMNodePointer0.testNode((NodeTest) processingInstructionTest0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test016() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
QName qName0 = new QName("y$/", "defaultChecked");
VariablePointer variablePointer0 = new VariablePointer(qName0);
Locale locale0 = Locale.GERMAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.setValue(variablePointer0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Undefined variable: y$/:defaultChecked
// //
// verifyException("org.apache.commons.jxpath.ri.model.VariablePointer$1", e);
// }
}
@Test(timeout = 4000)
public void test017() throws Throwable {
BasicVariables basicVariables0 = new BasicVariables();
QName qName0 = new QName("@W7");
VariablePointer variablePointer0 = new VariablePointer(basicVariables0, qName0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(variablePointer0, (Node) null);
// Undeclared exception!
// try {
dOMNodePointer0.remove();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test018() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.SIMPLIFIED_CHINESE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
hTMLDocumentImpl0.setReadOnly(true, false);
// Undeclared exception!
// try {
dOMNodePointer0.namespaceIterator();
// fail("Expecting exception: DOMException");
// } catch(DOMException e) {
// //
// // NO_MODIFICATION_ALLOWED_ERR: An attempt is made to modify an object where modifications are not allowed.
// //
// verifyException("org.apache.xerces.dom.ParentNode", e);
// }
}
@Test(timeout = 4000)
public void test019() throws Throwable {
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((Node) null, (Locale) null);
// Undeclared exception!
// try {
dOMNodePointer0.namespaceIterator();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNamespaceIterator", e);
// }
}
@Test(timeout = 4000)
public void test020() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(deferredDocumentImpl0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.isLeaf();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.xerces.dom.DeferredDocumentImpl", e);
// }
}
@Test(timeout = 4000)
public void test021() throws Throwable {
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((Node) null, (Locale) null, "");
// Undeclared exception!
// try {
dOMNodePointer0.isLanguage("weZTv^$]&JcNT6");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.NodePointer", e);
// }
}
@Test(timeout = 4000)
public void test022() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl(true, false);
Locale locale0 = new Locale("7k52;:jtz'DvM>,", "");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(deferredDocumentImpl0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.getValue();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.xerces.dom.DeferredDocumentImpl", e);
// }
}
@Test(timeout = 4000)
public void test023() throws Throwable {
HTMLBRElementImpl hTMLBRElementImpl0 = new HTMLBRElementImpl((HTMLDocumentImpl) null, "|65sFtFA)bvE#]yV-},");
// Undeclared exception!
// try {
DOMNodePointer.getPrefix(hTMLBRElementImpl0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test024() throws Throwable {
Locale locale0 = Locale.TAIWAN;
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) "org.apache.wml.dom.WMLOptionElementImpl");
HTMLTableCellElementImpl hTMLTableCellElementImpl0 = new HTMLTableCellElementImpl((HTMLDocumentImpl) null, "scrolling");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLTableCellElementImpl0, locale0, "http://www.w3.org/XML/1998/namespace");
// Undeclared exception!
// try {
dOMNodePointer0.getPointerByID(jXPathContext0, ",#Z%3.`'3!X");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test025() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
hTMLDocumentImpl0.setReadOnly(true, true);
// Undeclared exception!
// try {
DOMNodePointer.getNamespaceURI((Node) hTMLDocumentImpl0);
// fail("Expecting exception: DOMException");
// } catch(DOMException e) {
// //
// // NO_MODIFICATION_ALLOWED_ERR: An attempt is made to modify an object where modifications are not allowed.
// //
// verifyException("org.apache.xerces.dom.ParentNode", e);
// }
}
@Test(timeout = 4000)
public void test026() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "Cannot create a relative context for a non-existent node: ");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
// Undeclared exception!
// try {
DOMNodePointer.getNamespaceURI((Node) wMLDocumentImpl0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test027() throws Throwable {
CoreDocumentImpl coreDocumentImpl0 = new CoreDocumentImpl();
CDATASection cDATASection0 = coreDocumentImpl0.createCDATASection("org.apache.html.dom.HTMLBaseElementImpl@0000000003");
// Undeclared exception!
// try {
DOMNodePointer.getNamespaceURI((Node) cDATASection0);
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // org.apache.xerces.dom.CDATASectionImpl cannot be cast to org.w3c.dom.Element
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test028() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
hTMLDocumentImpl0.setReadOnly(true, true);
Locale locale0 = Locale.FRENCH;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "/");
// Undeclared exception!
// try {
dOMNodePointer0.getNamespaceURI("WKlu3Kw&*0.v{(%L");
// fail("Expecting exception: DOMException");
// } catch(DOMException e) {
// //
// // NO_MODIFICATION_ALLOWED_ERR: An attempt is made to modify an object where modifications are not allowed.
// //
// verifyException("org.apache.xerces.dom.ParentNode", e);
// }
}
@Test(timeout = 4000)
public void test029() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(deferredDocumentImpl0, (Locale) null);
// Undeclared exception!
// try {
dOMNodePointer0.getNamespaceURI("rqd 2g'B#C;");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.xerces.dom.DeferredDocumentImpl", e);
// }
}
@Test(timeout = 4000)
public void test030() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "9+u_$Q");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLPElementImpl wMLPElementImpl0 = new WMLPElementImpl(wMLDocumentImpl0, "f2s-T`B}rvR;");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(wMLPElementImpl0, locale0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, (Node) null);
// Undeclared exception!
// try {
dOMNodePointer1.getNamespaceURI();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test031() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ROOT;
EntityImpl entityImpl0 = new EntityImpl(hTMLDocumentImpl0, "org.apache.commons.jxpath.ri.JXPathContextReferenceImpl@0000000011");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityImpl0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.getNamespaceURI();
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // org.apache.xerces.dom.EntityImpl cannot be cast to org.w3c.dom.Element
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test032() throws Throwable {
Locale locale0 = Locale.forLanguageTag("Rr_Od>Y");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((Node) null, locale0, "Rr_Od>Y");
// Undeclared exception!
// try {
dOMNodePointer0.getName();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test033() throws Throwable {
// Undeclared exception!
// try {
DOMNodePointer.getLocalName((Node) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test034() throws Throwable {
Locale locale0 = Locale.TAIWAN;
WMLMetaElementImpl wMLMetaElementImpl0 = new WMLMetaElementImpl((WMLDocumentImpl) null, "iwA");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(wMLMetaElementImpl0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.getLanguage();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test035() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
hTMLDocumentImpl0.setReadOnly(true, true);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, (Locale) null);
// Undeclared exception!
// try {
dOMNodePointer0.getDefaultNamespaceURI();
// fail("Expecting exception: DOMException");
// } catch(DOMException e) {
// //
// // NO_MODIFICATION_ALLOWED_ERR: An attempt is made to modify an object where modifications are not allowed.
// //
// verifyException("org.apache.xerces.dom.ParentNode", e);
// }
}
@Test(timeout = 4000)
public void test036() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
Locale locale0 = Locale.CHINESE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(deferredDocumentImpl0, locale0, "|");
// Undeclared exception!
// try {
dOMNodePointer0.getDefaultNamespaceURI();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.xerces.dom.DeferredDocumentImpl", e);
// }
}
@Test(timeout = 4000)
public void test037() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "f2s-T`B}rvR;");
// Undeclared exception!
// try {
DOMNodePointer.findEnclosingAttribute(hTMLLabelElementImpl0, (String) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.html.dom.HTMLElementImpl", e);
// }
}
@Test(timeout = 4000)
public void test038() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
EntityReferenceImpl entityReferenceImpl0 = new EntityReferenceImpl(hTMLDocumentImpl0, "org.apache.wml.dom.WMLOptionElementImpl");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityReferenceImpl0, locale0, "8I1lb");
HTMLObjectElementImpl hTMLObjectElementImpl0 = new HTMLObjectElementImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) "org.apache.wml.dom.WMLOptionElementImpl");
QName qName0 = new QName("W;PZ@-Dk_DtuNAq,u");
// Undeclared exception!
// try {
dOMNodePointer0.createChild(jXPathContext0, qName0, Integer.MIN_VALUE, (Object) hTMLObjectElementImpl0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Factory is not set on the JXPathContext - cannot create path: id('8I1lb')
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test039() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Element element0 = hTMLDocumentImpl0.createElementNS("n", "n", "n");
Locale locale0 = Locale.GERMAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, element0);
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "bR", "http://www.w3.org/2000/xmlns/", "g%n/xr2h5");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLEmElementImpl wMLEmElementImpl0 = new WMLEmElementImpl(wMLDocumentImpl0, ")M@o\"N35-=vq3t]%/'}");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) wMLEmElementImpl0);
// Undeclared exception!
// try {
dOMNodePointer1.createChild(jXPathContext0, (QName) null, (int) (byte) (-48));
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test040() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
PSVIElementNSImpl pSVIElementNSImpl0 = new PSVIElementNSImpl(hTMLDocumentImpl0, "eiA#z]nF", "deaultCcded", "deaultCcded");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) pSVIElementNSImpl0);
Locale locale0 = new Locale("deaultCcded", "eiA#z]nF", "deaultCcded");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(pSVIElementNSImpl0, locale0);
QName qName0 = dOMNodePointer0.getName();
// Undeclared exception!
// try {
dOMNodePointer0.createAttribute(jXPathContext0, qName0);
// fail("Expecting exception: IndexOutOfBoundsException");
// } catch(IndexOutOfBoundsException e) {
// //
// // Index: 0, Size: 0
// //
// verifyException("java.util.ArrayList", e);
// }
}
@Test(timeout = 4000)
public void test041() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "*");
QName qName0 = new QName("*", "*");
VariablePointer variablePointer0 = new VariablePointer(qName0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(variablePointer0, hTMLLabelElementImpl0);
// Undeclared exception!
// try {
dOMNodePointer0.compareChildNodePointers(variablePointer0, variablePointer0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Undefined variable: *:*
// //
// verifyException("org.apache.commons.jxpath.ri.model.VariablePointer", e);
// }
}
@Test(timeout = 4000)
public void test042() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
CDATASectionImpl cDATASectionImpl0 = new CDATASectionImpl(deferredDocumentImpl0, "S34OB)47fN");
Locale locale0 = Locale.SIMPLIFIED_CHINESE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(cDATASectionImpl0, locale0);
QName qName0 = new QName(";I[HaNrIl2-h/a~ __");
NodePointer nodePointer0 = NodePointer.newNodePointer(qName0, (Object) null, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.compareChildNodePointers(nodePointer0, dOMNodePointer0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test043() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
BasicVariables basicVariables0 = new BasicVariables();
QName qName0 = new QName("<<unknown namespace>>");
VariablePointer variablePointer0 = new VariablePointer(basicVariables0, qName0);
// Undeclared exception!
// try {
dOMNodePointer0.compareChildNodePointers(variablePointer0, dOMNodePointer0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // No such variable: '<<unknown namespace>>'
// //
// verifyException("org.apache.commons.jxpath.BasicVariables", e);
// }
}
@Test(timeout = 4000)
public void test044() throws Throwable {
Locale locale0 = new Locale("Hrl#u)e#mb>H9iuM{G'");
QName qName0 = new QName(""");
NodePointer nodePointer0 = NodePointer.newNodePointer(qName0, "Cannot remove root DOM node", locale0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((Node) null, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.compareChildNodePointers(nodePointer0, nodePointer0);
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // java.lang.String cannot be cast to org.w3c.dom.Node
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test045() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl(true, true);
CommentImpl commentImpl0 = new CommentImpl(deferredDocumentImpl0, "' V&\"o(usC8>C/I@6].");
Locale locale0 = Locale.TRADITIONAL_CHINESE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(commentImpl0, locale0, (String) null);
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest(";I[HaNrIl2-h/a~ __");
QName qName0 = new QName("' V&\"o(usC8>C/I@6].");
VariablePointer variablePointer0 = new VariablePointer(qName0);
// Undeclared exception!
// try {
dOMNodePointer0.childIterator(processingInstructionTest0, true, variablePointer0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Undefined variable: ' V&\"o(usC8>C/I@6].
// //
// verifyException("org.apache.commons.jxpath.ri.model.VariablePointer$1", e);
// }
}
@Test(timeout = 4000)
public void test046() throws Throwable {
TextImpl textImpl0 = new TextImpl();
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(textImpl0, locale0);
NodeTypeTest nodeTypeTest0 = new NodeTypeTest((-2116));
BasicVariables basicVariables0 = new BasicVariables();
QName qName0 = new QName("<<unknown namespace>>");
VariablePointer variablePointer0 = new VariablePointer(basicVariables0, qName0);
// Undeclared exception!
// try {
dOMNodePointer0.childIterator(nodeTypeTest0, false, variablePointer0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // No such variable: '<<unknown namespace>>'
// //
// verifyException("org.apache.commons.jxpath.BasicVariables", e);
// }
}
@Test(timeout = 4000)
public void test047() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("http://www.w3.org/2000/xmlns/");
QName qName0 = dOMNodePointer0.getName();
NodePointer nodePointer0 = NodePointer.newChildNodePointer(dOMNodePointer0, qName0, processingInstructionTest0);
// Undeclared exception!
// try {
dOMNodePointer0.childIterator(processingInstructionTest0, false, nodePointer0);
// fail("Expecting exception: ClassCastException");
// } catch(ClassCastException e) {
// //
// // org.apache.commons.jxpath.ri.compiler.ProcessingInstructionTest cannot be cast to org.w3c.dom.Node
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodeIterator", e);
// }
}
@Test(timeout = 4000)
public void test048() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLObjectElementImpl hTMLObjectElementImpl0 = new HTMLObjectElementImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/");
String string0 = DOMNodePointer.getNamespaceURI((Node) hTMLObjectElementImpl0);
assertNull(string0);
}
@Test(timeout = 4000)
public void test049() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Element element0 = hTMLDocumentImpl0.createElementNS("n", "n", "n");
String string0 = DOMNodePointer.getNamespaceURI((Node) element0);
assertNotNull(string0);
assertEquals("n", string0);
}
@Test(timeout = 4000)
public void test050() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "Cannot create relative context for a non-existent node: ");
String string0 = DOMNodePointer.getLocalName(documentTypeImpl0);
assertEquals(" ", string0);
}
@Test(timeout = 4000)
public void test051() throws Throwable {
PSVIDocumentImpl pSVIDocumentImpl0 = new PSVIDocumentImpl();
Element element0 = pSVIDocumentImpl0.createElementNS("http://www.w3.org/2000/xmlns/", "http://www.w3.org/2000/xmlns/", "<<unknown namespace>>");
String string0 = DOMNodePointer.getLocalName(element0);
assertEquals("<<unknown namespace>>", string0);
}
@Test(timeout = 4000)
public void test052() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLMapElementImpl hTMLMapElementImpl0 = new HTMLMapElementImpl(hTMLDocumentImpl0, "S9]K^>RFr43{lT-C");
String string0 = DOMNodePointer.getLocalName(hTMLMapElementImpl0);
assertEquals("S9]K^>RFR43{LT-C", string0);
}
@Test(timeout = 4000)
public void test053() throws Throwable {
PSVIDocumentImpl pSVIDocumentImpl0 = new PSVIDocumentImpl();
String string0 = DOMNodePointer.getPrefix(pSVIDocumentImpl0);
assertNull(string0);
}
@Test(timeout = 4000)
public void test054() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLBodyElementImpl hTMLBodyElementImpl0 = new HTMLBodyElementImpl(hTMLDocumentImpl0, "defaultChecked");
Locale locale0 = Locale.CHINESE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLBodyElementImpl0, locale0);
String string0 = dOMNodePointer0.asPath();
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test055() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, (String) null);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, documentTypeImpl0);
String string0 = dOMNodePointer1.asPath();
assertEquals("id('f2s-T`B}rvR;')", string0);
}
@Test(timeout = 4000)
public void test056() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ROOT;
EntityImpl entityImpl0 = new EntityImpl(hTMLDocumentImpl0, "org.apache.commons.jxpath.ri.JXPathContextReferenceImpl@0000000011");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityImpl0, locale0);
String string0 = dOMNodePointer0.asPath();
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test057() throws Throwable {
CoreDocumentImpl coreDocumentImpl0 = new CoreDocumentImpl();
CDATASection cDATASection0 = coreDocumentImpl0.createCDATASection("org.apache.html.dom.HTMLBaseElementImpl@0000000003");
Locale locale0 = Locale.UK;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(cDATASection0, locale0);
String string0 = dOMNodePointer0.asPath();
assertEquals("/text()[1]", string0);
}
@Test(timeout = 4000)
public void test058() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.GERMAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "bR", "http://www.w3.org/2000/xmlns/", "g%n/xr2h5");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLEmElementImpl wMLEmElementImpl0 = new WMLEmElementImpl(wMLDocumentImpl0, ")M@o\"N35-=vq3t]%/'}");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) wMLEmElementImpl0);
// Undeclared exception!
// try {
dOMNodePointer0.createChild(jXPathContext0, (QName) null, (int) (byte) (-48));
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Factory is not set on the JXPathContext - cannot create path:
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test059() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
String string0 = dOMNodePointer0.getNamespaceURI("xmlns");
assertNotNull(string0);
assertEquals("http://www.w3.org/2000/xmlns/", string0);
}
@Test(timeout = 4000)
public void test060() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.forLanguageTag(",drMXe4$CLK[");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
String string0 = dOMNodePointer0.getNamespaceURI("xml");
assertNotNull(string0);
assertEquals("http://www.w3.org/XML/1998/namespace", string0);
}
@Test(timeout = 4000)
public void test061() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "<=pqJ./`cUNVQtiL4`q");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLPElementImpl wMLPElementImpl0 = new WMLPElementImpl(wMLDocumentImpl0, "<=pqJ./`cUNVQtiL4`q");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(wMLPElementImpl0, locale0);
String string0 = dOMNodePointer0.getNamespaceURI("");
assertNull(string0);
}
@Test(timeout = 4000)
public void test062() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(deferredDocumentImpl0, "|", "|", "|");
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("http://www.w3.org/2000/xmlns/");
boolean boolean0 = DOMNodePointer.testNode((Node) documentTypeImpl0, (NodeTest) processingInstructionTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test063() throws Throwable {
TextImpl textImpl0 = new TextImpl();
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(1);
boolean boolean0 = DOMNodePointer.testNode((Node) textImpl0, (NodeTest) nodeTypeTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test064() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(1);
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLDocumentImpl0, (NodeTest) nodeTypeTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test065() throws Throwable {
boolean boolean0 = DOMNodePointer.testNode((Node) null, (NodeTest) null);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test066() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLTableElementImpl hTMLTableElementImpl0 = new HTMLTableElementImpl(hTMLDocumentImpl0, "PHO\t)q/`3#2ZiDZW3");
HTMLElement hTMLElement0 = hTMLTableElementImpl0.createTFoot();
Locale locale0 = new Locale("~NX*C@}UgLyC{{Zo#", "PHO\t)q/`3#2ZiDZW3", "preserve");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLElement0, locale0, "BUTTON");
String string0 = dOMNodePointer0.getNamespaceURI();
assertNull(string0);
}
@Test(timeout = 4000)
public void test067() throws Throwable {
Locale locale0 = Locale.UK;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((Node) null, locale0);
QName qName0 = new QName("http://www.w3.org/XML/1998/namespace", "");
// Undeclared exception!
// try {
dOMNodePointer0.attributeIterator(qName0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMAttributeIterator", e);
// }
}
@Test(timeout = 4000)
public void test068() throws Throwable {
DOMNodePointer dOMNodePointer0 = new DOMNodePointer((NodePointer) null, (Node) null);
Object object0 = dOMNodePointer0.getBaseValue();
assertNull(object0);
}
@Test(timeout = 4000)
public void test069() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "Cannot create a relative context for a non-existent node: ");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLDoElementImpl wMLDoElementImpl0 = new WMLDoElementImpl(wMLDocumentImpl0, (String) null);
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(documentTypeImpl0, locale0, (String) null);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(wMLDoElementImpl0, locale0);
DOMNodePointer dOMNodePointer2 = new DOMNodePointer(dOMNodePointer0, wMLDocumentImpl0);
int int0 = dOMNodePointer2.compareChildNodePointers(dOMNodePointer0, dOMNodePointer1);
assertEquals((-1), int0);
}
@Test(timeout = 4000)
public void test070() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.PRC;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
String string0 = dOMNodePointer0.getDefaultNamespaceURI();
assertNull(string0);
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, (String) null);
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLAnchorElementImpl wMLAnchorElementImpl0 = new WMLAnchorElementImpl(wMLDocumentImpl0, ",QaUg)A a^\";]JX,");
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(wMLAnchorElementImpl0, locale0, "http://www.w3.org/XML/1998/namespace");
int int0 = dOMNodePointer0.compareChildNodePointers(dOMNodePointer1, dOMNodePointer0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test071() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLBodyElementImpl hTMLBodyElementImpl0 = new HTMLBodyElementImpl(hTMLDocumentImpl0, "defaultChecked");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) hTMLBodyElementImpl0);
Locale locale0 = Locale.PRC;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLBodyElementImpl0, locale0);
QName qName0 = dOMNodePointer0.getName();
NodePointer nodePointer0 = dOMNodePointer0.createAttribute(jXPathContext0, qName0);
int int0 = dOMNodePointer0.compareChildNodePointers(nodePointer0, dOMNodePointer0);
assertEquals((-1), int0);
assertEquals("DEFAULTCHECKED", qName0.getName());
}
@Test(timeout = 4000)
public void test072() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
EntityReferenceImpl entityReferenceImpl0 = new EntityReferenceImpl(hTMLDocumentImpl0, "org.apache.wml.dom.WMLOptionElementImpl");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityReferenceImpl0, locale0, "8I1lb");
int int0 = dOMNodePointer0.compareChildNodePointers(dOMNodePointer0, dOMNodePointer0);
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test073() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
dOMNodePointer0.namespaceIterator();
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) "f2s-T`B}rvR;");
DOMNodePointer dOMNodePointer1 = (DOMNodePointer)dOMNodePointer0.getPointerByID(jXPathContext0, "");
assertFalse(dOMNodePointer1.isContainer());
}
@Test(timeout = 4000)
public void test074() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.PRC;
ProcessingInstruction processingInstruction0 = hTMLDocumentImpl0.createProcessingInstruction("org.apache.commons.jxpath.ri.EvalContext", "Lexical error at line ");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(processingInstruction0, locale0, "org.apache.commons.jxpath.ri.EvalContext");
Object object0 = dOMNodePointer0.getValue();
assertEquals("Lexical error at line", object0);
}
@Test(timeout = 4000)
public void test075() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
ProcessingInstruction processingInstruction0 = hTMLDocumentImpl0.createProcessingInstruction("org.apache.commons.jxpath.JXPathNotFoundException", (String) null);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(processingInstruction0, (Locale) null);
Object object0 = dOMNodePointer0.getValue();
assertEquals("", object0);
}
@Test(timeout = 4000)
public void test076() throws Throwable {
TextImpl textImpl0 = new TextImpl();
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(textImpl0, locale0);
Object object0 = dOMNodePointer0.getValue();
assertEquals("", object0);
}
@Test(timeout = 4000)
public void test077() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.PRC;
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
CDATASectionImpl cDATASectionImpl0 = new CDATASectionImpl(wMLDocumentImpl0, "XqMQ");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(cDATASectionImpl0, locale0);
Object object0 = dOMNodePointer0.getValue();
assertEquals("XqMQ", object0);
}
@Test(timeout = 4000)
public void test078() throws Throwable {
Locale locale0 = Locale.TAIWAN;
DocumentImpl documentImpl0 = new DocumentImpl(false);
CommentImpl commentImpl0 = new CommentImpl(documentImpl0, "HypX'D]W0");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(commentImpl0, locale0, "$X");
Object object0 = dOMNodePointer0.getValue();
assertEquals("HypX'D]W0", object0);
}
@Test(timeout = 4000)
public void test079() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
CommentImpl commentImpl0 = new CommentImpl(hTMLDocumentImpl0, (String) null);
Locale locale0 = Locale.US;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(commentImpl0, locale0, ">S=>\"0~[vVa+1Y73j");
Object object0 = dOMNodePointer0.getValue();
assertEquals("", object0);
}
@Test(timeout = 4000)
public void test080() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.SIMPLIFIED_CHINESE;
HTMLImageElementImpl hTMLImageElementImpl0 = new HTMLImageElementImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLImageElementImpl0, locale0, "http://www.w3.org/2000/xmlns/");
QName qName0 = dOMNodePointer0.getName();
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0, "http://www.w3.org/XML/1998/namespace");
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLImageElementImpl0, (NodeTest) nodeNameTest0);
assertTrue(boolean0);
assertEquals("HTTP://WWW.W3.ORG/2000/XMLNS/", nodeNameTest0.toString());
}
@Test(timeout = 4000)
public void test081() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
String string0 = DOMNodePointer.getNamespaceURI((Node) hTMLDocumentImpl0);
assertNull(string0);
}
@Test(timeout = 4000)
public void test082() throws Throwable {
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl((CoreDocumentImpl) null, "G");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLIElementImpl wMLIElementImpl0 = new WMLIElementImpl(wMLDocumentImpl0, "kdp$b:m@<j_Ty<");
String string0 = DOMNodePointer.getPrefix(wMLIElementImpl0);
assertEquals("kdp$b", string0);
assertNotNull(string0);
}
@Test(timeout = 4000)
public void test083() throws Throwable {
PSVIDocumentImpl pSVIDocumentImpl0 = new PSVIDocumentImpl();
Attr attr0 = pSVIDocumentImpl0.createAttributeNS("<<unknown namespace>>", "http://www.w3.org/XML/1998/namespace", "http://www.w3.org/XML/1998/namespace");
String string0 = DOMNodePointer.getPrefix(attr0);
assertEquals("http", string0);
}
@Test(timeout = 4000)
public void test084() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
EntityReferenceImpl entityReferenceImpl0 = new EntityReferenceImpl(hTMLDocumentImpl0, "org.apache.wml.dom.WMLOptionElementImpl");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityReferenceImpl0, locale0, "8I1lb");
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "org.apache.wml.dom.WMLOptionElementImpl");
boolean boolean0 = dOMNodePointer1.equals(dOMNodePointer0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test085() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ITALIAN;
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, (String) null);
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(wMLDocumentImpl0, locale0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(wMLDocumentImpl0, locale0);
boolean boolean0 = dOMNodePointer0.equals(dOMNodePointer1);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test086() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ITALIAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "slx");
HTMLFrameElementImpl hTMLFrameElementImpl0 = new HTMLFrameElementImpl(hTMLDocumentImpl0, ":,LoQD@o~p3k3");
boolean boolean0 = dOMNodePointer0.equals(hTMLFrameElementImpl0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test087() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLFieldSetElementImpl hTMLFieldSetElementImpl0 = new HTMLFieldSetElementImpl(hTMLDocumentImpl0, "P|Qu]Ma&{>^J");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLFieldSetElementImpl0, locale0, "P|Qu]Ma&{>^J");
boolean boolean0 = dOMNodePointer0.equals(dOMNodePointer0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test088() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ROOT;
HTMLBaseElementImpl hTMLBaseElementImpl0 = new HTMLBaseElementImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLBaseElementImpl0, locale0, "'\"nSD1E88C7Ly");
String string0 = dOMNodePointer0.asPath();
assertEquals("id(''"nSD1E88C7Ly')", string0);
}
@Test(timeout = 4000)
public void test089() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Element element0 = hTMLDocumentImpl0.createElementNS(";", "n", "n");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, element0);
// Undeclared exception!
// try {
dOMNodePointer1.asPath();
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test090() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
EntityReferenceImpl entityReferenceImpl0 = new EntityReferenceImpl(hTMLDocumentImpl0, "org.apache.wml.dom.WMLOptionElementImpl");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityReferenceImpl0, locale0, "8I1lb");
HTMLQuoteElementImpl hTMLQuoteElementImpl0 = new HTMLQuoteElementImpl(hTMLDocumentImpl0, "()?F$q_j$O%|'x");
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, hTMLQuoteElementImpl0);
String string0 = dOMNodePointer1.asPath();
assertEquals("id('8I1lb')/()?F$Q_J$O%|'X[1]", string0);
}
@Test(timeout = 4000)
public void test091() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLElement hTMLElement0 = hTMLDocumentImpl0.getBody();
Locale locale0 = Locale.KOREA;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, hTMLElement0);
String string0 = dOMNodePointer1.asPath();
assertEquals("/BODY[1]", string0);
}
@Test(timeout = 4000)
public void test092() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(deferredDocumentImpl0, "|", "|", "|");
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(documentTypeImpl0, locale0);
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) documentTypeImpl0);
QName qName0 = new QName("/");
// Undeclared exception!
// try {
dOMNodePointer0.createAttribute(jXPathContext0, qName0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Cannot create an attribute for path /@/, operation is not allowed for this type of node
// //
// verifyException("org.apache.commons.jxpath.ri.model.NodePointer", e);
// }
}
@Test(timeout = 4000)
public void test093() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.PRC;
Text text0 = hTMLDocumentImpl0.createTextNode("@M");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
Comment comment0 = hTMLDocumentImpl0.createComment("[Document: ");
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, comment0);
String string0 = dOMNodePointer1.asPath();
assertEquals("/text()[1]", string0);
}
@Test(timeout = 4000)
public void test094() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
ProcessingInstruction processingInstruction0 = hTMLDocumentImpl0.createProcessingInstruction("org.apache.commons.jxpath.JXPathNotFoundException", (String) null);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(processingInstruction0, (Locale) null);
String string0 = dOMNodePointer0.asPath();
assertEquals("/processing-instruction('org.apache.commons.jxpath.JXPathNotFoundException')[1]", string0);
}
@Test(timeout = 4000)
public void test095() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ROOT;
EntityImpl entityImpl0 = new EntityImpl(hTMLDocumentImpl0, "org.apache.commons.jxpath.ri.JXPathContextReferenceImpl@0000000011");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityImpl0, locale0);
QName qName0 = dOMNodePointer0.getName();
// Undeclared exception!
// try {
dOMNodePointer0.createAttribute((JXPathContext) null, qName0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Cannot create an attribute for path /@null, operation is not allowed for this type of node
// //
// verifyException("org.apache.commons.jxpath.ri.model.NodePointer", e);
// }
}
@Test(timeout = 4000)
public void test096() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
EntityReferenceImpl entityReferenceImpl0 = new EntityReferenceImpl(hTMLDocumentImpl0, "org.apache.wml.dom.WMLOptionElementImpl");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityReferenceImpl0, locale0);
String string0 = dOMNodePointer0.asPath();
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test097() throws Throwable {
TextImpl textImpl0 = new TextImpl();
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(textImpl0, locale0);
String string0 = dOMNodePointer0.asPath();
assertEquals("/text()[1]", string0);
}
@Test(timeout = 4000)
public void test098() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ENGLISH;
AttrNSImpl attrNSImpl0 = new AttrNSImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/", "org.apache.html.dom.HTMLHeadingElementImpl", "http://www.w3.org/XML/1998/namespace");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(attrNSImpl0, locale0);
String string0 = dOMNodePointer0.asPath();
assertEquals("", string0);
}
@Test(timeout = 4000)
public void test099() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
EntityReferenceImpl entityReferenceImpl0 = new EntityReferenceImpl(hTMLDocumentImpl0, "org.apache.wml.dom.WMLOptionElementImpl");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(entityReferenceImpl0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.remove();
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Cannot remove root DOM node
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test100() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(deferredDocumentImpl0, "|", "", "|");
DocumentImpl documentImpl0 = new DocumentImpl(documentTypeImpl0);
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(documentTypeImpl0, locale0);
dOMNodePointer0.remove();
assertTrue(dOMNodePointer0.isActual());
}
@Test(timeout = 4000)
public void test101() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLBodyElementImpl hTMLBodyElementImpl0 = new HTMLBodyElementImpl(hTMLDocumentImpl0, "defaultChecked");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) hTMLBodyElementImpl0);
Locale locale0 = Locale.PRC;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLBodyElementImpl0, locale0);
QName qName0 = dOMNodePointer0.getName();
dOMNodePointer0.createAttribute(jXPathContext0, qName0);
dOMNodePointer0.createAttribute(jXPathContext0, qName0);
assertEquals("DEFAULTCHECKED", qName0.getName());
assertEquals("DEFAULTCHECKED", qName0.toString());
}
@Test(timeout = 4000)
public void test102() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLTextAreaElementImpl hTMLTextAreaElementImpl0 = new HTMLTextAreaElementImpl(hTMLDocumentImpl0, "");
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLTextAreaElementImpl0, locale0);
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) "");
QName qName0 = new QName("http://www.w3.org/2000/xmlns/");
// Undeclared exception!
// try {
dOMNodePointer0.createAttribute(jXPathContext0, qName0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Unknown namespace prefix: http
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test103() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
CDATASectionImpl cDATASectionImpl0 = new CDATASectionImpl(deferredDocumentImpl0, "S34OB)47fN");
Locale locale0 = Locale.SIMPLIFIED_CHINESE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(cDATASectionImpl0, locale0);
ElementDefinitionImpl elementDefinitionImpl0 = new ElementDefinitionImpl(deferredDocumentImpl0, "http://www.w3.org/2000/xmlns/");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) elementDefinitionImpl0);
QName qName0 = dOMNodePointer0.getName();
// Undeclared exception!
// try {
dOMNodePointer0.createChild(jXPathContext0, qName0, Integer.MIN_VALUE);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Factory is not set on the JXPathContext - cannot create path: /text()[1]
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test104() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
LinkedList<Locale> linkedList0 = new LinkedList<Locale>();
dOMNodePointer0.setValue(linkedList0);
assertTrue(dOMNodePointer0.isRoot());
}
@Test(timeout = 4000)
public void test105() throws Throwable {
CoreDocumentImpl coreDocumentImpl0 = new CoreDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(coreDocumentImpl0, "]", (String) null, "]");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
ElementDefinitionImpl elementDefinitionImpl0 = new ElementDefinitionImpl(wMLDocumentImpl0, "STYLE");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(elementDefinitionImpl0, (Locale) null, "N!nK2(Q");
// Undeclared exception!
// try {
dOMNodePointer0.setValue("STYLE");
// fail("Expecting exception: ArrayIndexOutOfBoundsException");
// } catch(ArrayIndexOutOfBoundsException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// }
}
@Test(timeout = 4000)
public void test106() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ITALIAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "slx");
dOMNodePointer0.setValue((Object) null);
assertEquals(Integer.MIN_VALUE, dOMNodePointer0.getIndex());
}
@Test(timeout = 4000)
public void test107() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, (Locale) null);
CommentImpl commentImpl0 = new CommentImpl(hTMLDocumentImpl0, (String) null);
dOMNodePointer0.setValue(commentImpl0);
Object object0 = dOMNodePointer0.getValue();
assertEquals("", object0);
}
@Test(timeout = 4000)
public void test108() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.GERMAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "n", "http://www.w3.org/XML/1998/namespace", "x{D^");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLRefreshElementImpl wMLRefreshElementImpl0 = new WMLRefreshElementImpl(wMLDocumentImpl0, "x{D^");
dOMNodePointer0.setValue(wMLRefreshElementImpl0);
assertTrue(dOMNodePointer0.isRoot());
}
@Test(timeout = 4000)
public void test109() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, (Locale) null);
dOMNodePointer0.getNamespaceURI("defer");
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/");
PSVIDocumentImpl pSVIDocumentImpl0 = new PSVIDocumentImpl(documentTypeImpl0);
// Undeclared exception!
// try {
dOMNodePointer0.setValue(pSVIDocumentImpl0);
// fail("Expecting exception: DOMException");
// } catch(DOMException e) {
// //
// // WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
// //
// verifyException("org.apache.xerces.dom.ParentNode", e);
// }
}
@Test(timeout = 4000)
public void test110() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Text text0 = hTMLDocumentImpl0.createTextNode("9");
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
HTMLBaseElementImpl hTMLBaseElementImpl0 = new HTMLBaseElementImpl(hTMLDocumentImpl0, "");
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(hTMLBaseElementImpl0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.setValue(dOMNodePointer1);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test111() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Text text0 = hTMLDocumentImpl0.createTextNode("9");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
// Undeclared exception!
// try {
dOMNodePointer0.setValue((Object) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test112() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
CDATASection cDATASection0 = hTMLDocumentImpl0.createCDATASection("P7p^@IS");
Locale locale0 = Locale.CANADA_FRENCH;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(cDATASection0, locale0);
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) null);
NodePointer nodePointer0 = dOMNodePointer0.createPath(jXPathContext0, (Object) hTMLDocumentImpl0);
assertFalse(nodePointer0.isCollection());
}
@Test(timeout = 4000)
public void test113() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
ProcessingInstruction processingInstruction0 = hTMLDocumentImpl0.createProcessingInstruction("org.adace.omonsjxpat.ri.EvalCntxt", "org.adace.omonsjxpat.ri.EvalCntxt");
BasicVariables basicVariables0 = new BasicVariables();
QName qName0 = new QName("Cannot register namespaces on a sealed NamespaceResolver", "org.adace.omonsjxpat.ri.EvalCntxt");
VariablePointer variablePointer0 = new VariablePointer(basicVariables0, qName0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(variablePointer0, processingInstruction0);
// Undeclared exception!
// try {
dOMNodePointer0.setValue(variablePointer0);
// fail("Expecting exception: IllegalArgumentException");
// } catch(IllegalArgumentException e) {
// //
// // No such variable: 'Cannot register namespaces on a sealed NamespaceResolver:org.adace.omonsjxpat.ri.EvalCntxt'
// //
// verifyException("org.apache.commons.jxpath.BasicVariables", e);
// }
}
@Test(timeout = 4000)
public void test114() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLinkElementImpl hTMLLinkElementImpl0 = new HTMLLinkElementImpl(hTMLDocumentImpl0, "org.apache.wml.dom.WMLSelectElementImpl");
hTMLLinkElementImpl0.setAttribute("org.apache.wml.dom.WMLSelectElementImpl", "3o0ZT!Tx");
String string0 = DOMNodePointer.findEnclosingAttribute(hTMLLinkElementImpl0, "org.apache.wml.dom.WMLSelectElementImpl");
assertNotNull(string0);
assertEquals("3o0ZT!Tx", string0);
}
@Test(timeout = 4000)
public void test115() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Text text0 = hTMLDocumentImpl0.createTextNode("9");
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
boolean boolean0 = dOMNodePointer0.isLeaf();
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test116() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2s-T`B}rvR;");
String string0 = dOMNodePointer0.getDefaultNamespaceURI();
assertNull(string0);
boolean boolean0 = dOMNodePointer0.isLeaf();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test117() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLTableElementImpl hTMLTableElementImpl0 = new HTMLTableElementImpl(hTMLDocumentImpl0, "PHO\t)q/`3#2ZiDZW3");
HTMLElement hTMLElement0 = hTMLTableElementImpl0.createTFoot();
Locale locale0 = new Locale("~NX*C@}UgLyC{{Zo#", "PHO\t)q/`3#2ZiDZW3", "preserve");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLElement0, locale0, "BUTTON");
String string0 = dOMNodePointer0.getDefaultNamespaceURI();
assertNull(string0);
}
@Test(timeout = 4000)
public void test118() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.TAIWAN;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0, "f2N-T`]}rvR;");
dOMNodePointer0.getDefaultNamespaceURI();
String string0 = dOMNodePointer0.getDefaultNamespaceURI();
assertNull(string0);
}
@Test(timeout = 4000)
public void test119() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(deferredDocumentImpl0, "|", "|", "|");
DocumentImpl documentImpl0 = new DocumentImpl(documentTypeImpl0);
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(documentImpl0, locale0);
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("http://www.w3.org/2000/xmlns/");
NodePointer nodePointer0 = dOMNodePointer0.namespacePointer("|");
dOMNodePointer0.childIterator(processingInstructionTest0, false, nodePointer0);
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
ElementDefinitionImpl elementDefinitionImpl0 = hTMLDocumentImpl0.createElementDefinition("org.apache.wml.dom.WMLGoElementImpl");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) elementDefinitionImpl0);
// Undeclared exception!
// try {
jXPathContext0.getRelativeContext(nodePointer0);
// fail("Expecting exception: RuntimeException");
// } catch(RuntimeException e) {
// //
// // Cannot create a relative context for a non-existent node: /namespace::|
// //
// verifyException("org.apache.commons.jxpath.ri.JXPathContextReferenceImpl", e);
// }
}
@Test(timeout = 4000)
public void test120() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.KOREA;
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "3@#0NqQNdr[z%Q?M");
QName qName0 = new QName("xmlns", "domain");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLLabelElementImpl0, locale0, "] ");
HTMLBodyElementImpl hTMLBodyElementImpl0 = new HTMLBodyElementImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) hTMLBodyElementImpl0);
// Undeclared exception!
// try {
dOMNodePointer0.createAttribute(jXPathContext0, qName0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMAttributeIterator", e);
// }
}
@Test(timeout = 4000)
public void test121() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.UK;
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "{Na");
QName qName0 = new QName("xml", "/");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLLabelElementImpl0, locale0, "0-jc y1KyGc&Zy]!");
HTMLAnchorElementImpl hTMLAnchorElementImpl0 = new HTMLAnchorElementImpl(hTMLDocumentImpl0, "http://www.w3.org/2000/xmlns/");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) hTMLAnchorElementImpl0);
// Undeclared exception!
// try {
dOMNodePointer0.createAttribute(jXPathContext0, qName0);
// fail("Expecting exception: DOMException");
// } catch(DOMException e) {
// //
// // INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
// //
// verifyException("org.apache.xerces.dom.CoreDocumentImpl", e);
// }
}
@Test(timeout = 4000)
public void test122() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(deferredDocumentImpl0, locale0);
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("http://www.w3.org/2000/xmlns/");
NodePointer nodePointer0 = dOMNodePointer0.namespacePointer("");
// Undeclared exception!
// try {
dOMNodePointer0.childIterator(processingInstructionTest0, false, nodePointer0);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.xerces.dom.DeferredDocumentImpl", e);
// }
}
@Test(timeout = 4000)
public void test123() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
ProcessingInstruction processingInstruction0 = hTMLDocumentImpl0.createProcessingInstruction("org.adace.omonsjxpat.ri.EvalCntxt", "org.adace.omonsjxpat.ri.EvalCntxt");
BasicVariables basicVariables0 = new BasicVariables();
QName qName0 = new QName("Cannot register namespaces on a sealed NamespaceResolver", "org.adace.omonsjxpat.ri.EvalCntxt");
VariablePointer variablePointer0 = new VariablePointer(basicVariables0, qName0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(variablePointer0, processingInstruction0);
String string0 = dOMNodePointer0.getNamespaceURI("BrY%AWX(]gN<*U");
assertNull(string0);
}
@Test(timeout = 4000)
public void test124() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
String string0 = dOMNodePointer0.getNamespaceURI((String) null);
assertNull(string0);
}
@Test(timeout = 4000)
public void test125() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.PRC;
ProcessingInstruction processingInstruction0 = hTMLDocumentImpl0.createProcessingInstruction("org.apache.commons.jxpath.ri.EvalContext", "3@#0NqQNdr[z%Q?M");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(processingInstruction0, locale0);
QName qName0 = dOMNodePointer0.getName();
assertEquals("org.apache.commons.jxpath.ri.EvalContext", qName0.toString());
}
@Test(timeout = 4000)
public void test126() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
ProcessingInstruction processingInstruction0 = hTMLDocumentImpl0.createProcessingInstruction("org.apache.commonsjxpath.ri.EvalContxt", "lib");
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("diP!f5=)V\"q#(^s");
boolean boolean0 = DOMNodePointer.testNode((Node) processingInstruction0, (NodeTest) processingInstructionTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test127() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "Lexical error at line ");
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(3);
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLLabelElementImpl0, (NodeTest) nodeTypeTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test128() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "d@f~6>_i;>|\"");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(2);
boolean boolean0 = DOMNodePointer.testNode((Node) wMLDocumentImpl0, (NodeTest) nodeTypeTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test129() throws Throwable {
TextImpl textImpl0 = new TextImpl();
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(2);
boolean boolean0 = DOMNodePointer.testNode((Node) textImpl0, (NodeTest) nodeTypeTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test130() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.PRC;
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(1);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, locale0);
boolean boolean0 = dOMNodePointer0.testNode((NodeTest) nodeTypeTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test131() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(1);
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, "/", "/", "/");
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
WMLFieldsetElementImpl wMLFieldsetElementImpl0 = new WMLFieldsetElementImpl(wMLDocumentImpl0, "/");
boolean boolean0 = DOMNodePointer.testNode((Node) wMLFieldsetElementImpl0, (NodeTest) nodeTypeTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test132() throws Throwable {
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(34);
PSVIDocumentImpl pSVIDocumentImpl0 = new PSVIDocumentImpl();
CommentImpl commentImpl0 = new CommentImpl(pSVIDocumentImpl0, "path");
boolean boolean0 = DOMNodePointer.testNode((Node) commentImpl0, (NodeTest) nodeTypeTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test133() throws Throwable {
TextImpl textImpl0 = new TextImpl();
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(4);
boolean boolean0 = DOMNodePointer.testNode((Node) textImpl0, (NodeTest) nodeTypeTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test134() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(3);
Comment comment0 = hTMLDocumentImpl0.createComment("optional");
boolean boolean0 = DOMNodePointer.testNode((Node) comment0, (NodeTest) nodeTypeTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test135() throws Throwable {
NodeTypeTest nodeTypeTest0 = new NodeTypeTest(2);
CoreDocumentImpl coreDocumentImpl0 = new CoreDocumentImpl((DocumentType) null, false);
CDATASectionImpl cDATASectionImpl0 = new CDATASectionImpl(coreDocumentImpl0, "~>Ut::&gE");
boolean boolean0 = DOMNodePointer.testNode((Node) cDATASectionImpl0, (NodeTest) nodeTypeTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test136() throws Throwable {
DeferredDocumentImpl deferredDocumentImpl0 = new DeferredDocumentImpl();
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(deferredDocumentImpl0, "|", "|", "|");
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(documentTypeImpl0, locale0);
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("http://www.w3.org/2000/xmlns/");
boolean boolean0 = dOMNodePointer0.testNode((NodeTest) processingInstructionTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test137() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.SIMPLIFIED_CHINESE;
HTMLImageElementImpl hTMLImageElementImpl0 = new HTMLImageElementImpl(hTMLDocumentImpl0, "YH6Iy<");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLImageElementImpl0, locale0, "http://www.w3.org/2000/xmlns/");
QName qName0 = dOMNodePointer0.getName();
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0, "http://www.w3.org/XML/1998/namespace");
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLImageElementImpl0, (NodeTest) nodeNameTest0);
assertEquals("YH6IY<", nodeNameTest0.toString());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test138() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLOptGroupElementImpl hTMLOptGroupElementImpl0 = new HTMLOptGroupElementImpl(hTMLDocumentImpl0, "/");
QName qName0 = new QName("xml:space", "/");
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0, "xml:space");
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLOptGroupElementImpl0, (NodeTest) nodeNameTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test139() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLDirectoryElementImpl hTMLDirectoryElementImpl0 = new HTMLDirectoryElementImpl(hTMLDocumentImpl0, ":#7[]zxHET< jR^cP");
QName qName0 = new QName(":#7[]zxHET< jR^cP", "pI7<;JR# ~");
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0);
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLDirectoryElementImpl0, (NodeTest) nodeNameTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test140() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "*");
QName qName0 = new QName("*");
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0);
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLLabelElementImpl0, (NodeTest) nodeNameTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test141() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Element element0 = hTMLDocumentImpl0.createElementNS("v", "v", "v");
QName qName0 = new QName("<<unknown namespace>>", "v");
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0);
boolean boolean0 = DOMNodePointer.testNode((Node) element0, (NodeTest) nodeNameTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test142() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLDocumentImpl0, (Locale) null);
QName qName0 = dOMNodePointer0.getName();
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0, "<<unknown namespace>>");
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLDocumentImpl0, (NodeTest) nodeNameTest0);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test143() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "*");
QName qName0 = new QName("*", "*");
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0);
boolean boolean0 = DOMNodePointer.testNode((Node) hTMLLabelElementImpl0, (NodeTest) nodeNameTest0);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test144() throws Throwable {
TextImpl textImpl0 = new TextImpl();
Locale locale0 = Locale.ROOT;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(textImpl0, locale0);
boolean boolean0 = dOMNodePointer0.isActual();
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test145() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "z.o~ha9vS`2K$(k");
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLLabelElementImpl0, (Locale) null);
dOMNodePointer0.hashCode();
}
@Test(timeout = 4000)
public void test146() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "*");
Locale locale0 = Locale.CANADA_FRENCH;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLLabelElementImpl0, locale0, "2]Y}");
int int0 = dOMNodePointer0.getLength();
assertEquals(1, int0);
}
@Test(timeout = 4000)
public void test147() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Text text0 = hTMLDocumentImpl0.createTextNode("9");
Locale locale0 = Locale.FRANCE;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(text0, locale0);
QName qName0 = new QName("org.apache.wml.dom.WMLOptionElementImpl");
// Undeclared exception!
// try {
dOMNodePointer0.createChild((JXPathContext) null, qName0, 2211, (Object) "org.apache.wml.dom.WMLOptionElementImpl");
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("org.apache.commons.jxpath.ri.model.dom.DOMNodePointer", e);
// }
}
@Test(timeout = 4000)
public void test148() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "2");
QName qName0 = new QName(" ", "2");
Locale locale0 = Locale.JAPANESE;
NodePointer nodePointer0 = NodePointer.newNodePointer(qName0, qName0, locale0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(nodePointer0, hTMLLabelElementImpl0);
DOMNodePointer dOMNodePointer1 = new DOMNodePointer(dOMNodePointer0, hTMLLabelElementImpl0);
String string0 = dOMNodePointer1.asPath();
assertEquals("/2[1]", string0);
}
@Test(timeout = 4000)
public void test149() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
Locale locale0 = Locale.ITALIAN;
DocumentTypeImpl documentTypeImpl0 = new DocumentTypeImpl(hTMLDocumentImpl0, (String) null);
WMLDocumentImpl wMLDocumentImpl0 = new WMLDocumentImpl(documentTypeImpl0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(wMLDocumentImpl0, locale0);
boolean boolean0 = dOMNodePointer0.isCollection();
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test150() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLLabelElementImpl hTMLLabelElementImpl0 = new HTMLLabelElementImpl(hTMLDocumentImpl0, "2");
QName qName0 = new QName(" ", "2");
Locale locale0 = Locale.JAPANESE;
NodePointer nodePointer0 = NodePointer.newNodePointer(qName0, qName0, locale0);
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(nodePointer0, hTMLLabelElementImpl0);
boolean boolean0 = dOMNodePointer0.isLanguage("<<unknown namespace>>");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test151() throws Throwable {
HTMLDocumentImpl hTMLDocumentImpl0 = new HTMLDocumentImpl();
HTMLBodyElementImpl hTMLBodyElementImpl0 = new HTMLBodyElementImpl(hTMLDocumentImpl0, "defaultChecked");
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) hTMLBodyElementImpl0);
Locale locale0 = Locale.PRC;
DOMNodePointer dOMNodePointer0 = new DOMNodePointer(hTMLBodyElementImpl0, locale0);
QName qName0 = dOMNodePointer0.getName();
NodePointer nodePointer0 = dOMNodePointer0.createAttribute(jXPathContext0, qName0);
int int0 = dOMNodePointer0.compareChildNodePointers(dOMNodePointer0, nodePointer0);
assertEquals("DEFAULTCHECKED", qName0.toString());
assertEquals(1, int0);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
2612d352cc00f67a68b740d43d2979e520c8a9a7 | 663251fb1ea6ca115d4882f56f460e72dfd79997 | /src/main/java/com/fsc/generate/model/db/ddo/ToolsOperation.java | c7afd07a4448c5b00f47aaee25541cd79f956ac2 | [] | no_license | ArvinZhang2018/UAT-TOOLS | d92434c1e99628ccd87e482a47bc944efa613735 | 186832da613fb0fdcc359eb9521133e7981a6e77 | refs/heads/master | 2020-07-23T14:25:42.364746 | 2019-09-10T15:20:01 | 2019-09-10T15:20:01 | 207,591,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,308 | java | package com.fsc.generate.model.db.ddo;
import com.fsc.generate.annotation.CrmColumn;
import com.fsc.generate.annotation.CrmExecuteSql;
public class ToolsOperation {
@CrmColumn("id")
private long id;
@CrmColumn("module")
private int module;
@CrmColumn("operation")
private int operation;
@CrmColumn("tag")
private String tag;
@CrmColumn("op_name_cn")
private String opNameCn;
@CrmColumn("op_name_en")
private String opNameEn;
@CrmColumn("op_description_cn")
private String opDescriptionCn;
@CrmColumn("op_description_en")
private String opDescriptionEn;
@CrmColumn("click_count")
private long clickCount;
@CrmColumn("color")
private int color;
@CrmColumn("sort_no")
private int sortNo;
@CrmColumn("score")
private int score;
@CrmColumn("optimize_vote")
private int optimizeVote;
@CrmColumn("like")
private long like;
@CrmColumn("status")
private int status;
@CrmColumn("luck_op")
private int luckOp;
@CrmColumn("execute_method")
private String executeMethod;
@CrmColumn("configs")
private String configs;
public static final String QUERY_ALL_OPERATIONS = "queryAllOperations";
public static final String UPDATE_OPERATIONS_ADD_CLICK_AMOUNT = "updateOperationsAddClickAmount";
@CrmExecuteSql("select * from crm_x_operation where status = 0 order by sort_no")
public void queryAllOperations(){
}
@CrmExecuteSql("update crm_x_operation set click_count = click_count + 1 where operation = ?")
public void updateOperationsAddClickAmount(){
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getModule() {
return module;
}
public void setModule(int module) {
this.module = module;
}
public int getOperation() {
return operation;
}
public void setOperation(int operation) {
this.operation = operation;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getOpNameCn() {
return opNameCn;
}
public void setOpNameCn(String opNameCn) {
this.opNameCn = opNameCn;
}
public String getOpNameEn() {
return opNameEn;
}
public void setOpNameEn(String opNameEn) {
this.opNameEn = opNameEn;
}
public String getOpDescriptionCn() {
return opDescriptionCn;
}
public void setOpDescriptionCn(String opDescriptionCn) {
this.opDescriptionCn = opDescriptionCn;
}
public String getOpDescriptionEn() {
return opDescriptionEn;
}
public void setOpDescriptionEn(String opDescriptionEn) {
this.opDescriptionEn = opDescriptionEn;
}
public long getClickCount() {
return clickCount;
}
public void setClickCount(long clickCount) {
this.clickCount = clickCount;
}
public int getColor() {
return color;
}
public void setColor(int color) {
this.color = color;
}
public int getSortNo() {
return sortNo;
}
public void setSortNo(int sortNo) {
this.sortNo = sortNo;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public int getOptimizeVote() {
return optimizeVote;
}
public void setOptimizeVote(int optimizeVote) {
this.optimizeVote = optimizeVote;
}
public long getLike() {
return like;
}
public void setLike(long like) {
this.like = like;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getLuckOp() {
return luckOp;
}
public void setLuckOp(int luckOp) {
this.luckOp = luckOp;
}
public String getExecuteMethod() {
return executeMethod;
}
public void setExecuteMethod(String executeMethod) {
this.executeMethod = executeMethod;
}
public String getConfigs() {
return configs;
}
public void setConfigs(String configs) {
this.configs = configs;
}
}
| [
"arvin.zhang@valorosoltd.com"
] | arvin.zhang@valorosoltd.com |
38003625c75ce4c188b186ffd31075a6043190a6 | ac4e4bb558ee1ef17e94c61078e2c3534b834118 | /app/src/main/java/com/example/projectdemo/BrainTumour.java | 5e0eb39941b4eda6c7015dce467269e05c1877b8 | [] | no_license | tanmaybhosale13/Health-care-application | 454265b63ab8fd9ec6bf0def46683d9e260220cb | c78475d6d40e1eae8e3e9dcf2a882eca7a107c88 | refs/heads/master | 2023-03-23T20:49:19.748055 | 2021-03-12T14:23:07 | 2021-03-12T14:23:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.example.projectdemo;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class BrainTumour extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tumour);
}
}
| [
"tanmay.v.bhosale13@gmail.com"
] | tanmay.v.bhosale13@gmail.com |
ce096e750982da12c248fa514be73231d4e3207b | 6c60d7b3665629fc418ebfbf443373a76638a247 | /parking-domain-model/src/main/java/girnara/abhay/parking/domain/model/spots/LargeSpot.java | 9f0008878fe2dce35c159aad801d05964351f267 | [] | no_license | girnara/parking-manager | 6216ac3afba48d07497f926a6d3bc180d06e969f | 5eb06cdf0a03ec5a13bb6240dc33cfd796950a99 | refs/heads/master | 2020-05-03T09:29:52.199689 | 2019-04-21T06:07:22 | 2019-04-21T06:07:51 | 178,555,417 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 688 | java | package girnara.abhay.parking.domain.model.spots;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import girnara.abhay.parking.domain.model.commons.AbstractConstants;
import lombok.Data;
import java.io.Serializable;
/**
* Created by abhay on 30/03/19.
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class LargeSpot extends ParkingSpot implements Serializable {
private static final long serialVersionUID = 8635045707308476081L;
/**
* Instantiates a new Large spot.
*/
public LargeSpot() {
super(AbstractConstants.ParkingSpotType.LARGE);
}
}
| [
"girnara.abhay@gmail.com"
] | girnara.abhay@gmail.com |
537a0ec301b7168e400705c9059b08fded46ac04 | 43c223a9503f085dc77001838862253d26d92d0e | /src/webkitwrapper/InspectorClientImpl.java | 3c9a5109144e452e7f9188f9dd007694ac6183b9 | [] | no_license | whamtet/Webkit-Wrapper | f80c60a71d4bed2b9eed637427a98049890f4787 | 01a9d10ee6172bcb424edbf17d0ef1556c9d75df | refs/heads/master | 2021-01-17T19:08:53.325903 | 2016-08-01T06:24:28 | 2016-08-01T06:24:28 | 64,641,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package webkitwrapper;
import com.sun.webkit.InspectorClient;
public class InspectorClientImpl implements InspectorClient {
@Override
public boolean sendMessageToFrontend(String arg0) {
// TODO Auto-generated method stub
return true;
}
}
| [
"whamtet@gmail.com"
] | whamtet@gmail.com |
af8b7e46c24e57431acc618fcd286a124696219f | 1f47217ad740b03b5ca7c965a01788dee3c0fbf7 | /JLibrary06/lib/XML/JAXB/jaxb/src/com/sun/xml/bind/v2/model/impl/TypeInfoSetImpl.java | b86c41441100e0c1880fb90955d3831094408238 | [] | no_license | amitabha66/JLibrary06 | bee7fddca01188991af968a5678fe1d89dce7ee3 | f19056cee7a88318315f9c25f8618aface8f0683 | refs/heads/master | 2021-01-19T07:03:19.133486 | 2016-06-23T16:41:59 | 2016-06-23T16:41:59 | 61,802,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,684 | java | package com.sun.xml.bind.v2.model.impl;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
import javax.xml.transform.Result;
import com.sun.xml.bind.v2.model.annotation.AnnotationReader;
import com.sun.xml.bind.v2.model.core.BuiltinLeafInfo;
import com.sun.xml.bind.v2.model.core.ClassInfo;
import com.sun.xml.bind.v2.model.core.LeafInfo;
import com.sun.xml.bind.v2.model.core.NonElement;
import com.sun.xml.bind.v2.model.core.Ref;
import com.sun.xml.bind.v2.model.core.TypeInfo;
import com.sun.xml.bind.v2.model.core.TypeInfoSet;
import com.sun.xml.bind.v2.model.nav.Navigator;
import com.sun.xml.bind.v2.runtime.IllegalAnnotationException;
import com.sun.xml.bind.v2.runtime.RuntimeUtil;
import com.sun.xml.bind.v2.util.FlattenIterator;
/**
* Set of {@link TypeInfo}s.
*
* <p>
* This contains a fixed set of {@link LeafInfo}s and arbitrary set of {@link ClassInfo}s.
*
* <p>
* Members are annotated with JAXB annotations so that we can dump it easily.
*
* @author Kohsuke Kawaguchi
*/
class TypeInfoSetImpl<T,C,F,M> implements TypeInfoSet<T,C,F,M> {
@XmlTransient
public final Navigator<T,C,F,M> nav;
@XmlTransient
public final AnnotationReader<T,C,F,M> reader;
/**
* All the leaves.
*/
private final Map<T,BuiltinLeafInfo<T,C>> builtins =
new LinkedHashMap<T,BuiltinLeafInfo<T,C>>();
/** All {@link EnumLeafInfoImpl}s. */
private final Map<C,EnumLeafInfoImpl<T,C,F,M>> enums =
new LinkedHashMap<C,EnumLeafInfoImpl<T,C,F,M>>();
/** All {@link ArrayInfoImpl}s. */
private final Map<T,ArrayInfoImpl<T,C,F,M>> arrays =
new LinkedHashMap<T,ArrayInfoImpl<T,C,F,M>>();
/**
* All the user-defined classes.
*
* Using {@link LinkedHashMap} allows us to process classes
* in the order they are given to us. When the user incorrectly
* puts an unexpected class into a reference graph, this causes
* an error to be reported on a class closer to the user's code.
*/
@XmlJavaTypeAdapter(RuntimeUtil.ToStringAdapter.class)
private final Map<C,ClassInfoImpl<T,C,F,M>> beans
= new LinkedHashMap<C,ClassInfoImpl<T,C,F,M>>();
@XmlTransient
private final Map<C,ClassInfoImpl<T,C,F,M>> beansView =
Collections.unmodifiableMap(beans);
/**
* The element mapping.
*/
private final Map<C,Map<QName,ElementInfoImpl<T,C,F,M>>> elementMappings =
new LinkedHashMap<C,Map<QName,ElementInfoImpl<T,C,F,M>>>();
private final Iterable<? extends ElementInfoImpl<T,C,F,M>> allElements =
new Iterable<ElementInfoImpl<T,C,F,M>>() {
public Iterator<ElementInfoImpl<T,C,F,M>> iterator() {
return new FlattenIterator<ElementInfoImpl<T,C,F,M>>(elementMappings.values());
}
};
/**
* {@link TypeInfo} for <tt>xs:anyType</tt>.
*
* anyType is the only {@link TypeInfo} that works with an interface,
* and accordingly it requires a lot of special casing.
*/
private final NonElement<T,C> anyType;
/**
* Lazily parsed set of {@link XmlNs}s.
*
* @see #getXmlNs(String)
*/
private Map<String,Map<String,String>> xmlNsCache;
public TypeInfoSetImpl(Navigator<T,C,F,M> nav,
AnnotationReader<T,C,F,M> reader,
Map<T,? extends BuiltinLeafInfoImpl<T,C>> leaves) {
this.nav = nav;
this.reader = reader;
this.builtins.putAll(leaves);
this.anyType = createAnyType();
// register primitive types.
for (Map.Entry<Class, Class> e : RuntimeUtil.primitiveToBox.entrySet()) {
this.builtins.put( nav.getPrimitive(e.getKey()), leaves.get(nav.ref(e.getValue())) );
}
// make sure at lease we got a map for global ones.
elementMappings.put(null,new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>());
}
protected NonElement<T,C> createAnyType() {
return new AnyTypeImpl<T,C>(nav);
}
public Navigator<T,C,F,M> getNavigator() {
return nav;
}
/**
* Adds a new {@link ClassInfo} to the set.
*/
public void add( ClassInfoImpl<T,C,F,M> ci ) {
beans.put( ci.getClazz(), ci );
}
/**
* Adds a new {@link LeafInfo} to the set.
*/
public void add( EnumLeafInfoImpl<T,C,F,M> li ) {
enums.put( li.clazz, li );
}
public void add(ArrayInfoImpl<T, C, F, M> ai) {
arrays.put( ai.getType(), ai );
}
/**
* Returns a {@link TypeInfo} for the given type.
*
* @return
* null if the specified type cannot be bound by JAXB, or
* not known to this set.
*/
public NonElement<T,C> getTypeInfo( T type ) {
type = nav.erasure(type); // replace type variables by their bounds
LeafInfo<T,C> l = builtins.get(type);
if(l!=null) return l;
if( nav.isArray(type) ) {
return arrays.get(type);
}
C d = nav.asDecl(type);
if(d==null) return null;
return getClassInfo(d);
}
public NonElement<T,C> getAnyTypeInfo() {
return anyType;
}
/**
* This method is used to add a root reference to a model.
*/
public NonElement<T,C> getTypeInfo(Ref<T,C> ref) {
// TODO: handle XmlValueList
assert !ref.valueList;
C c = nav.asDecl(ref.type);
if(c!=null && reader.getClassAnnotation(XmlRegistry.class,c,null/*TODO: is this right?*/)!=null) {
return null; // TODO: is this correct?
} else
return getTypeInfo(ref.type);
}
/**
* Returns all the {@link ClassInfo}s known to this set.
*/
public Map<C,? extends ClassInfoImpl<T,C,F,M>> beans() {
return beansView;
}
public Map<T, ? extends BuiltinLeafInfo<T,C>> builtins() {
return builtins;
}
public Map<C, ? extends EnumLeafInfoImpl<T,C,F,M>> enums() {
return enums;
}
public Map<? extends T, ? extends ArrayInfoImpl<T,C,F,M>> arrays() {
return arrays;
}
/**
* Returns a {@link ClassInfo} for the given bean.
*
* <p>
* This method is almost like refinement of {@link #getTypeInfo(Object)} except
* our C cannot derive from T.
*
* @return
* null if the specified type is not bound by JAXB or otherwise
* unknown to this set.
*/
public NonElement<T,C> getClassInfo( C type ) {
LeafInfo<T,C> l = builtins.get(nav.use(type));
if(l!=null) return l;
l = enums.get(type);
if(l!=null) return l;
if(nav.asDecl(Object.class).equals(type))
return anyType;
return beans.get(type);
}
public ElementInfoImpl<T,C,F,M> getElementInfo( C scope, QName name ) {
while(scope!=null) {
Map<QName,ElementInfoImpl<T,C,F,M>> m = elementMappings.get(scope);
if(m!=null) {
ElementInfoImpl<T,C,F,M> r = m.get(name);
if(r!=null) return r;
}
scope = nav.getSuperClass(scope);
}
return elementMappings.get(null).get(name);
}
/**
* @param builder
* used for reporting errors.
*/
public final void add( ElementInfoImpl<T,C,F,M> ei, ModelBuilder<T,C,F,M> builder ) {
C scope = null;
if(ei.getScope()!=null)
scope = ei.getScope().getClazz();
Map<QName,ElementInfoImpl<T,C,F,M>> m = elementMappings.get(scope);
if(m==null)
elementMappings.put(scope,m=new LinkedHashMap<QName,ElementInfoImpl<T,C,F,M>>());
ElementInfoImpl<T,C,F,M> existing = m.put(ei.getElementName(),ei);
if(existing!=null) {
QName en = ei.getElementName();
builder.reportError(
new IllegalAnnotationException(
Messages.CONFLICTING_XML_ELEMENT_MAPPING.format(en.getNamespaceURI(),en.getLocalPart()),
ei, existing ));
}
}
public Map<QName,? extends ElementInfoImpl<T,C,F,M>> getElementMappings( C scope ) {
return elementMappings.get(scope);
}
public Iterable<? extends ElementInfoImpl<T,C,F,M>> getAllElements() {
return allElements;
}
public Map<String,String> getXmlNs(String namespaceUri) {
if(xmlNsCache==null) {
xmlNsCache = new HashMap<String,Map<String,String>>();
for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
if(xs==null)
continue;
String uri = xs.namespace();
Map<String,String> m = xmlNsCache.get(uri);
if(m==null)
xmlNsCache.put(uri,m=new HashMap<String, String>());
for( XmlNs xns : xs.xmlns() ) {
m.put(xns.prefix(),xns.namespaceURI());
}
}
}
Map<String,String> r = xmlNsCache.get(namespaceUri);
if(r!=null) return r;
else return Collections.emptyMap();
}
public Map<String,String> getSchemaLocations() {
Map<String, String> r = new HashMap<String,String>();
for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
if(xs==null)
continue;
String loc = xs.location();
if(loc.equals(XmlSchema.NO_LOCATION))
continue; // unspecified
r.put(xs.namespace(),loc);
}
return r;
}
public final XmlNsForm getElementFormDefault(String nsUri) {
for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
if(xs==null)
continue;
if(!xs.namespace().equals(nsUri))
continue;
XmlNsForm xnf = xs.elementFormDefault();
if(xnf!=XmlNsForm.UNSET)
return xnf;
}
return XmlNsForm.UNSET;
}
public final XmlNsForm getAttributeFormDefault(String nsUri) {
for (ClassInfoImpl<T,C,F,M> ci : beans().values()) {
XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
if(xs==null)
continue;
if(!xs.namespace().equals(nsUri))
continue;
XmlNsForm xnf = xs.attributeFormDefault();
if(xnf!=XmlNsForm.UNSET)
return xnf;
}
return XmlNsForm.UNSET;
}
/**
* Dumps this model into XML.
*
* For debug only.
*
* TODO: not sure if this actually works. We don't really know what are T,C.
*/
public void dump( Result out ) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(this.getClass());
Marshaller m = context.createMarshaller();
m.marshal(this,out);
}
}
| [
"amitabha66@gmail.com"
] | amitabha66@gmail.com |
087e99eba08d20ba7ef0c85b8d1444b8b6e512e6 | d4348f9c816bf3ac4bcf31fa4947a4d3637440f9 | /src/main/java/com/xiao/deng/base/B.java | a452e0cba0d63650b0b898ce120e907e551232a2 | [
"Apache-2.0"
] | permissive | dxCarl/LeetCode | 5aaf4a8c53d7345e7773f0f77a0ee3c0adc66192 | 3e2c7164a438b4f96996547d74fcb9356a4c339a | refs/heads/master | 2022-06-30T17:48:27.865766 | 2022-02-16T03:37:40 | 2022-02-16T03:37:40 | 244,902,129 | 3 | 0 | Apache-2.0 | 2022-06-17T03:28:47 | 2020-03-04T13:04:15 | Java | UTF-8 | Java | false | false | 1,065 | java | package com.xiao.deng.base;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author xiao
* @date 2020/09/11
*/
public class B implements Runnable{
LockUtil util;
List<Long> list;
B(LockUtil util, List<Long> list) {
this.util = util;
this.list = list;
}
/**
* When an object implementing interface <code>Runnable</code> is used
* to create a thread, starting the thread causes the object's
* <code>run</code> method to be called in that separately executing
* thread.
* <p>
* The general contract of the method <code>run</code> is that it may
* take any action whatsoever.
*
* @see Thread#run()
*/
@Override
public void run() {
List<Long> success = util.defaultBatchTryLock(list, "t");
System.out.println("B lock success :" + success.size());
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
util.defaultBatchUnlock(success, "t");
}
}
| [
"xiao.deng@weimo.com"
] | xiao.deng@weimo.com |
7ea7e152327a2a1e3d1b51d55a5e6393f5c3eb49 | 470ea24db48cd0311835f51d23522549f7bd040d | /user/server/src/main/java/com/lchy/user/utils/CookieUtil.java | a24b10e62740b0f1cb1059b9932daca65cfaa5cc | [] | no_license | noseparte/microservice | d2bd51c6028183b439b7370e4ccfba33dbf06bed | 278ab51d4592cf5cd20bc7305681178f6312ca6d | refs/heads/master | 2021-03-25T10:59:30.416495 | 2020-03-16T04:38:18 | 2020-03-16T04:38:18 | 247,611,642 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java | package com.lchy.user.utils;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Created by 廖师兄
* 2018-03-04 23:25
*/
public class CookieUtil {
/**
* 设置cookie
* @param response
* @param name
* @param value
* @param maxAge
*/
public static void set(HttpServletResponse response,
String name,
String value,
int maxAge) {
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
cookie.setMaxAge(maxAge);
response.addCookie(cookie);
}
public static Cookie get(HttpServletRequest request,
String name) {
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie: cookies) {
if (name.equals(cookie.getName())) {
return cookie;
}
}
}
return null;
}
}
| [
"noseparte@aliyun.com"
] | noseparte@aliyun.com |
a13fb2c0c8bf5c4e4cd25f55aeb3aafe29a6045a | 1c349b06e64f3b7c638ec04c78c6393d231d2063 | /src/main/java/edu/uiowa/icts/jobs/MeshTermList/MyMapper.java | a61df5b4a89fa129b9806999471e93a5f75143eb | [] | no_license | jschappet/medline | 8b65a95ec996448423b09ed2dfaceb243f10bea8 | 526ad3925cee0a1631e3db4483829a5036ba659d | refs/heads/master | 2020-07-26T09:47:30.521810 | 2012-08-30T12:52:24 | 2012-08-30T12:52:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,228 | java | package edu.uiowa.icts.jobs.MeshTermList;
import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.SortedMap;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import org.apache.cassandra.db.IColumn;
import org.apache.cassandra.thrift.Column;
import org.apache.cassandra.thrift.ColumnOrSuperColumn;
import org.apache.cassandra.thrift.Mutation;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import edu.uiowa.icts.medline.Citation;
import edu.uiowa.icts.util.Combinations;
public class MyMapper extends Mapper<ByteBuffer, SortedMap<ByteBuffer, IColumn>, Text, Text> {
private static final Logger logger = LoggerFactory.getLogger(MyMapper.class);
private Text raw_xml = new Text();
private String pmid = new String();
private ByteBuffer sourceColumn;
private JAXBContext jContext;
private Unmarshaller unmarshaller;
private static enum Count { DOCS, TERMS };
private static int minCount = 1;
private static int maxCount = 1 ;
private static Text outputColumn = new Text();
private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
@Override
public void setup(Context context) {
logger.debug("setup");
// outputColumn.set(context.getConfiguration().get("output.column.name"));
sourceColumn = ByteBufferUtil.bytes((context.getConfiguration().get("source.column.name")));
try {
jContext=JAXBContext.newInstance("edu.uiowa.medline.xml");
} catch (JAXBException e) {
// TODO Auto-generated catch block
logger.error("Error Message", e);
//e.printStackTrace();
}
try {
unmarshaller = jContext.createUnmarshaller() ;
} catch (JAXBException e) {
// TODO Auto-generated catch block
logger.error("Error Message", e);
//e.printStackTrace();
}
logger.debug("done");
}
@Override
public void map(ByteBuffer key, SortedMap<ByteBuffer, IColumn> columns, Context context) {
logger.info("mapping");
context.getCounter(Count.DOCS).increment(1);
Citation citation = null;
IColumn column = columns.get(sourceColumn);
if (column == null)
return;
String value = null;
try {
value = ByteBufferUtil.string(column.value());
} catch (CharacterCodingException e) {
// TODO Auto-generated catch block
logger.error("Error Getting Value", e);
}
citation = new Citation(value, unmarshaller);
List<String> termList = citation.getMajorMeshHeading();
String pmid = citation.getPmid();
logger.info("pmid:" + pmid);
for (String term : termList) {
try {
context.getCounter(Count.TERMS).increment(1);
context.write(new Text(term),new Text(pmid));
} catch (Exception e) {
// TODO Auto-generated catch block
logger.error("Error writing term", e);
}
}
}
}
| [
"jimmy@schappet.com"
] | jimmy@schappet.com |
e208aa0450ca0172b496151370f21bd8bf50e833 | 7b4ef7b1ee3ac509acf5a9c4b2364170f61ffd2c | /src/main/java/com/example/connect5/game/service/impl/Connect5BoardGame.java | 8dd68e304bc30986ecc943ece018adbdc2dfe1f3 | [] | no_license | nithinbright/connect5-server | 56722757bff30f971fe1dc5692ba4ad360893d78 | 935e01f6d7fb56be7d5abe954f97891befae00fc | refs/heads/master | 2022-12-28T19:28:35.612644 | 2020-04-26T14:51:23 | 2020-04-26T14:51:23 | 259,055,725 | 0 | 0 | null | 2020-10-13T21:31:19 | 2020-04-26T14:49:28 | Java | UTF-8 | Java | false | false | 8,258 | java | package com.example.connect5.game.service.impl;
import com.example.connect5.controller.Connect5BoardGameController;
import com.example.connect5.domain.DropResponse;
import com.example.connect5.game.service.BoardGameService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@Service
public class Connect5BoardGame implements BoardGameService {
public static final String YOU_WON_THE_GAME = "**********YOU WON THE GAME!!!******";
private static String lastPlayer;
private static ConcurrentMap<String, String> activePlayers;
private static final char[] PLAYERS = {'O', 'X'};
private final static String PLAYER1="player1";
private final static String PLAYER2="player2";
private static char[][] grid;
@Value("${connect5.grid.colums}")
private static int noOfGridColumns=9;
@Value("${connect5.grid.rows}")
private static int noOfGridRows=6;
private static int lastCol;
private static int lastTop;
private static int totalMovesMade;
private static String broadcastMessage;
static{
init();
}
private static void init() {
activePlayers=new ConcurrentHashMap<String,String>();
// activePlayers.put(PLAYER1, null);
// activePlayers.put(PLAYER2,null);
grid=new char[noOfGridColumns][noOfGridColumns];
lastCol = -1;
lastTop = -1;
totalMovesMade=0;
broadcastMessage="";
//Initialize the grid with '.'
for (int i = 0; i < noOfGridRows; i++) {
Arrays.fill(grid[i] = new char[noOfGridColumns], '.');
}
}
@Override
public char getSymbolForPlayer(String playerName) {
if(activePlayers.get(PLAYER1)!= null){
if(activePlayers.get(PLAYER1).equalsIgnoreCase(playerName)){
return PLAYERS[0];
}
}/*else{
activePlayers.put(PLAYER1,playerName);
//Update the broadcast message
// broadcastMessage="Game Started: Player "+ playerName +" is making his move";
return PLAYERS[0];
}*/
if(activePlayers.get(PLAYER2)!= null){
if(activePlayers.get(PLAYER2).equalsIgnoreCase(playerName)){
return PLAYERS[1];
}
}/*else{
activePlayers.put(PLAYER2,playerName);
//Update the broadcast message
//broadcastMessage="Game Started: Player "+ playerName +" is making his move";
return PLAYERS[1];
}*/
return '.';
}
@Override
public DropResponse chooseAndDrop(char playerSymbol, int column) {
DropResponse response = new DropResponse();
//Check if the position is occupied
if (isPositionEmpty(column)) {
//Check if all the moves are done
if (isFull()) {
response.setMessage("####### GAME OVER: IT'S A DRAW !!##########");
//Set the broadcast message
broadcastMessage = "####### GAME OVER: IT'S A DRAW !!##########";
return response;
}
if(broadcastMessage!=null && broadcastMessage!= ""){
response.setMessage(broadcastMessage);
response.setGameOver(true);
return response;
}
int i = 0;
for (i = 0; i < noOfGridRows; i++) {
if (grid[i][column] == 'O' || grid[i][column] == 'X') {
grid[i - 1][column] = playerSymbol;
break;
}
}
if (i == noOfGridRows)
grid[i - 1][column] = playerSymbol;
totalMovesMade++;
boolean isWinningMove = isWinningMove(i - 1, column);
if (isWinningMove) {
response.setGameOver(true);
response.setMessage(YOU_WON_THE_GAME);
//Update the broadcast message
broadcastMessage = "###### Game Over: Player " + getPlayerFromSymbol(playerSymbol) + " won the game #####";
} else {
response.setGameOver(false);
response.setMessage(Connect5BoardGameController.WAIT_FOR_YOUR_TURN);
}
lastPlayer = getPlayerFromSymbol(playerSymbol);
}
return response;
}
@Override
public String enterThePlayer(String playerName) {
StringBuffer playerSymbol=new StringBuffer("");
if(activePlayers.get(PLAYER1)== null){
activePlayers.put(PLAYER1,playerName);
return playerSymbol.append("##### Your Symbol is "+PLAYERS[0]+" ####").toString();
}
if(activePlayers.get(PLAYER2)== null){
activePlayers.put(PLAYER2,playerName);
return playerSymbol.append("##### Your Symbol is "+PLAYERS[1]+" ####").toString();
}
return playerSymbol.toString();
}
private String getPlayerFromSymbol(char playerSymbol) {
if(playerSymbol=='O'){
return activePlayers.get(PLAYER1);
}
return activePlayers.get(PLAYER2);
}
private boolean isWinningMove(int row, int column){
int num=grid[row][column];
int count=0;
int i=column;
//HORIZONTAL.
while(i<noOfGridColumns && grid[row][i] == num){
count++;
i++;
}
i=column-1;
while(i>=0 && grid[row][i] == num){
count++;
i--;
}
if(count == 5)
return true;
//VERTICAL.
count=0;
int j=row;
while(j<noOfGridRows && grid[j][column] == num){
count++;
j++;
}
if(count == 5)
return true;
//SECONDARY DIAGONAL.
count=0;
i=row;
j=column;
while(i<noOfGridColumns && j<noOfGridRows && grid[i][j] == num){
count++;
i++;
j++;
}
i=row-1;
j=column-1;
while(i>=0 && j>=0 && grid[i][j] == num){
count++;
i--;
j--;
}
if(count == 5)
return true;
//LEADING DIAGONAL.
count=0;
i=row;
j=column;
while(i<noOfGridColumns && j>=0 && grid[i][j] == num){
count++;
i++;
j--;
}
i=row-1;
j=column+1;
while(i>=0 && j<noOfGridRows && grid[i][j] == num){
count++;
i--;
j++;
}
if(count == 5)
return true;
return false;
}
private boolean isPositionEmpty(int column){
return grid[0][column] == '.';
}
private boolean isFull(){
return totalMovesMade == noOfGridRows*noOfGridColumns;
}
@Override
public Boolean exitThePlayer(String playerName) {
if(playerName!= null) {
//Check if the player is active
if(activePlayers.get(PLAYER1)!= null) {
if (activePlayers.get(PLAYER1).equalsIgnoreCase(playerName)) {
//Remove from active users
activePlayers.remove(PLAYER1);
//Update the broadcast message
broadcastMessage = "##### Game Over: Player " + playerName + " exited the game. ####";
return true;
}
}
if(activePlayers.get(PLAYER2)!= null) {
if (activePlayers.get(PLAYER2).equalsIgnoreCase(playerName)) {
//Remove from active users
activePlayers.remove(PLAYER2);
//Update the broadcast message
broadcastMessage = "##### Game Over: Player " + playerName + " exited the game.####";
return true;
}
}
}
return false;
}
@Override
public String getLastPlayer() {
//String lastPlayer=getLastPlayer();
return lastPlayer;
}
@Override
public String getBroadcastMessage() {
return broadcastMessage;
}
@Override
public char[][] getBoardState() {
return grid;
}
@Override
public String restart() {
init();
return "OK";
}
}
| [
"nithin.shivanapur.rajashekar@ericsson.com"
] | nithin.shivanapur.rajashekar@ericsson.com |
9ce215d0befb22ff96b262a4df395db03e6b6759 | 47f26b385b7c3223c098fc2a045d75b39b7e5f06 | /src/main/java/quoters/InjectedRandomInt.java | bb9ddecad3e2ef861f9dc14271a21b7e144fb5c0 | [] | no_license | OSO1995/Spring | c579dbd2cb8bda2f3de7a99783d8ca6b0b20767f | 01a58bb1de721743faa143f9a06a3a2a86771529 | refs/heads/master | 2020-03-09T14:14:16.790153 | 2018-04-09T20:29:22 | 2018-04-09T20:29:22 | 128,829,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package quoters;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface InjectedRandomInt {
int min();
int max();
}
| [
"okunevso@inbox.ru"
] | okunevso@inbox.ru |
8991cd8a4346e34d4694f6bcac9249b616629181 | 0cd1a81dca02444df312a78d79bc4095b8ea8eeb | /app/src/main/java/com/example/visha/boxoffice/utils/AppExecutor.java | 17ea4be0dd70678d8dc527fa498553a2b665a209 | [] | no_license | biletnam/BoxOffice-16 | a6855091ee7008a2d6766c71031670bfc0b054ef | 9f107681ecee8504bfb441386bfea7198d0b1f2d | refs/heads/master | 2020-03-30T06:51:44.797274 | 2018-08-24T16:04:44 | 2018-08-24T16:04:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 683 | java | package com.example.visha.boxoffice.utils;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
public class AppExecutor {
private static final Object LOCK = new Object();
private final Executor diskIO;
private static AppExecutor sInstance;
private AppExecutor (Executor diskIO) {
this.diskIO = diskIO;
}
public static AppExecutor getInstance () {
if (sInstance == null) {
synchronized (LOCK) {
sInstance = new AppExecutor(Executors.newSingleThreadExecutor());
}
}
return sInstance;
}
public Executor getDiskIO() {
return diskIO;
}
}
| [
"vishal.rao103@gmail.com"
] | vishal.rao103@gmail.com |
0bf04e0c117ead7380bff2bc07cc8d728f610c46 | e6aa8de6cd93e479f656213621153cacdf82d9f1 | /BookWord.java | c185f61e29d7f10e2f3bda1aaf62fd00e4c0dc4f | [] | no_license | TheBigPancake/MyFirstJavaProject | f0c5e9e9211ff855001142cc846dc4a43aba6f6d | 6b84ca08b66b8c5300c56e50ec8c9f455b57a496 | refs/heads/master | 2022-12-20T07:28:03.062147 | 2020-09-16T16:09:01 | 2020-09-16T16:09:01 | 295,940,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,795 | java | package com.company;
import java.util.ArrayList;
class RepeatStatistics
{
public final String Word;
public final int Repeat;
public RepeatStatistics(String Word_, int Repeat_)
{
Word = Word_;
Repeat = Repeat_;
}
public String ToString()
{
return "Word \t[" + Word + "]\t repeated \t" + Repeat + "\t times";
}
}
public class BookWord {
public String text;
private String[] words;
private RepeatStatistics[] statistic;
public BookWord(String Text_)
{
text = Text_;
words = String_Into_Words_FromArray(Text_);
SetStatistic();
}
public static int Sum_Words(String Text)
{
int words = 0;
for(char
symbol: Text.toCharArray())
{
switch (symbol)
{
case ' ':
case '.':
case ',':
case ':':
case ';':
case '\n':
case '\r':
case '!':
case '?':
{
words++;
}break;
}
}
return words;
}
public static String[] String_Into_Words_FromArray(String Text)
{
String[] words = new String[Sum_Words(Text) + 1];
String word = "";
for (int i = 0, j = 0; i < Text.length(); i++) {
switch (Text.charAt(i)) {
//dividing marks
case ' ':
case '.':
case ',':
case ':':
case ';':
case '\n':
case '\r':
case '!':
case '?':
if (i - 1 >= 0)
if (Text.charAt(i - 1) != ' ' &&
Text.charAt(i - 1) != '.' &&
Text.charAt(i - 1) != ',' &&
Text.charAt(i - 1) != ':' &&
Text.charAt(i - 1) != ';' &&
Text.charAt(i - 1) != '\n' &&
Text.charAt(i - 1) != '?' &&
Text.charAt(i - 1) != '!' &&
Text.charAt(i - 1) != '\r') {
words[j++] = word;
word = "";
}
break;
//Ignored
case '—':
case '"':
case '\t':
case '(':
case ')':
case ']':
case '[':
case '{':
case '}':
case '*':
case '^':
case '~':
break;
default://letters
word += Text.charAt(i);
}
}
return words;
}
private int SearchWord(String key_word, int From) {
int sum_repeat = 0;
for (int i = From; i < words.length; i++) {
if (words[i] != null)
if (words[i].equalsIgnoreCase(key_word)) {
sum_repeat++;
}
}
return sum_repeat;
}
private void InsertWord(String DelWord, int From) {
for (int i = From; i < words.length; i++) {
if (words[i] != null)
if (words[i].equalsIgnoreCase(DelWord))
words[i] = "";
}
}
private String[] GetUniqueWords()
{
int i = 0;
String[] UniqueWords = new String[0];
for (String word:
words) {
if(word != "" && word != null)
{
UniqueWords = AddRangeArray(UniqueWords);
UniqueWords[i] = word;
InsertWord(word,i);
i++;
}
}
words = String_Into_Words_FromArray(this.text);
return UniqueWords;
}
private String[] AddRangeArray(String[] Array1)
{
String[] Array2 = new String[Array1.length + 1];
for (int i = 0; i < Array1.length; i++) {
Array2[i] = Array1[i];
}
return Array2;
}
private void SetStatistic()
{
String[] UniqueWords = GetUniqueWords();
statistic = new RepeatStatistics[UniqueWords.length];
int i = 0;
for (String word:
UniqueWords) {
statistic[i++] = new RepeatStatistics(word, SearchWord(word,i));
}
}
public RepeatStatistics[] Get_Staticstic_Repear_Words()
{
return statistic;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
46b7765b8174a7db37930583786e4ecd0000c753 | 02df0e0bf689e40330b83727e05d04c9c467efa4 | /week4/explorecali/src/main/java/com/wizeline/techmentoring/explorecali/web/RatingDto.java | 2b8a8ac4c3e717fa3955904977b73580e29b6204 | [] | no_license | paopileno/tech-mentoring | 58368a607429968cbc08eca0dc668f79ef4e2e38 | ef4c193554774a98e4b35cea0413a0a1d7f4e02f | refs/heads/master | 2023-06-13T22:52:45.077008 | 2021-07-24T17:47:57 | 2021-07-24T17:47:57 | 379,090,548 | 0 | 0 | null | 2021-07-24T17:47:57 | 2021-06-21T23:45:19 | Java | UTF-8 | Java | false | false | 855 | java | package com.wizeline.techmentoring.explorecali.web;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.wizeline.techmentoring.explorecali.domain.TourRating;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class RatingDto {
@Min(0)
@Max(5)
private Integer score;
@Size(max = 255)
private String comment;
@NotNull
private Integer customerId;
public RatingDto(TourRating tourRating) {
this(tourRating.getScore(), tourRating.getComment(), tourRating.getPk().getCustomerId());
}
private RatingDto(Integer score, String comment, Integer customerId) {
this.score = score;
this.comment = comment;
this.customerId = customerId;
}
}
| [
"paola.pileno@wizeline.com"
] | paola.pileno@wizeline.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.