text
stringlengths
14
410k
label
int32
0
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_UNWORNONLY); if(target==null) return false; if(mob.isMine(target)) { mob.tell(L("You'd better put it dow...
9
public void Moverse() { if (movimiento == false) { // ESCALADA getRobot1().inicializarMapa(getAnchoEntorno(), getAltoEntorno()); while (robot1.getPuntoActual().equals(robot1.getPuntoDestino()) == false && robot1.getPararMovimiento() == false) { try { Thread.sleep(1000); } catch (Interrupted...
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final Item target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false...
9
private Sign findSign(Inventory inventory) { if (inventories.containsValue(inventory)) { for (Map.Entry<Block, Inventory> entry : inventories.entrySet()) { if (entry.getValue().equals(inventory)) { Block block = entry.getKey(); return (Sign) bl...
3
public void visit_fsub(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1
public final static URL getMbReleasesOfArtist(String artistID) throws MusicbrainzUrlException { if(artistID == null || artistID.equals("")) throw new MusicbrainzUrlException("The artistID is null or empty"); URL url= null; URI uri= null; try { //lookup of musicbrainz uri= new URI("http...
6
public boolean equals( Object other ) { if ( ! ( other instanceof TObjectIntMap ) ) { return false; } TObjectIntMap that = ( TObjectIntMap ) other; if ( that.size() != this.size() ) { return false; } try { TObjectIntIterator iter = this...
8
private static boolean inDB(String nameText) throws Exception { String[] spl1 = nameText.split(",\\s", 2); for(String s : spl1) { if(s.matches("^[0-9]+$")) { System.out.println("Nur Nummer!? -> " + nameText); return false; } } String name = spl1[0].replaceAll("[.,;:!?]", ""); String ...
7
private long removeRefContactNym(long lIndex) { // // loop through the elements in the actual container, in order to find the one // at lIndex. Once it is found, then loop through the reference list and remove // the corresponding reference for that element. // ContactNym refActualElement = GetContactNym(lIndex)...
5
static int rank (int[] N, int key) { if (N.length == 0 || N.equals(null)) { throw new IllegalArgumentException("Cannot process empty or null array"); } int iterative = rank_iterative(N, key); int recursive = rank_recursive(N, key, N.length - 1, 0); assert iterative == recursive; return iterative;...
2
@Override public void onBrowserEvent(Event event) { // If we're not yet dragging, only trigger mouse events if the event occurs // in the caption wrapper switch (event.getTypeInt()) { case Event.ONMOUSEDOWN: case Event.ONMOUSEUP: case Event.ONMOUSEMOVE: ...
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
7
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Uf)) { return false; } Uf other = (Uf) object; if ((this.coduf == null && other.coduf != null) || (this.coduf !...
5
public Type getSuperType() { return (this == tObject) ? tObject : tRange(tObject, this); }
1
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; } } catch (NumberFormatException e) { ...
5
public void loadPM(long playerName, int world) { //synchronized(c) { if(c.getOutStream() != null && c != null) { if(world != 0) { world += 9; } else if(!Config.WORLD_LIST_FIX) { world += 1; } c.getOutStream().createFrame(50); c.getOutStream().writeQWord(playerName); c.ge...
4
public void moveEntityWithHeading(float par1, float par2) { if (this.isInWater()) { this.moveFlying(par1, par2, 0.02F); this.moveEntity(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.800000011920929D; this.motionY *= 0.800000011920929D; ...
8
public static void sendFileReq ( Socket sckIn , String strId , EzimFileOut efoIn ) throws Exception { if ( efoIn != null && strId != null && strId.length() > 0 ) { EzimDtxSemantics.initByteArrays(); long lSize = 0; FileInputStream fisTmp = null; try { OutputStream osTmp = ...
5
public String encriptar(String textoParaEncriptar, String metodoEncriptacion) { String encriptadoString = ""; try { if (!textoParaEncriptar.equalsIgnoreCase("")) {//Pasamos el password obtenido del caja de password MessageDigest md = MessageDigest.getInstance(metodoEncriptaci...
4
@Override public MethodResult ExecuteNonQuery(String rawSql) { MethodResult res = new MethodResult(); Connection conn = null; try { if ((conn = this.getConnection()) != null) { Statement statement = conn.createStatement(); if (DEBUG) { ...
7
@Override public String toString(){ return "" + this.armorItem.toString(); }
0
public void characters(char ch[], int start, int length) throws SAXException { if(inHits) { try { hits = Integer.parseInt(new String(ch, start, length)); } catch (NumberFormatException e) { System.err.println("Breakout: Could not parse level_width"); System.exit(1); } } if(inScore) ...
5
public boolean isAutarkic(IGroup g) { if (g.getGroupType() == GroupType.PACKAGE) { return false; } if (g.getGroupType() == GroupType.INNER_ACTIVITY) { return true; } if (g.getGroupType() == GroupType.CONCURRENT_ACTIVITY) { return true; } if (g.getGroupType() == GroupType.CONCURRENT_STATE) { re...
9
public ShopItem getItemByName(String... names) { if (names != null && names.length > 0) for (ShopItem nextItem : items) { String name = nextItem.getName(); if (!isStringValid(name)){ continue; } else for (String nextName : names) if (isStringValid(nextName) && name.equalsIgnor...
7
public static synchronized Singleton_2 getInstance() { // 这个方法比上面有所改进 if (instance == null) { // 实例化 instance = new Singleton_2(); } return instance; }
1
@Override public ArrayList<Map<String, String>> getUnexpiredAuctions() { ArrayList<Map<String,String>> auctions = new ArrayList<Map<String,String>>(); TypedQuery<Auction> unexpiredAuctionsQuery = emgr.createNamedQuery( "Auction.findAllUnexpiredAuctions", Auction.class); unexpiredAuctionsQuery.setParameter("a...
3
public boolean checkMainDiagonal() { //upper left to lower right (main diagonal) for (int col = 0; col < numColumns - 3; col++) { for (int row = 0; row < numRows - 3; row++) { int curr = gameGrid[col][row].getState(); if (curr > 0 && cu...
6
public UserScreen() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(new Rectangle(0, 0, 1365, 799)); getContentPane().setFont(new Font("Times New Roman", Font.PLAIN, 12)); getContentPane().setForeground(new Color(255, 255, 204)); getContentPane().setLayout(null); JPanel panel = new JPanel(); ...
3
public LinkCache(String directory) throws IOException { if (directory == null) { throw new IllegalArgumentException("directory is null."); } File file = new File(directory); if (!(file.exists() && file.isDirectory() && file.canWrite() && file.canRead())) { throw ne...
5
public void removegroup (int i0, int j0) // completely remove a group (at end of game, before count) // note all removals { if (Pos.haschildren()) return; if (P.color(i0, j0) == 0) return; Action a; P.markgroup(i0, j0); int i, j; int c = P.color(i0, j0); Node n = Pos.node(); if (n.contains("B") || n....
8
private static String convertToString(String[] data, char identifier) { StringBuilder sb = new StringBuilder(); sb.append(identifier + "" + DATA_DIVIDER); for(int i = 0; i < data.length; i++) { sb.append(data[i]); //No divider on last data value if(i < data.length - 1) { sb.append(DATA_DIVIDER); }...
2
private void computeAnswer() { long ans = getSumOfKthPowers(N); int coeff;//coeff of current subset contribution in inclusion exclusion sum for (int mask = 1; mask < (1 << primeCount); mask++) { long x = 1l; coeff = 1; for (int i = 0; i < primeCount; i++) { ...
5
private void initiate(){ System.out.println("Initializig SIB"); OntModel model = ModelFactory.createOntologyModel(); InputStream in = this.getClass().getResourceAsStream(this.ontologyFile); if (in == null) { throw new IllegalArgumentException( "File: " + this.ontologyFile + " not found" ); } //...
6
public void config(String name, String remote_addr, int listen_on, String log_dir, Properties[] filter_configs) { try { final Route route = new Route(name, listen_on, remote_addr, new File(working_directory, log_dir), filter_configs); synchronized (routes) { routes.add(route); } new Thread(route, name).s...
1
public void go() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Being child = being.split(); Supervisor.getSupervisor().registerBeing(child); }
0
public boolean checkUser(String login, String password) { result = "?"; ArrayList<User> users; try { users = DataBase.getInstance().getUsers(); for (Iterator it = users.iterator(); it.hasNext();) { User user = (User) it.next(); if (user.get...
5
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
7
public void dump() { for (int i = 0; i < framePointers.size(); i++) { System.out.print("["); int endFrame = runStack.size(); if (i < framePointers.size() - 1) { endFrame = framePointers.get(i + 1); } for (int j = framePointers.get(i); j...
4
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
@Override public void restoreTemporaryToCurrent() {tmp = cur;}
0
public static void addBook(Messagable ui, String isbn, String category, String author, String title, float dailyLateFee, float maxLateFee, int numberOfCopies){ boolean itemAdded = true; if(Book.bookExists(isbn)){ itemAdded = false; ui.sendMessage("ERROR: Item already exists"); } if(numberOfCopies < 1){ ...
7
private void setUpNextAndPreviousButtons() { // create the image icons for the buttons Icon prevIcon = new ImageIcon(DigitalPicture.class.getResource("leftArrow.gif"), "previous index"); Icon nextIcon = new ImageIcon(DigitalPicture.class.getResource("rightArrow.gif"), ...
4
public static String userOS() { String os = System.getProperty("os.name").toUpperCase(); if (os.indexOf("WIN") >= 0) { return "Windows"; } else if (os.indexOf("MAC") >= 0) { return "MacOSX"; } else if (os.indexOf("SUNOS") >= 0) { return "Solaris"; } else if (os.indexOf("NIX") >= 0 || os.indexOf("NUX") >= 0) { ret...
5
private void updateCreature(Creature creature, long elapsedTime) { //creature.updateRotation(elapsedTime); // change x float dx = creature.getVelocityX(); float oldX = creature.getX(); float newX = oldX + dx * elapsedTime; Point tile = getTileCollisi...
6
private void updateStateWaitingName(List<Keyword> keywords, List<String> terms) { //We came here since we didn't get a jump, if we got a jump we're in RECIPE_FOUND if (keywords == null || keywords.isEmpty()) { if (terms != null && !terms.isEmpty()) { //Will save first term no matter what user said. recipeName...
9
public static void main(final String[] args) { PrintStream origErr = System.err; PrintStream origOut = System.out; System.setErr(origOut); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { System...
3
@Test public void throwException() { C c = new C(); c.in = "1"; try { c.execute(); fail("Exception expected"); } catch (ComponentException E) { assertEquals(c.op2, E.getSource()); assertEquals("crash", E.getCause().getMessage()); } }
1
private void grow() { HugeLongArray oldAddresses = addresses; // instead of just doubling the size - this gives more prime number sizes which tend to distribute hash codes better int newCapacity = oldAddresses.size() <= 1 ? 2 : oldAddresses.size() * 2 - 1; initialize(newCapacity); for (int oldAddressInd...
8
public void upgrade() { if(tier < 19) { fuelCapacity += 20; fuelLevel += 20; tier++; } else { tier = 20; fuelCapacity = 500; fuelLevel = 480; } }
1
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("kits")) { if ((sender instanceof Player)) { Player player = (Player) sender; if(player.hasPermission("EasyPvpKits.Kits")) { ...
3
void display() { String s; switch( cardRanks[0] ) { case 1: s = "high card"; break; case 2: s = "pair of " + Card.rankAsString(cardRanks[1]) + "\'s"; break; case 3: s = "two pa...
9
public void updateSubTypes() { int offset = 0; if (!isStatic()) { subExpressions[offset++].setType(Type.tSubType(getClassType())); } Type[] paramTypes = methodType.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { Type pType = (hints != null && hints[i + 1] != null) ? hints[i + 1] ...
4
public void arrivalCheck(int currentPhase){ for(int i = 0 ; i < this.TrainList.size() ; i++){ Train tmpTrain = this.TrainList.get(i); if(tmpTrain.endTime == currentPhase){ Train tmpTrain2 = this.TrainList.remove(i); i--; ArrayList<Customer> tmpClist = tmpTrain2.customerList.dequeueAll(); ...
3
public final void run(EventTaskRunner runner) { try { if(Log.ON){Log.d("taskrunner","["+mid+"]"+"action:"+toString());} action(runner); if (isKeep()) { if(Log.ON){Log.d("taskrunner","["+mid+"]"+"action: next keep");} runner.start(this); } else if(runner != null&&mNextAction != null&&isNext()) ...
9
public static void testSwap(String f, int[][] grid, int[][] grid0, int myType, int i, int j, int k, int l) { if ((i == k) && (j == l)) { if (grid[i][j] != myType) { System.out.printf("Failed on %s @ (%d, %d) should not have moved\n", f, i, j); ...
7
public void hashify(Node n) { if(n==null){return;} if (n.parent == n && n != null) { hashInsert(n, n.label.charAt(0), n); for (Node child : n.children) { hashify(child); } } else if (n.parent != n && n != null) { if (n.label != null) { hashInsert(n.parent, n.label.charAt(0), n); for (Node ...
8
@Override public int create(Secteur unSecteur) throws Exception { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
0
@Override public Ingredient addIngredient(String s) { Ingredient c = getIngredient(s); if (c != null) { return c; } else { try (Connection connection = DriverManager.getConnection(connectionString);) { int idNewCategory = getNextIdAndIncrement(); PreparedStatement statement = connection.prepareStat...
2
@Override public String toString() { return "Medicament{" + "depotlegal=" + depotlegal + ", nomcommercial=" + nomcommercial + ", code=" + code + ", composition=" + composition + ", effets=" + effets + ", contrindic=" + contrindic + ", prix=" + prix + '}'; }
0
@Override public void collidedWith(Participant p1, Participant p2) { if (p1 instanceof Asteroid && p2 instanceof Ship) { asteroidCollision((Asteroid)p1); shipCollision((Ship)p2); } else if (p1 instanceof Ship && p2 instanceof Asteroid) { asteroidCollision((Asteroid)p2); shipCollision((Ship)p1); } ...
8
WorldTile(BufferedImage image, boolean passable, int minimapColor, int cost) { this.passable = passable; if (image == null) { logger.error(new NullPointerException(), "Attempted to add a null tile image to the map!"); } this.image = image; tileWidth = image.getWidth(); tileHeight = image.getHeight(); ...
1
public Communicate() { // TODO Auto-generated constructor stub }
0
public void run() { while (true) { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(7); Socket socket = null; System.out.println("Waiting for connection...."); socket = serverSocket.accept(); System.out.println("Connection successful"); System.out.println("Waiting...
2
public static boolean allKeyArgumentsBoundP(Proposition goal) { if ((goal.kind == Logic.KWD_FUNCTION) || Proposition.singleValuedPredicateP(goal)) { if (((Vector)(KeyValueList.dynamicSlotValue(goal.dynamicSlots, Logic.SYM_LOGIC_IO_VARIABLES, null))) != null) { { boolean alwaysP000 = true; ...
7
@Test public void testUpdateEditorsPick() { Integer testISBN = 800; Set<StockBook> books = new HashSet<StockBook>(); books.add(new ImmutableStockBook(testISBN, "Book Name", "Book Author", (float) 100, 1, 0, 0, 0, false)); try { storeManager.addBooks(books); } catch (BookStoreException e) { e.print...
9
private Object get(final int local) { maxLocals = Math.max(maxLocals, local); return local < locals.size() ? locals.get(local) : Opcodes.TOP; }
1
@Override public void tick() { if (target.isAlive()) { if (target.getPos().distance(pos) < 10 && isAlive) { this.hit(); // pos = target.getPos(); } else { Vector2d diff = target.getPos().difference(pos); diff.setLength(speed); pos = pos.sum(diff); } } else { isAlive = false; } }
3
static private float[] subArray(final float[] array, final int offs, int len) { if (offs+len > array.length) { len = array.length-offs; } if (len < 0) len = 0; float[] subarray = new float[len]; for (int i=0; i<len; i++) { subarray[i] = array[offs+i]; } return subarray; }
3
void setVisibilityFlags(BitSet bs) { /* * set all fixed objects visible; others based on model being displayed * */ for (int i = dipoleCount; --i >= 0;) { Dipole dipole = dipoles[i]; dipole.visibilityFlags = ((dipole.modelIndex < 0 || bs .get(dipole.modelIndex)) &...
9
private JFileChooser createFileChooser() { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileFilter(new TextFileFilter()); if (defaultDirectory != null) { fileChooser.setCurrentDirectory(defaultDirectory); } return fileChooser; }
1
private String suffer(int i) { String message = this.letter+" loses "+i +" hitpoints."; hitpoints = hitpoints - i; if (hitpoints <= 0) { this.board.removePawn(this); message += this.letter+" is dead."; } return message; }
1
protected void generateForce () { double currentLength = getCurrentLength(); boolean isContract = currentLength <= myRestLength; double distance = Math.abs(currentLength - myRestLength); double amplitude = distance * myStifness; if (amplitude == 0) return; do...
4
@SuppressWarnings("unchecked") public Vector arbitrary(Random random, long size) { int length = (int) Arbitrary.random(random, 0, Math.min(Integer.MAX_VALUE, size)); Vector list = new Vector(length); for (int i = 0; i < length; ++i) { li...
1
protected boolean isConnected(Node from, Node to) { // Antennas are hardwired - we exclude links between pairs of antennas. // MobileNodes are not connected among themselves if(from instanceof Antenna && to instanceof MobileNode || to instanceof Antenna && from instanceof MobileNode) { double dist = from.g...
4
public static int getXfromString(String location) { if ((location.charAt(0) == 'a')) { return 0; } if ((location.charAt(0) == 'b')) { return 1; } if ((location.charAt(0) == 'c')) { return 2; } if ((location.charAt(0) == 'd')) { return 3; } if ((location.charAt(0) == 'e')) { return 4; ...
8
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); HttpSession session = request.getSession(true); String id = request.getParameter("driverId"); String pwd = request.getParameter("driverPwd"); PrintWriter...
9
public static Inventory deserialize(byte[] bytes) { NbtTagCompound root = NbtFactory.toCompound(NbtSerializer.toTag(bytes)); if (root.getInt(VERSION_KEY) != NBT_VERSION) throw new IllegalArgumentException("Incompatible NBT-version!"); NbtTagList<NbtTagCompound> items = root.getList...
2
@Override protected boolean perform(final CommandSender sender, final Command command, final String label, final List<String> args, final Region region) { final String owner = RegionExecutor.parse(args, 0, "<Owner>", sender); if (owner == null) return false; if (!region.owners.contains(owne...
5
private void generateSqlProperties() { StringBuilder sbr = new StringBuilder(); sbr.append("JNDI.CONNECTION java:comp/env/jdbc/" + this.jndi + "\n\n"); sbr.append("CLASS.BROKER.IMPL br.com.topsys.database.jdbc.TSDataBaseBrokerImpl\n\n"); switch (this.database) { case DBModel.DB_ORACLE: sbr.append("CL...
9
public void makeSelection() { if(!list.getSelectedValue().startsWith("-1")) { selection = list.getSelectedValue().substring(0, list.getSelectedValue().indexOf(";")); dispose(); } }
1
public static void main(String[] args) { new WashStart().run(); }
0
public static void main(String[] args) { //Define loop for number of eggs in the basket for (int eggs = 0; eggs > -1; eggs++) { //Check if the number of eggs in the basket has the correct remainder when removing eggs if (eggs % 2 == 1 && eggs % 3 == 2 && eggs % 4 == 3 && eggs % 5 == 4 && eggs % 6 == 5 && eggs...
7
@SuppressWarnings("unchecked") private void parseQuery(String query, Map parameters) throws UnsupportedEncodingException { if (query != null) { String pairs[] = query.split("[&]"); for (String pair : pairs) { String param[] = pair.split("[=]"); ...
7
public byte[] data() { if (buffer == null) { buffer = new byte[FastConfig.HeaderLength]; } int count = 0; byte[] temp = MiscUtils.toByteArray(high); for (int i = 0; i < temp.length; i++) { buffer[count] = temp[i]; count++; } te...
9
private static BasicBlock getBBlock(Mark m) { BasicBlock b = m.block; if (b != null && m.size > 0) { b.exit = m.jump; b.length = m.size; b.stop = m.alwaysJmp; } return b; }
2
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
8
private void removeJSR(FlowBlock tryFlow, FlowBlock subRoutine) { for (Jump jumps = tryFlow.removeJumps(subRoutine); jumps != null; jumps = jumps.next) { StructuredBlock prev = jumps.prev; prev.removeJump(); if (prev instanceof EmptyBlock && prev.outer instanceof JsrBlock && ((JsrBlock) prev.outer).is...
5
public void mergeArray(int low, int middle, int high) { /** * Copying the whole set of values first. */ for (int i = low; i <= high; i++) { this.auxArray[i] = this.array[i]; this.arrayAccess += 2; } /** * Copying the indices for the le...
8
private synchronized boolean handleReservationJob(Gridlet gridlet) { int reqPE = gridlet.getNumPE(); SSGridlet sgl = new SSGridlet(gridlet); long runTime = super.forecastExecutionTime(ratingPE, sgl.getLength()); ServerReservation sRes = reservTable.get(gridlet.getReservationID()); //--...
4
public HashSet<String> generateCSVFromXML(String fileName, String csvFileName){ HashSet<String> stopwords = new HashSet<String>(); HashSet<String> productNameToWords = new HashSet<String>(); WordCleaner wc = new WordCleaner(); String stopwordFile = "xbox/stopwords.txt"; stopwords = getStopwords(stopwords, sto...
3
public static TestSettings findStoryboardById(ArrayList<TestSettings> storyboards, int id) { for(TestSettings storyboard:storyboards) { if(storyboard.getId()==id) { return storyboard; } } return new TestSettings(); }
2
public Player(int _playerId) { playerId = _playerId; playerRights = 0; for (int i=0; i<playerItems.length; i++) { playerItems[i] = 0; } for (int i=0; i<playerItemsN.length; i++) { playerItemsN[i] = 0; } for (int i=0; i<playerLevel.length; i++) { if (i == 3) { playerLevel[i] = 10; } else {...
8
private void usernameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_usernameKeyPressed if(evt.getKeyCode() == KeyEvent.VK_ENTER){ try { String name=username.getText(); String pass=password.getText(); String checkname = null; Strin...
6
public static double getSpeedMod(WeaponMaterial type) { //Higher numbers means slower switch (type) { case COPPER: return 1.1; case BRONZE: return 1.1; case SILVER: return 1.2; case IRON: return 1; ...
6
private static <E> void merge(E[] array, E[] temp,int begin, int end, Comparator<E> comparator){ int i = begin; int tracker = begin; int middex = (begin+end)/2; int rightstart = middex+1; // Goes through and compares the two segments of the array that we are focusing on...
5
private void writeExamples() throws Exception { int i; Vector<String> v = m_parent.getTagTextVector(m_doc, Constants.TAG_EXAMPLE, true); Vector<String> vc = m_parent.getTagTextVector(m_doc, Constants.TAG_EXAMPLE_CODE, true); Vector<String> vd = m_parent.getTagTextVector(m_doc, Constants.TAG_EXAMPLE_DESCRIPTION,...
8
private void init(Class<?> clazz, String conventionalName) { final URL resource = clazz.getResource(conventionalName); loader.setLocation(resource); try { loader.load(); } catch (IOException e) { throw new IllegalStateException("Cannot load FXML login screen", e); } }
2
public Vector<String> readScriptFile(File f) { Vector<String> actions = null; BufferedReader reader = null; try { if (f.canRead()) { actions = new Vector<String>(); reader = new BufferedReader(new FileReader(f)); String line = reader.readLine(); while (line != null) { actions.add(line); ...
6
public static void gotoNextLevel(GameStateManager gsm){ //save world we are currently in World cw = (World)gsm.getGameState(gsm.getCurrentState()); Save.writeWorld(cw, index); Save.writePlayerData(cw.getPlayer()); //get gametime to transfer to the new world and continue counting int time = cw.GameTime; ...
4
public String render(){ StringBuilder res = new StringBuilder(); if(statusCode != 0) res.append("HTTP/1.0 ").append(statusCode).append(" \n"); if(header == null) res.append(body.render()); else if(body == null) res.append(header.render()); else...
3