text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void animate() throws InterruptedException {
Thread.sleep(1000);
for(char c:"ANGRY NERDS STUDIO PRESENTS".toCharArray()) {
stringShownANSP.append(c);
image.repaint();
int sleepVal = 250;
sleepVal -= stringShownANSP.length() * 6;
Thread.sleep(sleepVal);
}
Thread.sleep(1000);
int i = 1;
... | 4 |
public void build(Polygon[] polygons) {
if (polygons.length == 0) return;
if (plane == null) plane = polygons[0].getPlane().clone();
ArrayList<Polygon> front = new ArrayList<Polygon>();
ArrayList<Polygon> back = new ArrayList<Polygon>();
for (int i = 0; i < polygons.length; i++)
plane.splitPolygon(polygons... | 7 |
private static final void exchange(Object a[], int i, int j) {
if (i == j)
return;
Object tmp = a[i];
a[i] = a[j];
a[j] = tmp;
} | 1 |
public int winnerIs() {
for (int i = 0; i < cl.length; i++) {
if (getScore(cl[i])==4) {
return PLAYER_ONE;
}
else if(getScore(cl[i])==-4)
return PLAYER_TWO;
}
return 0;
} | 3 |
public List<Product> getAll() {
List<Product> products = null;
try {
beginTransaction();
products = session.createCriteria(Product.class).list();
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSesion();
}
return products;
} | 1 |
private boolean checkUpdate(Integer[] current, Integer[] online) {
if (current.length > online.length) {
Integer[] newOnline = new Integer[current.length];
System.arraycopy(online, 0, newOnline, 0, online.length);
for (int i = online.length; i < newOnline.length; i++) {
... | 6 |
public JSONObject toJSONObject() throws ParseException {
JSONObject obj = new JSONObject();
obj.put(KEY_TYPE, bonusType.toString());
obj.put(KEY_PROMPT, prompt);
obj.put(KEY_ANSWER, answer);
JSONArray sChoice = new JSONArray();
if(choices!=null){
for (String c : choices) {
if (c != null)
... | 3 |
private static Boolean checkIfTrue(String[] complete) {
int max=0;
String temp;
int temp1;
int[] a=new int[complete.length];
for(int i=0;i<complete.length;i++){
//Establish our Max for the Column
for(int j=0;j<complete[i].length();j++){
temp=complete[i].charAt(j)+"";
temp1=Integer.parseInt(temp);
if(te... | 6 |
public void itemStateChanged(ItemEvent aa) {
setChangeDate();
} | 0 |
public Thread acquirePackets(final List<Packet> buffer, final int count) {
// ArrayList of packets called List
final PacketReceiver receiver = new PacketReceiver() { // Declaration of
// a new
// packetReciever
// called
// receiver
@Override
... | 4 |
public void appLoop(double mult) {
//Loads a flat surface as the base terrain
baseScene = new Scene(objLib.FlatSurf());
//Increases the terrains size by a multiple of 5
//Initializes an array of objects equal to the size the scene allows
actors = new int[baseScene.objindex];
//Adds a prebuilt box object fr... | 5 |
public static void main(String[] args) {
try {
ui = new SwingWolves();
} catch (HeadlessException e){
ui = new TextWolves();
ui.displayString("Headless environment detected.\nSwitched to text only mode.");
}
NumPlayers = ui.getNumPlayers();
NumWolves = ui.getNumWolves();
DebugMode = ui.getDebug... | 8 |
private ServerSocketChannel createServerSocket(int port)
throws IOException {
try {
ServerSocketChannel ssChannel = ServerSocketChannel.open();
ssChannel.configureBlocking(false);
ssChannel.socket().bind(new InetSocketAddress(port));
return ssChannel;
} catch (IOException e) {
logger.info("Port " ... | 1 |
protected Icon getIcon() {
java.net.URL url = getClass().getResource("/ICON/collapse.gif");
return new ImageIcon(url);
} | 0 |
public void addVillage(Village v)
{
this.village = v;
} | 0 |
public void loadGame() {
System.out.println("What is the filename? For maders.rsbxl2, type maders.");
try {
mainfileName = cache.readLine();
} catch (IOException ex) {
System.out.println(ex.getMessage());
System.exit(-1);
}
ReadFile read = new ... | 2 |
public void testReadWithVorbisAudio() throws IOException {
OggFile ogg = new OggFile(getTheoraVorbisFile());
tf = new TheoraFile(ogg);
// Check the Info
assertEquals("3.2.1", tf.getInfo().getVersion());
assertEquals(3, tf.getInfo().getMajorVersion());
assertEquals(2, tf.... | 3 |
* @return this
*/
public Request clear(String name) {
Iterator<NameValuePair> it = mParams.iterator();
while (it.hasNext()) {
if (it.next().getName().equals(name)) {
it.remove();
}
}
return this;
} | 2 |
@Override
public ArrayList<Excel> getColoredExes() {
return coloredEx;
} | 0 |
public static void drawVerticalLine(int x, int y, int height, int colour) {
if (x < topX || x >= bottomX)
return;
if (y < topY) {
height -= topY - y;
y = topY;
}
if (y + height > bottomY)
height = bottomY - y;
int pointer = x + y * DrawingArea.width;
for (int row = 0; row < height; row++)
pix... | 5 |
@Override
public void displayTable(String tableName, ResultSet rs) throws IOException, SQLException {
println("create table " + tableName + " (");
while (rs.next()) {
print("\t" + rs.getString(4) + ' ' + rs.getString(6));
int nullable = rs.getInt(11);
if (nullable == ResultSetMetaData.columnNoNulls) {
... | 3 |
public int strStr(String haystack, String needle) {
if (haystack == null || needle == null)
return -1;
if (needle.length() > haystack.length())
return -1;
int base = 29;
long patternHash = 0;
long tempBase = 1;
long hayHash = 0;
for (int i = needle.length() - 1; i >= 0; i--) {
patternHash += (i... | 8 |
public void send(Message message) throws IllegalStateException {
synchronized (this.exchangeLock) {
if (this.isBound()) {
this.exchange.send(message);
}
}
} | 1 |
public static void main(String[] args) {
System.out.println("Digite 2 caracteres para usar de chave.");
String readConsole = Main.readConsole();
KeySchedule key = new KeySchedule(readConsole);
MiniAes miniAes = new MiniAes();
miniAes.setKey(key);
key.print();
while (true) {
try {
System.out.println... | 9 |
public void GameStart() {
boolean passFlg = false;
int gameCnt = 0;
Bord bord = new Bord();
bord.BordInit();
System.out.println("ゲームスタート");
System.out.println(bord.toString());
// おける場所がある間はループ
while (bord.GetCount(Stone.NONE) > 0) {
// 現在の手版を取得
AiBase turnPlayer = PlayerList.get(gameCnt % 2);... | 5 |
@Override
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
}
int count = extensions.length;
String path = file.getAbsolutePath();
for (int i = 0; i < count; i++) {
String ext = extensions[i];
if (path.endsWith(ext)
&& (path.c... | 4 |
public final void removeJump() {
if (jump != null) {
jump.prev = null;
jump = null;
}
} | 1 |
private void myEvent(){
saveItem.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(file == null){
saveDia.setVisible(true);
String dirPath = saveDia.getDirectory();
String fileName = saveDia.getFile();
if(dirPath==null || fileName==null) return;... | 8 |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (jTextField1.getText() != "") {
int a = 1;
String gend = "Male";
try {
ResultSet rs = DB.myConnection().createStatement().executeQuery("select * from librian where ... | 8 |
public static void remove(CommandSender sender, String[] args){
//team + player + add + player
if(args.length < 2+2){
sender.sendMessage(ErrorMessage.MissingParameters);
}
else{
String playerName = args[3];
String playerTeam = TeamsManager.getInstance().retrievePlayerTeam(playerName);
... | 5 |
public static boolean isBold(JTextPane pane)
{
AttributeSet attributes = pane.getInputAttributes();
if (attributes.containsAttribute(StyleConstants.Bold, Boolean.TRUE))
{
return true;
}
if (attributes.getAttribute(CSS.Attribute.FONT_WEIGHT) != null)
{
Object fontWeight = attributes
.getAttribu... | 2 |
public FolderHandler(File album) {
Logger.getLogger(FolderHandler.class.getName()).entering(FolderHandler.class.getName(), "FolderHandler", album);
File[] allfiles = album.listFiles();
try {
allfiles = album.listFiles();
} catch(SecurityException ex) {
Logger.getL... | 5 |
public void saveSupModel(String filename){
double[] weights = m_libModel.getWeights();
int class0 = m_libModel.getLabels()[0];
double sign = class0 > 0 ? 1 : -1;
try{
PrintWriter writer = new PrintWriter(new File(filename));
if(m_bias)
writer.write(sign*weights[m_featureSize]+"\n");
else
writer... | 4 |
public String[] getPhonenumberByUID(Statement statement,String UID)//根据用户ID获取手机号
{
int i = 0;
String[] result = new String[20];
sql = "select phonenumber from CarNumber where UID = '" + UID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result[i] = rs.getString("phonen... | 2 |
private static String[] format(Deck in){
if(!in.repeated){
return in.cards.toArray(new String[0]);
}
int size = 0;
for(int i = 0; i<in.quantity.size(); i++){
size += in.quantity.get(i);
}
String[] cards = new String[size];
int position = 0;
int count = 0;
for(int i = 0; i<size; i++){
card... | 4 |
protected int[] getOneSeq(int node_index){
double[][] winnerCode=new double[numF1][maxIdEvents];
for(int i=0;i<numF1;i++){
System.arraycopy(weight[node_index][i],0, winnerCode[i], 0, maxIdEvents);
}
/* for(int i=0;i<weight[node_index].length;i++){
for(int... | 7 |
public static void splitPivotFirst(int low, int high) {
int i = low + 1;
for (int j = low + 1; j <= high; j++) {
countFirst++;
if (result[j] < result[low]) {
exchange(j, i);
i++;
}
}
exchange(low, i - 1);
if (lo... | 4 |
@SuppressWarnings("unchecked")
public static Float restoreFloat(String findFromFile) {
Float dataSet = null;
try {
FileInputStream filein = new FileInputStream(findFromFile);
ObjectInputStream objin = new ObjectInputStream(filein);
try {
dataSet = (Float) objin.readObject();
} catch (ClassCastExcep... | 2 |
private Token<T, ?> skipIgnored(Token<T, ?> next, final TokenListener<T, ?> capturingListener) throws IOException {
if (next != null && ignoreWhitespace && capturingListener.isCapturingWhitespace()) {
next = next();
} else if (next != null && capturingListener.isCapturingNewline()) {
lineNumber++;
if (igno... | 9 |
public principal(){
comboBox1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
String idioma_cadena = comboBox1.getSelectedItem().toString();
set.setIdioma(getIdioma(idioma_cadena));
}
... | 2 |
private void searchTable() {
while (model.getRowCount() != 0) {
model.removeRow(0);
}
if (!tfEmployeeNr.getText().isEmpty()) {
Employee employee = RoosterProgramma.getInstance().getEmployee(Integer.parseInt(tfEmployeeNr.getText()));
if (employee != null) {
... | 7 |
public PrimaryInput(String input) {
name = input;
inputTable.put(input, new Double(0.0));
} | 0 |
public void moverse() {
Tablero.getTablero().removerNave(this);
ArrayList<Parte> partesFinal = new ArrayList<Parte>();
for (Parte parte : partes) {
Coordenada posicionInicial = parte.getPosicion();
Coordenada posicionFinal;
if (direccionMovimiento == DireccionMovimiento.ESTE) {
posicionFinal = this.m... | 9 |
public double getDouble(String key, double def)
{
if(fconfig.contains(key)) {
return fconfig.getDouble(key);
}
else {
fconfig.set(key, def);
try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); }
return def;
}
} | 2 |
private void asetaLisavalinnat(ArrayList<Tilausrivi> tilausrivit, String oregStr, String vsipStr, String ltonStr,
String gtonStr, int index) {
if (oregStr != null) {
tilausrivit.get(index).setOreg(true);
} else {
tilausrivit.get(index).setOreg(false);
}
if (vsipStr != null) {
tilausrivit.get(i... | 4 |
public void line(WritableImage source, int x1, int y1, int x2, int y2) {
if (source == null)
return;
PixelWriter pw = source.getPixelWriter();
int argb = 255 << 24 | 0 << 16 | 0 << 8 | 0;
int sx = x1 < x2 ? 1 : -1;
int sy = y1 < y2 ? 1 : -1;
int dx = Math.abs(x2 - x1);
int dy = Math.abs(y2 - y1);
... | 8 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if((sprung)
&&(affected!=null)
&&(!disabled())
&&(tickDown>=0))
{
if(((msg.targetMinor()==CMMsg.TYP_LEAVE)
||(msg.targetMinor()==CMMsg.TYP_FLEE))
&&(msg.amITarget(affected)))
{
msg.source().tell(L("The exits a... | 9 |
public void updateData() {
data = username + (location != null ? " l" + location.toString() : "") + (health > -1 ? " h" +
health : "") + (toggleAdmin ? " a" : "") + (toggleFlyMode ? " f" : "") + (toggleGodMode ? " g" : "") +
(toggleVisibility ? " v" : "");
} | 6 |
public int getWood(int size){
if (resource1==3){
if (size==1){
return sgenrate1;
}
else if (size==2){
return mgenrate1;
}
else {
return lgenrate1;
}
}
else{
return 0;
}
} | 3 |
double microbial_tournament(int[][] actionGenome, StateObservation stateObs, StateHeuristic heuristic) throws TimeoutException {
int a, b, c, W, L;
int i;
a = (int) ((POPULATION_SIZE - 1) * randomGenerator.nextDouble());
do {
b = (int) ((POPULATION_SIZE - 1) * randomGenerat... | 6 |
public void run() {
//double fCyclePosition = 0;
try {
AudioFormat format = new AudioFormat(44100, 16, 2, true, true);
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format, BUFFER);
if (!AudioSystem.isLineSupported(info))
throw new LineUnavailableException();
line = (SourceD... | 6 |
private static Mummy[] mummyFight(Mummy[] mummyType1, Mummy[] mummyType2) {//First type win
Mummy[] mm1 = mummyType1;
Mummy[] mm2 = mummyType2;
if ((mm1.length == 0) || (mm2.length == 0)) { //No conflict for void arrays
return mm2;
}
if (mm1.getClass() != mm2.getClass... | 9 |
public void testWithChronologyRetainFields_invalidInNewChrono() {
YearMonthDay base = new YearMonthDay(2005, 1, 31, ISO_UTC);
try {
base.withChronologyRetainFields(COPTIC_UTC);
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} | 1 |
public Fighter(int courtWidth, int courtHeight) {
super(INIT_VEL_X, INIT_VEL_Y, INIT_X, INIT_Y, SIZE, SIZE, courtWidth,
courtHeight);
// Set img1 to picture of the fighter jet
try {
img1 = ImageIO.read(new File(img_file1));
} catch (IOException e) {
System.out.println("Internal Error:" + e.getMessage(... | 2 |
public void mergeInfo(Instruction instr, StackLocalInfo info) {
if (instr.getTmpInfo() == null) {
instr.setTmpInfo(info);
info.instr = instr;
info.enqueue();
} else
((StackLocalInfo) instr.getTmpInfo()).merge(info);
} | 1 |
void formEdit(ActivityList al, CaseList caselist, ContactList contactlist, boolean createRow) {
Vector<String> attorneyNames = new Vector<String>(); // creates array of Attorney and Paralegal names for JCombo Box
Vector<String> caseNames = new Vector<String>(); // creates array of Case names for JCombo Box
... | 8 |
@SuppressWarnings("deprecation")
@Test
public void test() {
Date start = new Date(113, 12, 20, 14, 10, 00);
Date end = new Date(113, 12, 21, 14, 10, 00);
int d = TimeCalculator.duration(start, end);
assertTrue(d == 86400);
assertEquals("24小时0分0秒", TimeCalculator.HMSFormat... | 0 |
@Override
public void execute(Game game, HashMap<String, String> strings, Entity target) throws ScriptException {
if (args[0].toLowerCase().equals("p")) {
game.getPlayer().setCoords(Integer.parseInt(args[1]),
Integer.parseInt(args[2]),
Integer.parseInt(args[3]));
} else if (args[0].toLowerCase().equal... | 3 |
public void execute(RPSAgent agent) {
Set<Peer> slaves = agent.getSlaves();
agent.log("It was time to prepare the tournament.");
agent.log("First I had to find out how many of the " + slaves.size() + " participants was still willing to take part in the tournament.");
//Find out how many... | 8 |
public void waitForConnection() throws IOException {
conn = serverSocket.accept();
outStream = new PrintWriter(conn.getOutputStream());
inStream = new BufferedReader(new InputStreamReader(conn.getInputStream()));
// Negotiation
while (true) {
String[] msg = inStrea... | 2 |
public void joinChannel(Channel channel) {
synchronized (channels) {
if (channels.isEmpty()) { // logged in
Server.get().addClient(this);
}
channels.add(channel);
}
} | 1 |
public Framework() {
// call constructor of extended Canvas object
super();
//set the game state
gameState = GameState.VISUALIZING;
//We start game in new thread.
Thread gameThread = new Thread() {
@Override
//start th game thread and call game... | 0 |
public Set<Move> getAllLegalMoves() {
Set<Move> legalMoves = new HashSet<Move>();
for (int i = 0; i < NUMBER_OF_COLS; i++) {
for (int j = 0; j < NUMBER_OF_ROWS; j++) {
Coordinate startCoord = new Coordinate(i, j);
Piece piece = getPiece(startCoord);
if (!piece.isNone() && piece.getColor() == current... | 4 |
public static TranslationEntry swapIn(int pid, int vpn, LoaderForCoff loader)
{
VMKernel.printDebug("Beginning swap in sequence!!!");
TranslationEntry entry;
int ppn = pageReplacementAlgorithm.findSwappedPage();
try
{
swapOut(ppn);//if only if it's already in the memo... | 8 |
public static Double valueOf(Object o) {
if (o == null) {
return null;
} else if (o instanceof Float) {
return (double)(Float)o;
} else if (o instanceof Double) {
return (Double)o;
} else if (o instanceof Byte) {
return (double)(Byte)o;
... | 6 |
public static void copyProperties(Object dest, Object orig, boolean boo) throws Exception{
Class<?> clazzOrig = orig.getClass();
Class<?> clazzDest = dest.getClass();
Field[] fList = clazzOrig.getFields(); // 此方法可以取public参数包括父类
//if (fList == null || fList.length == 0) {
fList = clazzOrig.getDeclaredFields()... | 9 |
void create_file (Object doc,String fpath)
{
Path logfile = FileSystems.getDefault().getPath(fpath);
//fileW=fpath;
String s = (String) doc;
byte data[] = s.getBytes();
try (OutputStream out = new BufferedOutputStream(
Files.newOutputStream(logfile,CREATE))) ... | 1 |
public String getDescr()
{
if( cxnSp != null )
{
return cxnSp.getDescr();
}
if( sp != null )
{
return sp.getDescr();
}
if( pic != null )
{
return pic.getDescr();
}
if( graphicFrame != null )
{
return graphicFrame.getDescr();
}
if( grpSp != null )
{
return grpSp.getDescr();
... | 5 |
public static void main(final String[] args)
{
Server server = null;
if (args.length > 0)
{
server = Server.getInstance(Integer.parseInt(args[0]));
}
else
{
server = Server.getInstance(5042);
}
server.start();
try
{
server.join();
}
catch (final InterruptedException e)
{
e.printSt... | 2 |
public void normalizePercentage() {
percentage = (1.0 * curValue) / maxValue;
if(percentage > 0.99) {
percentage = 1.0;
}
} | 1 |
@Override
public int getRank() {
return rank;
} | 0 |
public float get_halffloat(int offset)
{
int signbit;
int mantissa;
int exp;
float result;
if(offset >= 0)
if (pb[5] < (offset + 2))
{
val = -1; // insufficient payload length
return 0;
}
result = ((p... | 4 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for(int c = 0, C = parseInt(in.readLine().trim()); c < C; c++){
if(c == 0)in.readLine();
TreeMap<Character, Character> cypher = new TreeM... | 8 |
@Override
public boolean createPosition(Position position) {
String sql = INSERT_POSITION;
Connection connection = new DbConnection().getConnection();
PreparedStatement preparedStatement = null;
boolean flag = false;
String positionId = position.getPositionId();
String positionName = position.getPositionNa... | 4 |
@Override
public String getNextTask() {
if (this.initialized == false) {
throw new IllegalStateException("Scheudlers must be initialized before they can be used.");
} else if (this.scheduleable == false) {
throw new IllegalStateException("Task set is not scheduleable.");
}
refreshTasks();
String nextTa... | 7 |
public void calculateLR(int x) {
Doodle doodle2 = (Doodle) myGuys.get(0);
int doodleX = doodle2.getX();
// if already facing left, dont do anything, same with right
if ((x < doodleX)) {
myImages.set(0, doodleLImg);
doodle2.setX(doodle2.getX());
hFacing = -1;
doodle2.setHFacing(-1);
} else if ((x ... | 4 |
@Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (qName.equals("rowset")) {
String name = getString(attrs, "name");
if (name.equals("skills"))
skills = true;
else if (name.equals("requiredSkills"))
requiredSkills = true;
els... | 8 |
boolean ComprovarRes(Clausula c, ClausulaNom cn) {
boolean b = true;
for( RestGrupSessio gs : restriccionsGrupSesio){
String dia = cn.getDia();
int i;
if (dia.equals("dilluns")) i = 0;
else if (dia.equals("dimarts")) i = 1;
else if (dia.equals(... | 8 |
public void inject(ARPPacket p) { // Injects the poison on the network
try {
sender = JpcapSender.openDevice(devices[deviceIndex]);
sender.sendPacket(p);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | 1 |
public void setValue(int newValue) {
value = newValue;
} | 0 |
public void uimsg(String msg, Object... args) {
if (msg == "tabfocus") {
setfocustab(((Integer) args[0] != 0));
} else if (msg == "act") {
canactivate = (Integer) args[0] != 0;
} else if (msg == "cancel") {
cancancel = (Integer) args[0] != 0;
} else if... | 9 |
public void visitSource(final String file, final String debug) {
if (file != null) {
sourceFile = newUTF8(file);
}
if (debug != null) {
sourceDebug = new ByteVector().putUTF8(debug);
}
} | 2 |
public static String unescape(String s) {
int len = s.length();
StringBuffer b = new StringBuffer();
for (int i = 0; i < len; ++i) {
char c = s.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < len) {
int d = JS... | 6 |
private ParcelDestination(String whereTo) {
label = whereTo;
} | 0 |
public static void main(String[] args) throws Exception {
int numThreads = 1;
try {
Options opt = new Options();
opt.addOption("h", false, "print help");
opt.addOption("t", true, "number of threads");
opt.addOption("v", false, "verbose");
opt... | 8 |
@BeforeSuite
public void initalize(){
try{
config = new Properties();
FileInputStream fp = new FileInputStream(System.getProperty("user.dir")+"\\src\\com\\nike\\automation\\smartcart\\config\\config.properties");
config.load(fp);
//loading the object repository
OR = new Properties();
fp = ne... | 5 |
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void invokeListeners(String interfaceName, Executable executable, boolean returnsResults) {
List<BusListener> specificListeners = getListenersFor(interfaceName, listeners);
if (returnsResults && specificListeners == null)
throw new IllegalArgumentExceptio... | 8 |
public void keyReleased(KeyEvent key)
{
int code = key.getKeyCode();
if(code == KeyEvent.VK_LEFT)
{
player.setLeft(false);
}
if(code == KeyEvent.VK_RIGHT)
{
player.setRight(false);
}
if(code == KeyEvent.VK_DOWN)
{
player.setDown(false);
}
if(code == KeyEvent.VK_C)
{
player.setWeapo... | 4 |
public void generateMoves(Piece[][] squares, ArrayList<Move> validMoves, ArrayList<Move> validCaptures) {
// for each possible direction (NE, SE, SW, NW)
int xPos;
int yPos;
for (int direction = 0; direction < xMoves.length; direction++) {
xPos = xPosition + xMoves[direction];
yPos = yPosition + yMoves[d... | 7 |
public void run() {
Selector selector = SocketAcceptor.this.selector;
for (;;) {
try {
int nKeys = selector.select();
registerNew();
if (nKeys > 0) {
processSessions(selector.selectedKeys());
... | 9 |
public static void saveFile()
{
System.out.println("Pokedex save started.");
PrintWriter fout = null;
try{
fout = new PrintWriter(new FileWriter(fileName));
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("Pokedex save file not found. Making new one");
try{
fout = new Print... | 4 |
public void DisplayOpenSeats(){
int aisleTotal=0, winTotal=0;
for(int i=0;i<wSeats.length;i++){
if(wSeats[i].equals("NA") )
winTotal++;
}
for(int i=0;i<aSeats.length;i++){
if(aSeats[i].equals("NA") )
aisleTotal++;
}
System.out.println("Open Window Seats " +winTotal+"; Open Aisle Seats " +ais... | 4 |
@Test
public void testHashMapString() {
long minTime = Long.MAX_VALUE;
long maxTime = Long.MIN_VALUE;
long avgTime = 0;
long beforeTime = 0;
long afterTime = 0;
long curTime = 0;
Random random = new Random();
int value;
AbstractProcessor<Strin... | 4 |
public int getIdColor() {
return idColor;
} | 0 |
public static String generateJavaCode(GUIObject guiObject, HashMap<String, String> allImports, Interface blueJInterface) {
StringBuilder code = new StringBuilder();
code.append(getJavaImports(guiObject, allImports)).append('\n');//Add imports
String clName = (blueJInterface != null ? blueJInt... | 7 |
public YamlPermissionRcon(ConfigurationSection config) {
super("rcon", config);
} | 0 |
@SuppressWarnings({ "deprecation", "static-access" })
@EventHandler
public void CheckforBasicStoof(PlayerInteractEvent evt){
if(evt.getPlayer().getInventory().contains(Keys.BasicCaseKey) && evt.getPlayer().getInventory().contains(Cases.BasicCase)){
if(evt.getPlayer().getItemInHand().equals(Keys.BasicCas... | 5 |
protected String getFileName(URL url) {
String fileName = url.getFile();
if (fileName.contains("?")) {
fileName = fileName.substring(0, fileName.indexOf("?"));
}
return fileName.substring(fileName.lastIndexOf('/') + 1);
} | 1 |
@Override
public void handleStartTag(HTML.Tag foundTag, MutableAttributeSet attrs, int pos) {
for (HTML.Tag wantedTag : wantedComplexTags) {
if (wantedTag==foundTag) {
if (debug) {
System.out.print("COMPLEX: ");
}
HTMLComponent comp = HTMLComponentFactory.create(foundTag, attrs);
if (debug) {... | 4 |
public ForwarderWorker(Socket clientSocket, String serverText) {
this.clientSocket = clientSocket;
this.serverText = serverText;
Setup.println("[ForwardingService] Conexion abierta desde: " +
clientSocket.getRemoteSocketAddress());
} | 0 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.