text
stringlengths
14
410k
label
int32
0
9
private static Def convert(XmlConfig cfg, com.grey.naf.Config nafcfg, Def def, String peername, boolean client) throws com.grey.base.ConfigException, java.io.IOException { if (def == null) def = new Def(); int pos = peername == null ? -1 : peername.indexOf(':'); if (pos != -1) peername = peername.substring(0,...
9
private Integer parseInt() throws StreamCorruptedException { StringBuffer lenStr = new StringBuffer(); while (input.remaining() > 0) { char ch = input.get(); if (ch == ';') { //indexPlus(1); break; } else { lenStr.append(ch); } } Integer value = 0; try { value = Integer.valueOf(len...
3
public void main() { Stage stage=new Stage(); ToolBar toolBar=new ToolBar(); Button btn1=new Button("Danes"); btn1.setFocusTraversable(false); Button btn2=new Button("Jutri"); btn2.setFocusTraversable(false); Button btn3=new Button("Pojutrišnjem"); btn3....
5
private void create(int initialValue, Color bg, String fieldTitle, String fieldlabel, boolean showResetBtn) { setPreferredSize(new Dimension(GUIConstants.DEFAULT_FIELD_WIDTH, FIELDHEIGHT)); setBackground(bg); setBorder(BorderFactory.createTitledBorder(fieldTitle)); setLayout(new Vertical...
2
public static void main(String[] argv) { if (argv.length < 2) { System.out .println("Incorrect parameters.\nUsage: java -cp bin:libs/snakeyaml-1.13.jar lab0.Logger <config_filename> <local_name>"); } else { Logger logger = new Logger(argv[0], argv[1]); logger.listen(); logger.showCommandPrompt(); ...
1
public static void init() { try { DIR.mkdirs(); new File(DIR, "saves").mkdir(); File us = new File(DIR, "username"); if (!us.exists() || us.length() == 0) { USERNAME = JOptionPane.showInputDialog("Bitte gib deinen Benutzernamen an."); if (USERNAME == null) System.exit(0); us.crea...
4
@Override public void createFromXML(NodeList attributes) { for(int i = 0; i < attributes.getLength(); i++) { Node node = attributes.item(i); if(node.getNodeType() == Node.ELEMENT_NODE) { Node value = node.getFirstChild(); if(node.getNodeName().equalsIg...
5
public int[] getCurrentSituation() { int[] situation = new int[5]; // observe cell to the north if (current.isAgainstNorthWall()) { situation[0] = Site.WALL; } else { if (grid[curY - 1][curX].hasCan()) { situation[0] = Site.CAN; } else { situation[0] = Site.EMPTY; } } // obser...
9
private void draw() { //De achtergrond tekenen g.drawImage(bgimage, 0, 0, 0); //De pijl die positie aangeeft tekenen g.drawImage(positie, 105, count * 87, 0); //Als piano open staat tekenen we de pads voor de piano if(piano.active) { for(int i = 0; i < 5; i++) { instruments[i].draw(); } }...
6
public static JnlpBrowser create() { try { Class<? extends ServiceManager> cl = Class.forName("javax.jnlp.ServiceManager").asSubclass(ServiceManager.class); Method m = cl.getMethod("lookup", String.class); BasicService basic = (BasicService)m.invoke(null, "javax.jnlp.BasicService"); return(new Jnlp...
2
boolean userWon() { for (int i = 0; i < 3; i++) if (getNumEachPiece(board[i], X)[0] == 3) return true; for (int j = 0; j < 3; j++) if (getNumEachPiece(getColumn(j), X)[0] == 3) return true; if (getNumEachPiece(getBottomUpDiag(), X)[0] == 3 || getNumEachPiece(getTopDownDiag(), X)[0] == 3) retu...
6
public void award_bonus(BigInteger threshold, BigInteger bonus) { if (getBalance().compareTo(threshold) >= 0) deposit(bonus); }
1
public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof ConnectionDetails)) { return false; } final ConnectionDetails otherConnectionDetails = (ConnectionDetails)other; return hashCode() == otherConnectionDetails.hashCode() && getLocalPort() == otherCo...
7
* @param theta the angle with which to calculate R * @return the radius */ private double calculateR(int type, double theta) { double r = 0; switch(type){ case 1 : r = scaleFactor * (Math.cos(3*theta)); break; case 2 : r = scaleFactor * (a * theta); break; case 3 : r = scaleFactor...
9
private boolean backupApps() { new Thread() { @Override public void run() { ProcessBuilder process = null; Process pr = null; List<String> args = null; String line = null; BufferedReader reader = null; ...
5
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
8
public void visitForceChildren(final TreeVisitor visitor) { if (visitor.reverse()) { for (int i = target.length - 1; i >= 0; i--) { target[i].visit(visitor); } for (int i = source.length - 1; i >= 0; i--) { source[i].visit(visitor); } } else { for (int i = 0; i < source.length; i++) { so...
5
@Override public Map<String, Collection<?>> call() throws Exception { return null; }
1
public static Consensus reAlign(Alignment layoutMap, double epsilonPrecision, int numOfIterations) { Consensus consensus = getConsensus(layoutMap); double initialScore = consensus.getConsensusScore(); boolean shouldContinue = true; int iteration = 1; int length = layoutMap.keySet().size(); ArrayList<Integer...
6
public void InitUI() { // Initializing button images try { Image img = ImageIO.read(getClass().getResource("/karel/guipics/stop.png")); Stop.setIcon(new ImageIcon(img)); } catch (IOException ex) {} try { Image img = ImageIO.read(getClass()....
9
@Override public IReceiveQuery getReceiveQuery() { return receiveQuery; }
0
public Object getValueAt(int row, int col) { if (col == 0) { return data.getBusinessObjects().get(row).getNr(); } else if (col == 1) { return data.getBusinessObjects().get(row).getMensuality(); } else if (col == 2) { return data.getBusinessObjects().get(row).getIntrest(); } else if (col == 3) { retu...
5
public static List<ExInterval> unionExIntervals(List<ExInterval> I) { // Empty input. List<ExInterval> uni = new ArrayList<>(); if (I.isEmpty()) { return uni; } // Sorts ExIntervals according to their left endpoints. Collections.sort(I); ExInterval c...
9
public void solve() { Scanner in = new Scanner(System.in); int n = in.nextInt(); if (n < 9) { System.out.println(0); System.exit(0); } if (n == 9) { System.out.println(8); System.exit(0); } System.out.print("72"); StringBuilder sb = new StringBuilder(); for (i...
3
public String blockTypeToString(){ String s = "unrecognized"; switch( getBlockType() ){ case BLOCK_TYPE_UNKNOWN: s = "unknown"; break; case BLOCK_TYPE_CATALOG: s = "DB catalog"; break; case BLOCK_TYPE_BPT_HEADER: s = "B+Tree header"; break; case BLOCK_TYPE_BPT_INTERNAL: s = "B+Tree internal"; br...
5
private void shuffleParticles(double[][]particles) { for(int i = 0; i < numberOfParticles; i++){ for(int k = 0; k < particles[i].length; k++){ int index = i + (int)(Math.random() * ((particles.length - i) + 1)); double temp = particles[i][k]; particles[i][k] = particles[i][index]; particles[i][inde...
2
public AST rFactor() throws SyntaxError { AST t; if (isNextTok(Tokens.LeftParen)) { // -> (e) scan(); t = rExpr(); expect(Tokens.RightParen); return t; } if (isNextTok(Tokens.INTeger)) { // -> <int> t = new IntTree(currentToke...
7
public static void frequencyCount(String s) { char c[] = s.toCharArray(); int count; for (int i = 0; i < c.length; i++) { count = 0; for (int j = 0; j < c.length; j++) { if ((j < i) && (c[j] == c[i])) { break; } else if ((j >= i) && (c[i] == c[j])) { count++; } } if (count !=...
7
public static void main(String[] args){ Chap15Q6<String> rs = new Chap15Q6(); for(String s : "go to the hell".split(" ")){ rs.add(s); } for(int i = 0; i < 10; i++) print(rs.select()); Chap15Q6<Integer> intrs = new Chap15Q6(); int[] nums = {1,2,3,4,5,6}; for(Integer i : nums){ intrs.add(i); }...
4
public synchronized void replaceContactInBucket(Bucket bucket, Contact node) { if (node.isAlive()) { Contact leastRecentlySeen = bucket.getLeastRecentlySeenBucketContact(); //The LRS node can be replaced if it is not the local node, AND it is DEAD if ...
4
private void createStructure() { Random random = new Random((int)Math.random()*100); data = new DataArrays<Float[]>(); for(int i=0; i<kitSize; i++){ array = new Float[length]; for (int j=0; j<array.length; j++){ array[j] = random.nextFloat()*chars; ...
2
public boolean load(String mainClass, String mainMethod, String version, BufferedImage icon) { try { _loader = new URLClassLoader(new URL[]{_path.toURI().toURL()}, Launcher.class.getClassLoader()); Class<?> cl = _loader.loadClass(mainClass); cl.getMethod(mainMethod, new Class<?>[]{BufferedImage.class, Str...
3
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
7
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("eweather")) { if (args.length > 0) { if (args[0].equalsIgnoreCase("update")) { return updateWeather(sender); ...
7
public static Locale parseLocale(String localeString) { StringTokenizer localeParser = new StringTokenizer(localeString, "-_"); String lang = null, country = null, variant = null; if (localeParser.hasMoreTokens()) lang = localeParser.nextToken(); if (localeParser.hasMoreTok...
9
public boolean isPrime(long l) { // extend our list of primes if necessary in order to search for l while (maxPrimeFound < l) { this.getNext(); } // now binary search for l int lo = 1; int hi = numPrimesFound; while (true) { int mid = (lo+hi) / 2; long midPrime = primesFound.get(mid); if (m...
7
public void save() { if (datacfg != null) { for (String key : datacfg.getKeys(false)) { datacfg.set(key, null); } } for (SellSign sign : mh.getSellSigns()) { Block b = sign.getBlock(); String key = "SellSigns." + b.getWorld().getName() + "." + sign.getRegion().getId(); datacfg.set(key + ".Type"...
6
public static ItemStack convertToCraftItemStack(ItemStack itemStack) { if (AS_CRAFT_OPY_ACCESSOR == null) { ClassTemplate template = new Reflection().reflect(MinecraftReflection.getCraftItemStackClass()); List<SafeMethod<ItemStack>> methods = template.getSafeMethods(withExactName("asCra...
2
public static void main(String[] args) { Socket socket = null; try { socket = new Socket(host,port); // 请求连接为低成本连接 socket.setTrafficClass(0x02); // 请求高性能与最小延时 socket.setTrafficClass(0x04|0x10); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTra...
4
private void treeRefresh(File[] masterFiles) { TreeItem[] items = tree.getItems(); int masterIndex = 0; int itemIndex = 0; for (int i = 0; i < items.length; ++i) { final TreeItem item = items[i]; final File itemFile = (File) item.getData(TREEITEMDATA_FILE); if ((itemFile == null) || (masterIndex == mas...
6
@Override public void enter() { Group root = GroupBuilder.create().build(); String[] menuButtonLabels = { "Singleplayer", "Multiplayer", "Credits", "Quit" }; final StateType[] menuButtonEvents = { StateType.SINGLE_PLAYER_SELECTED, StateType.TWO_PLAYER_SELECTED, StateType.CREDITS_SELECTED, StateType.QUIT_SE...
1
public static boolean isTable(String OID) { switch(OID) { case "1.3.6.1.2.1.1.9": return true; case "1.3.6.1.2.1.2.2": return true; case "1.3.6.1.2.1.3.1": return true; case "1.3.6.1.2.1.4.20": return...
8
public Bid_DTO getBid(long bidId) throws NoHayDatosDBException { Bid_DTO bidResultado; bidResultado = null; String CONSULTA = "SELECT * FROM actionBazaar.Bid WHERE idBid = ?"; try{ PreparedStatement pstmt = conexion.prepareStatement( CONSULTA ); pstmt.setLong( 1 ...
2
private void comboCidadeAssessoriaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboCidadeAssessoriaActionPerformed String item = String.valueOf(comboModelCidadeAssesoria.getSelectedItem()); if(item.equals("Selecionar....") || item == "null"){ System.out.println("O...
3
public static int getLongestShipNotDestroyed() { ArrayList<Integer> shipSizesLeft = new ArrayList<Integer>(); for(int size : BattleShipGame.shipSizes) shipSizesLeft.add(new Integer(size)); for(Ship ship : sunkShips) shipSizesLeft.remove(new Integer(ship.getSize())); int largest = 1; for(Intege...
4
@Before public void setUp() throws Exception { }
0
public void onAction(String name, boolean isPressed, float tpf) { if (inputEnabled) { if (name.equals("up") && isPressed) { up = true; } if (name.equals("down") && isPressed) { down = true; } if (name.equals("right") && ...
9
public KeyStroke getKey() { return KeyStroke.getKeyStroke('d'); }
0
public TableCellRenderer getCellRenderer(int row, int column) { if (!finalEdit) return super.getCellRenderer(row, column); int mc = convertColumnIndexToModel(column); return cellEditors[row][mc] == null ? super .getCellRenderer(row, column) : RENDERER; }
2
public void remoteSignal(String from,String method,String url) { if (url.indexOf("/smithers/downcheck")!=-1) { for(Iterator<SmithersProperties> iter = smithers.values().iterator(); iter.hasNext(); ) { SmithersProperties sm = (SmithersProperties)iter.next(); if (!sm.isAlive()) { LOG.info("One or more s...
8
public SHSMsgBean() { }
0
@Override public String toString() { StringBuilder sBuilder = new StringBuilder(); sBuilder.append("########################################\n"); sBuilder.append("# BeatTime plugin collection preferences\n"); sBuilder.append("# Only change these settings via this \n"); ...
1
private int is(int x, int y) { if (x < 0 || x > cwidth - 1 || y < 0 || y > cheight - 1) { return 1; } return (cells[y][x] == true ? 1 : 0); }
5
public void load(Thinlet thinlet, Object table) { UIDefaults defaults = UIManager.getDefaults(); Hashtable iconcache = new Hashtable(); for (Enumeration keys = defaults.keys(); keys.hasMoreElements();) { String key = (String) keys.nextElement(); Object value = defaults.get(key); Object row = Thinl...
6
public static boolean isInRange( String rng, int rowFirst, int rowLast, int colFirst, int colLast ) { int[] sh = getRowColFromString( rng ); // the guantlet if( sh[1] < colFirst ) { return false; } if( sh[1] > colLast ) { return false; } if( sh[0] < rowFirst ) { return false; } if( sh...
4
@Override public void vieraile(TormaysReunaanViesti viesti) { // toisin kuin pallo jonka paikka palaa keskelle jos törmää ylä\alareunaan, tämä törmääjä voi törmätä // esimerkiksi aivan vasemman reunan yläosan tuntumassa vasempaan reunaan ja välittömästi törmätä yläreunaan // jos suunta ei h...
6
@Basic @Column(name = "last_name") public String getLastName() { return lastName; }
0
public void setType(String type) { if (type.equals("eau") || type.equals("feu") || type.equals("terre") || type.equals("air")) { typeSorcier_ = type; if (type.equals("air")) puissanceType = 1; if (type.equals("eau")) puissanceType = 2; if (type.equals("feu")) puissanceType = 3; if (type...
8
public String readUrl(String urlString) { BufferedReader reader = null; try { URL url = new URL(urlString); reader = new BufferedReader(new InputStreamReader(url.openStream())); StringBuffer buffer = new StringBuffer(); int read; char[] chars = new char[1024]; while ((read = reader.read(chars)) !...
4
private void readHand(GameState state) { int cardsInHand = countCardsInHand(state.getScreen()); if(cardsInHand > handCostIndiciesByHandSize.size()) { throw new GameStateViolationException("Too many cards in hand, the parser is probably reading pixels it shouldn't"); } List<Integer> cardCostOffsets = handC...
5
public void heapify(ArrayList<Integer> array, int index,int size) { int left = this.getLeft(index); int right = this.getRight(index); int largest = array.get(index); int temp = index; if (left != -1 && array.get(left) > largest && left<size) { largest = array.get(left); temp = left; } if (...
8
public static Filter isInterface() { return new IsInterface(); }
0
public int getAttendance(){ if(attendees != null){ int attendance = attendees.size(); return attendance; } else{ System.out.println("There are not attendees listed for this meeting!"); } return 0; }
1
public String toString() { return getDescription(); }
0
public void itemStateChanged(ItemEvent evt) { //LookAndFeel laf = UIManager.getLookAndFeel(); JRadioButton source = (JRadioButton) evt.getSource(); if (source == radioLaFGTK) try { //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel("com.sun.java.swing.plaf....
8
protected double[] missingValueStrategyAggregateNodes(double[] instance, Attribute classAtt) throws Exception { if (classAtt.isNumeric()) { throw new Exception("[TreeNode] missing value strategy aggregate nodes, " + "but class is numeric!"); } double[] preds = null;...
7
public static void copyBlob(String srcContainerName, String policyId, String destContainerName, String blobName, int server) { CloudBlobClient cloudBlobClients = null; CloudBlobClient cloudBlobClientd = null; try { storageAccountSource = new CloudStorageAccount( new StorageCredentialsAccountAndKey( ...
4
public void delTriangles( ArrayList<Triangle> triangles ) throws Exception { glBindBuffer( GL_ARRAY_BUFFER, resource.getVboIndex() ); for ( Triangle triangle : triangles ) delTriangle( triangle, false ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); }
1
public boolean tntcontrolSubCommand(CommandSender sender, String[] args) { boolean cmdProcessed = false; String subCommand = args[1].toLowerCase(); if (subCommand.equalsIgnoreCase("limit")) { limitOption(sender, args); cmdProcessed = true; } if (subCommand.equalsIgnoreCase("yield")) { yieldOption(...
8
public Map<String, Set<String>> identifyInterface(Set<String> interfaceNames, Set<String> classNames) throws ClassNotFoundException { this.interfaceFilter = (null == interfaceFilter) ? new HashSet<String>() : interfaceFilter; this.packageFilter = new HashSet<String>(); this.jarFilter = new HashSet<String>(); Ma...
6
public void setTransient() { if(level > 20) { level = 20; } }
1
public double deltaT(double JD) { double T = (JD - J2000) / JCY; double[][] data = { { -25.0, 184.4, 111.6, 31.0, 0.0 }, { -17.0, -31527.7, -4773.29, -212.0889, -3.93731 }, { -10.0, 6833.0, 1996.25, 186.1189, 3.87068 }, { -3.5, -116.0, -88.45, -22.3509, -3.07831 }, { -3.0, -4586.4, -4715.24, -1615....
2
public PreparedHTTPResponse create( HTTPHeaders headers, PostDataWrapper postData, UUID socketID, Socket socket, UUID sessionID, Map<String,BasicType> additionals ) { this.getHTTPHandler().getLogger().log( Level.INFO, getClass().getName(), "socketID=" + socketID ...
4
public void createTree(int n, int k){ if(Integer.bitCount(k) != 1) { System.err.println("number of parts must be a power of 2"); System.exit(-1); } // get the maximum number of links that can be stored boolean failed = true; double maxLink...
5
private void loadCounts() { String anstallda = ""; String kompetenser = ""; String projekts = ""; String plattformar = ""; try { String query = "select count(*) from anstalld"; anstallda = DB.fetchSingle(query); } catch (InfException e) { ...
4
private void calcShadowDrop() { if (pane != null) { maxFall.setLocation(location); maxFall.translate(0, 1); point.setLocation(location); do { if (!assertLegal(pane, block, point, block, null)) { break; } else { point.translate(0, -1); maxFall.translate(0, -1); } } while (true); } }
3
static String bitSetToString( ArrayList<Version> sigla, ArrayList<Group> groups, BitSet bs ) { try { StringBuilder sb = new StringBuilder(); for ( int i = bs.nextSetBit(0); i>= 0; i = bs.nextSetBit(i+1)) { Version v = sigla.get(i-1); ...
4
private void getFloorPlan(String inputFile) { String line = null; BufferedReader br = null; File f = new File(inputFile); try { br = new BufferedReader(new FileReader(f)); } catch (Exception e) { LOGGER.log(Level.WARNING, "File not Found", e); } for (;;) { ...
6
@Override public String toString() { return null; }
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; JsonString other = (JsonString) obj; if (other.hasComments() ^ hasComments()) return false; if (value == null) { if (other.value !=...
9
public Matrix times(Matrix B) { Matrix A = this; if (A.N != B.M) throw new RuntimeException("Illegal matrix dimensions."); Matrix C = new Matrix(A.M, B.N); for (int i = 0; i < C.M; i++) for (int j = 0; j < C.N; j++) for (int k = 0; k < A.N; k++) ...
4
@Override public String getColumnName(int column) { String name = "?"; switch (column) { case 0: name = "Name"; break; case 1: name = "Date"; break; case 2: name = "Type"; ...
3
@Override public Serializable load(){ try { db.start(); DBCollection collection = db.getDB().getCollection("games"); XStream xStream = new XStream(); DBObject obj = collection.findOne(); if (obj == null) return null; String xml = (String)obj.get("blob"); Serializable xmlObj = (...
2
@Override public void handle(HttpExchange exchange) throws IOException { System.out.println("In Maritime Trade handler"); String responseMessage = ""; if(exchange.getRequestMethod().toLowerCase().equals("post")) { try { String unvalidatedCookie = exchange.getRequestHeaders().get("Cookie").get(0); ...
4
public void execute(HyperGraph graph) throws MaintenanceException { HGIndexer indexer = graph.get(hindexer); if (indexer == null) return; HGIndex<?,?> idx = graph.getIndexManager().getIndex(indexer); if (idx == null) throw new MaintenanceException(false,"Indexer " + indexer + " with handle " + hindexer...
7
public void visitEnd() { if (argumentStack % 2 != 0) { declaration.append('>'); } argumentStack /= 2; endType(); }
1
public void cycle() { // Do instruction limiting so we don't run at light speed if(!limiter()) return; // If we've hit the instruction limit, reset count so that // the timers can be updated if(instruction_count == 5) instruction_count = 0; System.out.println(String.format("\n\nPC@%x: %x; I: %x", PC...
7
private boolean r_Step_4() { int among_var; int v_1; // (, line 140 // [, line 141 ket = cursor; // substring, line 141 among_var = find_among_b(a_7, 18); if (among_var == 0) ...
9
private static void getAvailableFlights() { //for each flight for(Flight flight:flightList) { if(flight.hasOpenSeats()) { //we already know that the flight is not empty //print out Flight#, Date, and seats remaining ...
2
public Model(int playerCount) { listener = new ArrayList<IModelChangeListener>(); field = new Field(FIELD_WIDTH, FIELD_HEIGHT); player = new Player[playerCount]; activeItems = new ArrayList<Item>(); newActiveItems = new ArrayList<Item>(); for (int i = 0; i < playerCount; i++) { player[i] = new Player(1,...
5
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Physical target=mob.location(); if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(L("This place is already a sanctum.")); return false; } if(!super....
9
*/ public static long PointToAngle ( int x, int y ) { // MAES: note how we don't use &BITS32 here. That is because we know that the maximum possible // value of tantoangle is angle // This way, we are actually working with vectors emanating from our current position...
9
public static void startupWalk() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); if (Stel...
7
@Test public void testInfixToPostfix15() throws DAIllegalArgumentException, DAIndexOutOfBoundsException, ShouldNotBeHereException, BadNextValueException, UnmatchingParenthesisException { try { infix.addLast("+"); infix.addLast("-23"); QueueInterface<String> postFix = calc.infixToPostfix(infix); Str...
5
public void updatePosition() { if (xPos < xDestination) xPos += 1; else if (xPos > xDestination) xPos -= 1; if (yPos < yDestination) yPos += 1; else if (yPos > yDestination) yPos -= 1; if (xPos == xDestination && yPos == yDestination && currentlyAnimating) { currentlyAnimating = false; role....
7
public void update(float dt) { // handle key presses int ttx = (Keyboard.isKeyPressed(Keyboard.Key.A) ? -1 : 0) + (Keyboard.isKeyPressed(Keyboard.Key.D) ? 1 : 0); int tty = (Keyboard.isKeyPressed(Keyboard.Key.W) ? -1 : 0) + (Keyboard.isKeyPressed(Keyboard.Key.S) ? 1 : 0); Vector2 targe...
7
@Override public void mousePressed(MouseEvent e) { for (Interface i : InterfaceHandler.getActiveInterfaces()) { if (i.getBounds().contains(e.getX(), e.getY())) { if (InterfaceHandler.getFocused() != i) InterfaceHandler.setFocused(i); break; ...
3
public static void main(String[] args) { /************************************************************************/ /*login information: trial: set dummy account: user name: user password: user real: load file IO here: load text file storing user account information */ /*******...
1
void toggleLift() { //System.out.println("Toggle lift"); if (cloud != null) { //System.out.println("set cloud to null"); cloud = null; app.cameraMan.cutSetup(flyingDot, flyingDot.isUser); return; } if (circuit != null) { //Syst...
5
public void preview( boolean canPlace, Rendering rendering, Tile from, Tile to ) { if (from == null) return ; final Tile t = from ; final World world = t.world ; setPosition(t.x, t.y, t.world) ; final TerrainMesh overlay = world.terrain().createOverlay( world, surrounds(), false, Texture...
4