text
stringlengths
3
1.18M
/* * Copyright (C) 2008 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 app...
/* * Copyright (C) 2008 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 app...
/* * Copyright (C) 2008 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 app...
/* * Copyright (C) 2008 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 app...
/* * Copyright (C) 2008 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 app...
/* * Copyright (C) 2008 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 app...
/* * Copyright (C) 2008 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 app...
import java.io.*; public class list { private static char nibble(int c) { return (char)(c < 10 ? ('0' + c) : ('a' + (c-10))); } public static void main(String[] argv) { ByteArrayOutputStream stream = new ByteArrayOutputStream(100); OutputStreamWriter writer = null; try {...
package is.web; import is.model.bean.AbstractHierarchyBean; import is.model.exceptions.CyclingHierarchyException; import java.util.LinkedList; import java.util.List; /** * * @author aspr0 */ public class Hierarchy<Datatype extends AbstractHierarchyBean> { private List<Datatype> beans; // <Dt> use caused by Lis...
package is.web; import is.interfaces.Bean; import java.util.LinkedList; /** * * @author aspr0 */ public class Form { public static String generate(Bean bean, LinkedList<String> selects, Integer... selectFields) { String formCanvas = "<form method=\"post\" enctype=\"\">" ...
package is.web; /** * * @author aspr0 */ public class Locale { public static final String TITLE = "Information system v.3"; public static final String NULL = "Not specified"; public static final String[] INFO = new String[] { "Object updated succesfully", "Object deleted succesfully"...
package is.web; import is.interfaces.Bean; import java.util.Iterator; import java.util.List; /** * * @author aspr0 */ public class SelectOptions<Datatype extends Bean> { public String generate(List<Datatype> beans, Integer selectedId, Boolean nullAllowed, String selectName, Integer... nameIndexes) { ...
package is.web; import is.interfaces.Bean; import java.util.LinkedList; /** * Retrieve table * * @author aspr0 */ public class Rtable { public static String generate(Bean bean, LinkedList<String> linkTagrets, LinkedList<String> linkedValues, Integer... linkedFields) { ...
package is.web; /** * * @author aspr0 */ public class GetParam { public static final String ORDER_BY = "o"; public static final String INFO = "i"; public static final String DELETED = "d"; public static final String WARNING = "w"; public static final String ERROR = "e"; }
package is.web; import com.sun.xml.rpc.processor.modeler.j2ee.xml.localHomeType; import is.web.Locale; /** * * @author aspr0 */ public class Message { private static final String CANVAS = "<div class=\"msg %s\">%s | <a href=\".\">close</a></div>"; public static String genMsgInfo(String infoId) { ...
package is.web.table; import is.NullUtil; import is.interfaces.Dao; import is.interfaces.Table; import is.model.bean.*; import is.model.dao.RegionDao; import is.model.exceptions.EmptyValueException; import is.web.GetParam; import java.sql.SQLException; /** * * @author aspr0 */ public class RegionTable extends Abst...
package is.web.table; import is.interfaces.Table; import is.model.bean.AbstractHierarchyBean; import is.web.Hierarchy; /** * * @author aspr0 */ public abstract class AbstractHierarchyTable<Datatype extends AbstractHierarchyBean> extends AbstractTable<Datatype> implements Table<Datatype> { prote...
package is.web.table; import is.NullUtil; import is.interfaces.Dao; import is.interfaces.Table; import is.model.bean.*; import is.model.dao.*; import is.model.exceptions.EmptyValueException; import is.web.GetParam; import java.sql.SQLException; /** * * @author aspr0 */ public class DepartmentTable extends Abstract...
package is.web.table; import is.interfaces.Bean; import is.interfaces.Table; import is.model.exceptions.EmptyValueException; import java.sql.SQLException; import java.util.List; /** * * @author aspr0 */ public abstract class AbstractTable<Datatype extends Bean> implements Table<Datatype> { protected List<Datat...
package is.web.table; import is.NullUtil; import is.interfaces.Dao; import is.interfaces.Table; import is.model.bean.Department; import is.model.bean.Employee; import is.model.dao.DepartmentDao; import is.model.exceptions.EmptyValueException; import is.web.GetParam; import java.sql.SQLException; /** * * @author asp...
package is.interfaces; import is.model.exceptions.EmptyValueException; import java.sql.ResultSet; import java.sql.SQLException; /** * Interface for Dao to access bean * * @author aspr0 */ public interface Bean { public Integer getId(); public void setId(Integer id) throws EmptyValueException; public...
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package is.interfaces; import is.model.exceptions.EmptyValueException; import java.sql.SQLException; import java.util.List; /** * * @author aspr0 */ public interface Table<Datatype> { public String getDatatypeNa...
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package is.interfaces; import is.interfaces.Bean; import is.model.exceptions.ObjectNotFoundException; import java.sql.SQLException; import java.util.List; /** * * @author aspr0 */ public interface Dao<Datatype> { ...
package is.interfaces; /** * * @author aspr0 */ public interface HierarchyBean { public Integer getParentId(); public void setParentId(Integer id); public Integer getNesting(); public void setNesting(Integer nesting); }
package is; /** * * @author aspr0 */ public class Conf { public static final String ENCODING = "utf8"; public static class Db { public static final String USER = "boris"; public static final String PASSWORD = "qw"; public static final String SERVER = "localhost"; public ...
package is; import is.model.exceptions.EmptyValueException; import is.web.Locale; /** * * @author aspr0 */ public class NullUtil { public static String toString(Object o) { return (o == null) ? "" : o.toString(); } /** * Proves if object's null * * @param o * @throws Em...
package is.model; import is.interfaces.Bean; import is.model.bean.Department; import is.model.bean.Employee; import is.model.exceptions.DeletingLinkedObjectException; import java.sql.*; /** * * @author aspr0 */ public class Restriction { public static void checkRegionDeletion(Bean region) throws SQLException, ...
package is.model.exceptions; /** * * @author aspr0 */ public class ObjectNotFoundException extends Exception { }
package is.model.exceptions; /** * * @author aspr0 */ public class CyclingHierarchyException extends Exception { }
package is.model.exceptions; /** * * @author aspr0 */ public class EmptyValueException extends Exception { }
package is.model.exceptions; /** * Thrown if current object is being deleted and there are objects linked to it (via parentId, regionId, etc.). * * @author aspr0 */ public class DeletingLinkedObjectException extends Exception { }
package is.model; import is.NullUtil; import is.interfaces.Bean; import is.interfaces.Dao; import is.model.exceptions.ObjectNotFoundException; import java.sql.*; import java.util.LinkedList; import java.util.List; /** * * @author aspr0 */ //public class Daold<Datatype> implements Dao<Datatype> //{ // // @Overri...
package is.model.bean; import is.interfaces.HierarchyBean; /** * * @author aspr0 */ public abstract class AbstractHierarchyBean extends AbstractBean implements HierarchyBean { protected Integer parentId; protected Integer nesting; @Override public Integer getParentId() { return parentI...
package is.model.bean; import is.interfaces.Bean; import is.model.exceptions.EmptyValueException; /** * * @author aspr0 */ public abstract class AbstractBean implements Bean, Cloneable { public final String KEY_FIELD = "id"; protected Integer id; protected String tableName; protected String[] field...
package is.model.bean; import is.NullUtil; import is.interfaces.Bean; import is.interfaces.HierarchyBean; import java.sql.ResultSet; import java.sql.SQLException; /** * * @author aspr0 */ public class Region extends AbstractHierarchyBean implements Bean, HierarchyBean, Cloneable { private String name; pub...
package is.model.bean; import is.NullUtil; import is.interfaces.Bean; import is.interfaces.HierarchyBean; import is.model.exceptions.EmptyValueException; import java.sql.ResultSet; import java.sql.SQLException; /** * * @author aspr0 */ public class Department extends AbstractHierarchyBean implements Bean, Hierarch...
package is.model.bean; import is.NullUtil; import is.interfaces.Bean; import is.model.exceptions.EmptyValueException; import java.sql.ResultSet; import java.sql.SQLException; /** * * @author aspr0 */ public class Employee extends AbstractBean implements Bean, Cloneable { private String lastName; private St...
package is.model.dao; import is.interfaces.Dao; import is.model.bean.Employee; import is.model.dao.search.EmployeeSearch; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; /** * * @author aspr0 */ public class EmployeeDao extends AbstractDao<Employee> implements Dao<Employee> ...
package is.model.dao.search; import is.NullUtil; import is.model.bean.Employee; import java.sql.*; import java.util.LinkedList; import java.util.List; /** * * @author aspr0 */ public class EmployeeSearch extends AbstractSearch { /** * * @param strict whether to serach strict by departmentId * @p...
package is.model.dao.search; import is.NullUtil; import is.model.bean.Region; import java.sql.*; import java.util.LinkedList; import java.util.List; /** * * @author aspr0 */ public class RegionSearch extends AbstractSearch { /** * * @param strict not used * @param initialBean * @param conne...
package is.model.dao.search; /** * * @author aspr0 */ public class AbstractSearch { protected static final String REGEX_CANVAS = ".*%s.*"; protected static final String QUERY_CANVAS = "select * from %s where %s order by id"; /** * Replaces '*' and '?' wildcards into correct regex * * @p...
package is.model.dao.search; import is.NullUtil; import is.model.bean.Department; import java.sql.*; import java.util.LinkedList; import java.util.List; /** * * @author aspr0 */ public class DepartmentSearch extends AbstractSearch { /** * * @param strict not used * @param initialBean * @par...
package is.model.dao; import is.interfaces.Bean; import is.interfaces.Dao; import is.model.DataSource; import is.model.exceptions.ObjectNotFoundException; import java.sql.*; import java.util.LinkedList; import java.util.List; /** * * @author aspr0 */ public abstract class AbstractDao<Datatype extends Bean> impleme...
package is.model.dao; import is.interfaces.Dao; import is.model.bean.Department; import is.model.dao.search.DepartmentSearch; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; /** * * @author aspr0 */ public class DepartmentDao extends AbstractDao<Department> implements Dao<De...
package is.model.dao; import is.interfaces.Dao; import is.model.bean.Region; import is.model.dao.search.RegionSearch; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; /** * * @author aspr0 */ public class RegionDao extends AbstractDao<Region> implements Dao<Region> { @Ove...
package is.model; import java.sql.Connection; import java.sql.SQLException; import javax.naming.InitialContext; import javax.naming.NamingException; /** * * @author aspr0 */ public class DataSource { private static Connection connection; public static void establishConnection() throws SQLException, Naming...
package gamejam.game; import java.awt.Graphics; import java.awt.Image; import java.awt.geom.Rectangle2D; public class Tile { private Image img; private int x; private int y; public Tile(Image img, int x, int y) { this.img = img; this.x = x; this.y = y; } public void draw(Graphics g, int xOf...
package gamejam.game; import java.awt.Point; import java.awt.event.KeyEvent; import java.awt.geom.Rectangle2D; public class Player { private int xLoc, yLoc, width, height, jumpstart; private boolean runningLeft = false, runningRight = false, jumping = false, falling = false; private Rectangle2D top, le...
package gamejam.game; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; import redsoxfan.gamejam.base.DesktopWrapper; import redsoxfan.gamejam.base.Game; import redsoxfan.gamejam.ba...
package gamejam.game; import java.awt.Graphics; import java.awt.Point; import java.awt.geom.Rectangle2D; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import redsoxfan.gamejam.base.GameResource; public class Map { public static final i...
package gamejam.platformer; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferedImage; import redsoxfan.gamejam.base.DesktopWrapper; import redsoxfan.gamejam.base.Game; import redsoxfan.gamejam.base.GameResource; ...
package gamejam.platformer; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; public class MovingLava extends Tile { private int left; private int right; private boolean movingRight = true; private int span; private int actualWidth; private int tick = 0; public MovingLa...
package gamejam.platformer; import java.awt.Graphics; import java.awt.Image; import java.awt.Rectangle; public class Tile { private Image image; private Rectangle bounds; public Tile(Image img, int x, int y) { this(img, x, y, img.getWidth(null), img.getHeight(null)); } public Tile(Image img, int x,...
package gamejam.platformer; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; public class MovingPlatform extends Tile { private int left; private int right; private boolean movingRight = true; private int span; private int actualWidth; private int tick = 0; private Player...
package gamejam.platformer; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.KeyEvent; public class Player { private Image image; private Rectangle bounds; private boolean movingLe...
package gamejam.platformer; import java.awt.Color; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import redsoxfan.gamejam.base.GameResource; public class Map { public static final int TIL...
package redsoxfan.gamejam.base; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; import javax.swing.JPanel; /** * All games using this base library should extend this class.<br> * <br...
package redsoxfan.gamejam.base; /** * Wrapper for a game. This is how the game gets displayed to the user. * @author RedSoxFan * @since 20 Apr 14 * @version 1.0 */ public interface GameWrapper { /** * Is the game running in an applet? * @return Whether the game is running in an applet */ ...
package redsoxfan.gamejam.base; import java.awt.image.BufferedImage; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; import javax.imageio.ImageIO; /** * Generate an ant script needed to build the game. This class will a...
package redsoxfan.gamejam.base; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.InputStream; import java.net.URL; import java....
package redsoxfan.gamejam.base; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage;...
package redsoxfan.gamejam.base; import java.applet.Applet; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import j...
package redsoxfan.gamejam.base; import java.util.ArrayList; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.LineUnavailableException; /** * Manage audio * @author Red...
package redsoxfan.gamejam.base; import java.awt.Image; import java.net.URL; import javax.sound.sampled.AudioSystem; import javax.swing.ImageIcon; /** * Load game resources * @author RedSoxFan * @since 20 Apr 14 * @version 1.0 */ public class GameResource { /** * Hide constructor */ priva...
/********************************************************* * This class is one of the various GUI frames that will * aid the user in tracking their workouts. *********************************************************/ package gui; import java.awt.Color; import java.awt.Component; import java.awt.ComponentOr...
/** * Main_ContentPanel.java * * @author Evan Nelson */ package gui; import java.awt.Color; import java.awt.ComponentOrientation; import java.awt.Container; import java.awt.Dimension; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.event.Ac...
/********************************************************* * *********************************************************/ package gui; import java.awt.Container; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.util.ArrayList; import java.util.Iterator; ...
/** * mainWindow.java * * @author Evan Nelson */ package gui; import java.awt.Dimension; import javax.swing.JFrame; /** * This is the main window for all GUI components to sit in. * It's created on startup. */ public class mainWindow extends JFrame { private static final long serialVers...
package gui; /** * guiLoginScreen.java * * @author Evan Nelson */ import java.awt.Color; import java.awt.event.MouseEvent; import java.sql.ResultSet; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax...
package gui; import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.sql.ResultSet; import java.util.ArrayList; import java.util.Date; import java.util.Random; import javax.swing.JButton; import javax.swing.JComboBox; imp...
/*********************************************** * A class to create the required databases and * tables. * @author Brian Renzenbrink ***********************************************/ package database; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.InputStreamReader; impo...
/*********************************************** * This class is part of the database toolset * intended to be used with mySQL. ***********************************************/ package database; import gui.mainWindow; import java.sql.*; import javax.swing.JOptionPane; /***************************...
package misc; /************************************************************ * A java class for creating an autocompleting combobox. * This class was found at: * http://www.java.happycodings.com/Java_Swing/code5.html * ************************************************************/ import java.awt.*; i...
package workoutModel; import java.util.Date; public class weightliftingSet extends workoutSet{ private String weightType; private String location; private double weight; private int reps; private int order; /******************************************************************* * @param date...
package workoutModel; import java.util.Date; public class workoutSet { protected String exercise; protected String notes; protected Date date; /*************************************************************** * * @param date * @param exercise * @param notes ************************...
/*********************************************** * A class to test the chart gui * @author Brian Renzenbrink * @author Evan Nelson ***********************************************/ package tests; import java.awt.Dimension; import javax.swing.JFrame; import gui.Content_GraphingPane; public class FreeChartTest{...
/*********************************************** * A class to test database functionality * @author Brian Renzenbrink ***********************************************/ package tests; import java.sql.Date; import java.sql.ResultSet; import database.DB_connection; import database.DB_creation; public cl...
/* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * ...
/*********************************************** * A class to test the workout chart gui * @author Brian Renzenbrink ***********************************************/ package tests; import java.awt.Dimension; import java.util.ArrayList; import java.util.Date; import javax.swing.JFrame; import worko...
import java.awt.*; /** * A LayoutManager implementation designed for laying out * _only_ JComponents of type ArduinoPin. * * @author Mihai Moraru */ public class ArduinoLayout implements LayoutManager { public void addLayoutComponent(String name, Component comp) {} public void removeLayoutComponent(Component...
/* file name : SketchClassLoader.java * authors : Mihai MORARU * created : Mon Jun 6 00:25:17 2011 * copyright : * * modifications: * */ import java.io.*; import net.grapsus.arduino.ArduinoCompiler; public class SketchClassLoader extends ClassLoader { // Compile a sketch file using ANTLR+ASM publ...
import java.awt.*; import java.awt.image.*; /** * * * @author Mihai MORARU * @version */ public class Util { /** * Blend the contents of two BufferedImages according to a specified * weight. * * @param bi1 first BufferedImage * @param bi2 second BufferedImage * @param weight the fractional perce...
import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.*; import java.awt.image.*; import java.io.FileInputStream; import java.util.*; import javax.imageio.*; import javax.swing.*; /** * @author Mihai Moraru */ public class ArduinoPin extends JComponent implements MouseListener { pub...
/** * @author Mihai Moraru */ public class ArduinoPWMPin extends ArduinoPin { public ArduinoPWMPin(double x, double y) { super(x, y); } public void analogWrite(int val) { /* You do not need to call pinMode() to set the pin as an output before calling analogWrite() */ pinMode(ArduinoCore.OUTPUT); if(val ...
public class Simulator { public static void main(String argv[]) { try { //ClassLoader scl = ClassLoader.getSystemClassLoader(); /* Preload ArduinoCore */ //ClassLoader.getSystemClassLoader().loadClass("ArduinoCore"); SketchClassLoader cl = new SketchClassLoader(); Class c = cl.loadClass(argv[0]); ...
public class Fade extends ArduinoCore { /* Fade This example shows how to fade an LED on pin 9 using the analogWrite() function. This example code is in the public domain. */ int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by void setup() { // de...
import java.awt.*; import java.awt.image.*; import java.util.*; import javax.imageio.*; public class ArduinoCanvas extends javax.swing.JPanel { public ArduinoCanvas() { super(); this.setOpaque(true); // we will paint all the exposed area try { bg = ImageIO.read(this.getClass().getResource(bgFileName)); } ...
/** * @author Mihai Moraru */ public class ArduinoAnalogPin extends ArduinoPin { public ArduinoAnalogPin(double x, double y) { super(x, y); } public int analogRead() { if(mode != ArduinoCore.INPUT) return 0; if(voltage >= ArduinoCore.reference) return 1023; if(voltage < ArduinoCore.V_LOW) retur...
import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; /** * @file ArduinoCore.java * @author: Mihai Moraru * * Simulation of an Arduino Lilypad (same API as an Arduino Uno) * */ public class ArduinoCore extends JFrame implements Runnable { public ArduinoCore() { this("Untitle...
package net.grapsus.arduino; import java.awt.*; /** * A LayoutManager implementation designed for laying out * _only_ JComponents of type ArduinoPin. * * @author Mihai Moraru */ public class ArduinoLayout implements LayoutManager { public void addLayoutComponent(String name, Component comp) {} public void r...
package net.grapsus.arduino; /* file name : SketchClassLoader.java * authors : Mihai MORARU * created : Mon Jun 6 00:25:17 2011 * copyright : * * modifications: * */ import java.io.*; import net.grapsus.arduino.ArduinoCompiler; public class SketchClassLoader extends ClassLoader { // Compile a sketc...
package net.grapsus.arduino; import java.io.IOException; import java.io.File; public class Main { public static void main(String args[]) throws IOException { System.out.println("Arduino to JVM compiler v1.0"); /* check input file */ if(args.length != 1) { System.out.println("usage : basiccompiler source...
package net.grapsus.arduino; import java.awt.*; import java.awt.image.*; /** * * * @author Mihai MORARU * @version */ public class Util { /** * Blend the contents of two BufferedImages according to a specified * weight. * * @param bi1 first BufferedImage * @param bi2 second BufferedImage * @par...
package net.grapsus.arduino; import java.util.*; import java.io.*; import org.antlr.runtime.ANTLRStringStream; import org.antlr.runtime.ANTLRFileStream; import org.antlr.runtime.CharStream; import org.antlr.runtime.CommonTokenStream; import org.antlr.runtime.RecognitionException; import org.antlr.runtime.TokenStream;...
package net.grapsus.arduino; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.*; import java.awt.image.*; import java.io.FileInputStream; import java.util.*; import javax.imageio.*; import javax.swing.*; /** * @author Mihai Moraru */ public class ArduinoPin extends JComponent i...
package net.grapsus.arduino; import javax.swing.*; /** * @author Mihai Moraru */ public class ArduinoPWMPin extends ArduinoPin { public ArduinoPWMPin(JTextField tf, double x, double y) { super(tf, x, y); } public void analogWrite(int val) { /* You do not need to call pinMode() to set the pin as an output ...
package net.grapsus.arduino; import org.objectweb.asm.Type; class Variable { private Type t; private int num; public Variable(String desc) { t = Type.getType(desc); } public Variable(String desc, int num) { t = Type.getType(desc); this.num = num; } public Type getType() { return t; } publ...
package net.grapsus.arduino; import org.objectweb.asm.Type; class Function { private Type[] args; private Type ret; public Function(String desc) { args = Type.getArgumentTypes(desc); ret = Type.getReturnType(desc); } public Type[] getArguments() { return args; } public Type getReturn() { retur...
package net.grapsus.arduino; public class Simulator { public static void main(String argv[]) { try { //ClassLoader scl = ClassLoader.getSystemClassLoader(); /* Preload ArduinoCore */ //ClassLoader.getSystemClassLoader().loadClass("ArduinoCore"); SketchClassLoader cl = new SketchClassLoader(); Clas...
package net.grapsus.arduino; import java.awt.*; import java.awt.image.*; import java.util.*; import javax.imageio.*; public class ArduinoCanvas extends javax.swing.JPanel { public ArduinoCanvas() { super(); this.setOpaque(true); // we will paint all the exposed area try { bg = ImageIO.read(this.getClass()....