text
stringlengths
14
410k
label
int32
0
9
public void close() { if (State.CLOSED == getState()) return; setState(State.CLOSED); RotateTransition rotate = new RotateTransition(); rotate.setNode(cross); rotate.setToAngle(0); rotate.setDuration(Duration.millis(200)); rotate.setInterpolator(Interpolator.EASE...
3
public Set<Light> getLights(int[][] board) { lights = new HashSet<Light>(); objective = new HashMap<Integer,Tuple<Integer,Integer>>(); lightArr = new Light[numLights]; sectors = getSectors(); for( int i=0; i<numLights; i++) { int x = 0; int y = 0; double theta = i*(360/numLights) + (360/numLights)/2; log...
8
public void move() { if (!inTarget) { double a = Math.round(Math.cos(angle) * speed); curPosX += (int)a; double b = Math.round(Math.sin(angle) * speed); curPosY -= (int)b; if(curPosX <= 0 || curPosX >= rightBorder || curPosY <= 0 || curPosY >= downBorder) { needsDelete = true; } } else...
6
@Override public String toString() { return "First State"; }
0
public static int[] connections(int from) { int[] count = new int[nNodes]; Queue<Point> q = new LinkedList<Point>(); BitSet vis = new BitSet(nNodes + 1); Point e = new Point(from, -1); int next = 0; q.add(e); vis.set(from, true); while (!q.isEmpty()) { e = q.poll(); if (e.y != -1) count[e.y]++...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Border)) return false; Border other = (Border) obj; if (neighbour == null) { if (other.neighbour != null) return false; } else if (!neighbour.equals(other.neighbou...
7
public void testSetMilliOfSecond_int2() { MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8); try { test.setMillisOfSecond(1000); fail(); } catch (IllegalArgumentException ex) {} assertEquals("2002-06-09T05:06:07.008+01:00", test.toString()); }
1
@Override public SingleObjectiveSolution run() { int outer = schedule.getOuterLoopCounter(); int inner = schedule.getInnerLoopCounter(); double temp = schedule.getNextTemperature(); T omega = startWith; omega.value = function.valueAt(decoder.decode(omega)); omega.fitness = minimize ? -omega.value : omega.v...
8
private static final void traverse( final File file, final String path, final Collection<ClassPathHandler> handlers, final ClassLoader classLoader, final ErrorHandler errorHandler ) { if ( file.isDirectory() ) { ...
2
public void mostrarProcesos(){ //mbLog.setBounds(1, 81, 485,347); //mbLog.setVisible(true); NodosListaProceso aux = this.PrimerNodo; int i = 0; while (aux.siguiente!=null && i<cant) { //aux.proceso.setVisible(true); i++; aux=aux.siguiente; } //aux.proceso.setVisible...
2
@Override public int getMetricInternal() { int add = curGb.step(Move.A,curGb.pokemon.owPlayerInputCheckAAddress); // after IsSpriteOrSignInFrontOfPlayer call if(add == 0) { System.out.println("OverworldInteract: IsSpriteOrSignInFrontOfPlayer call not found"); return 0; } int id = curGb.readMemory(...
4
private void initFileMenu(JMenuBar menuBar) { JMenu menu = new JMenu("File"); menuBar.add(menu); JMenuItem menuItem = new JMenuItem("Load RDC data..."); menuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Bring up the Load File dialog browse...
6
public TrackingWnd(int direction, int delta, int a1, int a2) { super(new Coord(100,100), Coord.z, UI.instance.root, "Direction"); this.a1 = a1; this.a2 = a2; justclose = true; new Label(Coord.z, this, "Direction: "+direction+"o, delta: "+delta+"o"); pack(); Gob pl; if((ui.mapview.playergob >= 0) && ((pl = ui.se...
3
public double propositionWeight(Proposition proposition) { { WhynotPartialMatch self = this; if (proposition == null) { return (1.0); } else if (proposition.kind == Logic.KWD_ISA) { return (0.25); } else if ((proposition.kind == Logic.KWD_NOT) && (((Propositi...
7
public static void solveNearestNeighbor() { //Parse file Parser p = new Parser(); p.parse(); long startTime = System.nanoTime(); Graph g = new Graph(); //All cities g.cities = p.out; //Copy of cities LinkedList<Double[]> linkCities = new LinkedList<Double[]>(); g.bestTour = null; ...
5
public UsuarioFacade() { super(Usuario.class); }
0
public void Remove(Tick t) { synchronized(ticks) { if (ticks.contains(t)) ticks.remove(t); } }
1
public int hashCode() { return (String.valueOf(String.valueOf(Arrays.hashCode(currentCells)) + String.valueOf(intelligentX) + String.valueOf(intelligentY))) .hashCode(); }
0
public PolyLinje generateRandomPolylinje() { // Antalet horn på linjen int antalPunkter = 2; // Skapar en Punkt vektor som håller Punkterna Punkt[] punktVektor = new Punkt[antalPunkter]; for(int i = 0; i < antalPunkter; i++) { // X koordinat för Punkten int x = new Random().nextInt(10) + 1; // ...
5
public synchronized boolean seatPlayer(Player player, int index) throws IndexOutOfBoundsException { if (index > players.length) throw new IndexOutOfBoundsException( "The max number of players is four."); if (this.players[index] == null) this.players[index] = player; else return false; return tr...
2
public static void loadProperties() { try { PropertiesLoader.getInstance(); } catch (IOException e) { logger.error(e.getMessage(),e); System.err.println(e.getMessage()); } }
1
public boolean accept(File file) { if (file.isDirectory()) { return false; } String name = file.getName(); // find the last int index = name.lastIndexOf("."); if (index == -1) { return false; } else if (index == name.length() - 1) { ...
5
public void run(){ ReadingMessages serverReder; try { while(true) { SOCKET = serverSocket.accept(); System.out.println("New connection accepted..."); serverReder = new ReadingMessages(SOCKET, LOCAL_IP); serverReder.start(); ...
3
private OperationSignature(String opName, MBeanParameterInfo...infos) { this.opName = opName; List<Class<?>> sig = new ArrayList<Class<?>>(infos==null ? 0 : infos.length); List<String> strSig = new ArrayList<String>(infos==null ? 0 : infos.length); if(infos!=null) { for(MBeanParameterInfo pinfo: infos...
9
public void insert(Collidable c) { if (nodes.get(0) != null) { int index = getIndex(c); if (index != -1) { nodes.get(index).insert(c); return; } } stuff.add(c); if (stuff.size() > MAX_OBJECTS && level < MAX_LEVELS) { if (nodes.get(0) == null) { split(); } int i = 0; while (i < s...
7
@Override public boolean setHelm(Wearable helm) throws NoSuchItemException, WrongItemTypeException { if (helm != null) { if (helm instanceof Helm) { if (helm.getLevelRequirement() > level || helm.getStrengthRequirement() > stats[0] || helm.getDexterityRequirement() > stats[1] || helm.getMagicRequirement...
8
public void test_06() { String seqStr[] = { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }; // Two almost equal sequences (first one is longer) SuffixIndexerNmer<DnaSequence> seqIndex = new SuffixIndexerNmer<DnaSequence>(new DnaSubsequenceComparator<DnaSequence>(true, 0), NMER_SIZE); fo...
2
public static void main(String[] args) { SpiralIterator sp = new SpiralIterator(); int nums = 0, primes = 0; while (true) { nums++; int n = sp.next(); if (isPrime(n)) { primes++; } ...
4
public void readNeuron (LineNumberReader inputFile, boolean readInterConnections) { String inputLine,paramString,toNetName; StringTokenizer tokenizedLine; int testID=-1; double Weight = 0.0; int toNeuronID = 0; int axonsToRead=0; Double tempDouble; //read the neuron ID try { i...
8
@Override protected void paintSafely(Graphics g) { super.paintSafely(g); JTextComponent comp = getComponent(); if(fontOriginal==null){ fontOriginal=comp.getFont(); hintFont = new Font(fontOriginal.getName(), fontOriginal.getStyle() | Font.ITALIC, fontOriginal.getSize(...
6
public StructuredBlock prevCase(StructuredBlock block) { for (int i = caseBlocks.length - 1; i >= 0; i--) { if (caseBlocks[i].subBlock == block) { for (i--; i >= 0; i--) { if (caseBlocks[i].subBlock != null) return caseBlocks[i].subBlock; } } } return null; }
4
public double energy() { double d = 0.0; if (hasCharge_i && hasCharge_j) d += cou_ij; if (hasDipole_i && hasDipole_j) d += dipoleDipoleEnergy(); if (hasCharge_i && hasDipole_j) d += pjqi * rijuj; if (hasDipole_i && hasCharge_j) d += piqj * rijui; return d * rCD; }
8
@Override public void run() { if (args.length == 2) { try { if (args[1].equalsIgnoreCase("all")) { int j = 0; ArrayList<String> cs = api.getCoupons(); for (String i : cs) { api.removeCouponFromDatabase(i); j++; } sender.sendMessage(ChatColor.GREEN+"A total of "+ChatColor.G...
5
public ArrayList<User> getUsers() { ArrayList<User> userList = new ArrayList<User>(); for(int i = 0; i < serviceList.size(); i++) { userList.add(serviceList.get(i).getUser()); } return userList; }
1
@Override public void connect() throws NotConnectedException, IOException, AuthenticationNotSupportedException, FtpIOException, FtpWorkflowException { setConnectionStatusLock(FTPConnection.CSL_INDIRECT_CALL); socketProvider = new SocketProvider(); tr...
6
@Override public TKey getKey() { return this._key; }
0
* @param aspect der Aspekt * @param usage die Verwendung der Attributgruppenverwendung * @param isExplicitDefined gibt an, ob die Verwendung explizit vorgegeben sein muss * * @throws ConfigurationChangeException Falls der konfigurierende Datensatz nicht am Objekt gespeichert werden konnte...
8
@Override public void init(GameContainer gc) { if(_spriteSheet == null) { try { _spriteSheet = new SpriteSheet("res/sprites/followers.png", 32, 32, new Color(160, 176, 128)); } catch (SlickException e) { // TODO Auto-generated catch block e.printStackTrace(); } } _animation = new Animation[4...
3
public void dumpSource(TabbedPrintWriter writer) throws java.io.IOException { if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LOCALS) != 0) { if (declare != null) writer.println("declaring: " + declare); if (done != null) writer.println("done: " + done); writer.println("using: " + used); } ...
6
private List<String> scanLocal(File file) { List<String> messages = new ArrayList<String>(); InputStream stream = null; BufferedReader reader = null; String line; try { stream = new FileInputStream(file); reader = new BufferedReader( new InputStreamReader(stream)); while ((line = reader.read...
6
public void connectDb() { startSQL(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password); st = con.createStatement(); } catch (Exception e) { e.printStackTrace(); ...
1
@EventHandler public void OnPlayerDeath(PlayerDeathEvent event) { if (plugin.GameStarted == true) { Player p = event.getEntity(); if (plugin.sbHandler.goodTeam.getPlayers().size() >= 1) { if (plugin.sbHandler.goodTeam.hasPlayer(p)) { for(String str : plugin.PlayersInGame){ Bukkit.getPl...
5
public static void sqlQuery(String csvName,String characterSet,String valSeparator,String strSql) { Logger logger = Logger.getLogger(ProcessData.class); try { logger.info("Main Start"); String currentPath = System.getProperty("user.dir"); logger.info("GET Porperties File:\"" + currentPath + Fil...
4
public int size() { return this.list.size(); }
0
public void guardar() { try { if (!fichero.contains(".chp")) { fichero = fichero + ".chp"; } FileOutputStream fs = new FileOutputStream(fichero); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(principal); ...
2
private void ReadData() throws Exception { //As an exception could occur in the loading process, an exception handler is used. String key="", value=""; try { Scanner sc; InputStream stream = getClass().getClassLoader().getResourceAsStream(this._exceptionFileName); if (stream...
6
@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 Usuario)) { return false; } Usuario other = (Usuario) object; if ((this.idUsuario == null && other.idUsuario !=...
5
public int getInt(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { throw new JSONException("JSONObject[" ...
2
private void checkState() { if (!start) { throw new IllegalStateException( "Cannot visit member before visit has been called."); } if (end) { throw new IllegalStateException( "Cannot visit member after visitEnd has been called."); } }
2
public EnumRemoteScriptErrorType isBuildFileValid() throws Throwable { List<String> lines = Files.readAllLines(Paths.get(new File("build.hoppix").toURI()), Charsets.ISO_8859_1); String line = lines.get(0); if (line.startsWith("error")) { int indexOfSeparator = line.indexOf("|"); String errorMsg = line.su...
3
@Override public void deserialize(Buffer buf) { super.deserialize(buf); int limit = buf.readUShort(); spellCooldowns = new GameFightSpellCooldown[limit]; for (int i = 0; i < limit; i++) { spellCooldowns[i] = new GameFightSpellCooldown(); spellCooldowns[i].dese...
3
private void _getLock() throws WriterException { try { this.file = new RandomAccessFile(ConfigurationManager.read.getConfigFile(), "rw"); this.channel = this.file.getChannel(); try { this.lock = this.channel.tryLock(); } catch (OverlappingFileLockException e) { throw new WriterException(lockExcep...
3
public double getMeanofDuration(RequestType type) { long sum = 0; int cnt = 0; switch (type) { case ONDEMAND: for(OndemandRequest on: getOndemand()) { long duration=on.getDuration(); sum+=duration; cnt++; } break; case SPOT: for(SpotRequest on: getSpot()) { long duration=...
7
final public Value getValue() throws ParseException { Attribute.Type type; String val; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case INT_LITERAL: jj_consume_token(INT_LITERAL); type = Attribute.Type.INT; val = token.image; break; case DECIMAL_LITERAL: jj_...
5
@Override public void startSetup(Attributes atts) { Outliner.menuBar = this; Outliner.outliner.setJMenuBar(this); }
0
static public int[] InitialSolutionFromFile(int noOfPeaks, int noOfAA){ int[] initialSol= new int[noOfAA+1]; boolean[] aaCheck= new boolean[noOfAA+1]; try { BufferedReader br_solution; br_solution = new BufferedReader(new FileReader("initialsolution.txt")); for(int i=1;i<=noOfPeaks;i++){ Stri...
9
@SuppressWarnings("deprecation") public synchronized void flush(String tableName) throws IOException { HTableInterface hTable = tablePool.getTable(tableName); try { hTable.flushCommits(); } finally { if (hTable != null) { tablePool.putTable(hTable); } } }
1
@Override public void itemStateChanged(ItemEvent event) { Object object = event.getSource(); if (object == portComboBox) { portComboBox_itemStateChanged(event); } else if (object == baudComboBox) { baudComboBox_itemStateChanged(even...
2
public ArrayList<String> letterCombinations(String digits) { String[] digitalMap = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; ArrayList<String> result = new ArrayList<String>(); if (digits.length() == 0) { result.add(""); return result; }...
7
public static final long hash(byte[] b, long m) { long h = 1125899906842597L; // prime for (int i = 0; i < b.length; i++) h = 31*h + b[i]; return (h & 0x7fffffffffffffffL) % (m > 0 && m < p ? m : p); }
3
public void run() { try { this.MPrio.acquire(); this.MReading.acquire(); if(this.counter == 0) this.MWriting.acquire(); this.counter++; this.MReading.release(); System.out.println("Lecture"); Thread.sleep(100); this.MReading.acquire(); this.counter--; ...
3
public static void readFile(String filePath) { int lineFlag = 0; int caseCounter = 0; int vectorLength = 0; try { FileInputStream fstream = new FileInputStream(filePath); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strL...
8
public static void putf(String format, Object... items) { if (format == null) throw new IllegalArgumentException("Null format string in TextIO.putf() method."); try { out.printf(format,items); } catch (IllegalFormatException e) { throw new IllegalArgumentException("Ill...
3
void performTest(int mask, boolean watchSubtree, ArrayList<Command> commands, ArrayList<Event> expectedEvents) throws IOException { System.out.println("JUnit : -------------- performTest -------------- :"); String rootDir = "$$$_TEST_$$$/"; File testRoot = new File(rootDir).getAbsoluteFile(); // make sure th...
9
public static String encrypt(String input, String key){ int inputLength = input.length(); char[] out = new char[inputLength]; int code = key.hashCode(); Character[] mapping = randomizeArray(getMasterMapping(), code); for(int i = 0; i < inputLength; i++){ char x = input.charAt(i); if(x < 32 && x != 9 && ...
7
public void resetTableau (){ for (int i=0; i<this.getRowCount()+hauteurZoneFantome;i++){ for (int j=0;j<this.getColumnCount(); j++){ images[i][j]=frame; if (i>=hauteurZoneFantome){ this.setValueAt(images[i][j], i-hauteurZoneFantome, j); ...
3
private void temporalProcessing(){ System.out.println("Rate of non null results: " + pitches.length/nonNullPitches); System.out.println("Results under examination: " + postModeNotes.length); System.out.println("Pitch per Second: " + (float) (AudioData.SAMPLE_RATE/(pitches.length/pitchSampleGroup.length))); S...
9
@Override public String toString() { return getDescription(); }
0
private void wordSelectHandler(Page currentPage, Point mouseLocation) { if (currentPage != null && currentPage.isInitiated()) { // get page text PageText pageText = currentPage.getViewText(); if (pageText != null) { // clear the currently sel...
7
public void addAccount(BankAccount account) throws IllegalArgumentException { if (! canHaveAsAccount(account)) throw new IllegalArgumentException(); accounts.add(account); }
1
public void randomDeck(ArrayList<Card> cards) { Random r = new Random(); r.setSeed(System.currentTimeMillis()); do { int numLands = r.nextInt(15) + 15; for (int i = 0; i < (60 - numLands)/4; i++){ Card c = cards.remove(r.nextInt(cards.size() - 1)); for(int j = 0; j < 4; j++) this.cardList.ad...
3
public void getInitialLocation(SensorInterface si) { if (si == null) { return; } if (!hasSentInitialLocation) { hasSentInitialLocation = true; si.startingXCoord = floorPlan.getInitialX(); si.startingYCoord = floorPlan.getInitialY(); } else { ...
2
public static long to_long(String aString) { if (aString.equalsIgnoreCase("")) { // Default noDataValue return Long.MIN_VALUE; } try { return new BigInteger(aString).longValue(); } catch (NumberFormatException aNumberFormatException) { Stri...
8
public TestInfo runInTheCloud(String userKey, String testId) { TestInfo testInfo = null; String error = null; if (userKey == null || userKey.trim().isEmpty()) { error = "Test cannot be started in the cloud, userKey is empty"; BmLog.debug(error); testInfo = new...
6
public List<String> getArgs(){ ArrayList<String> args = new ArrayList<String>(); for (int i = 1; i < command.size(); i++) args.add(command.get(i)); return args; }
1
private void cftrec4_th(final int n, final float[] a, final int offa, final int nw, final float[] w) { int idiv4, m, nthread; int idx = 0; nthread = 2; idiv4 = 0; m = n >> 1; if (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_4Threads()) { nthread = 4; ...
8
private void processCyclisedChain(Element chainGroup, Element cycloEl) throws ComponentGenerationException { String smiles=chainGroup.getAttributeValue(VALUE_ATR); int chainlen =0; for (int i = smiles.length() -1 ; i >=0; i--) { if (Character.isUpperCase(smiles.charAt(i)) && smiles.charAt(i) !='H'){ chainl...
9
public void put(String atrName, Object val) { if (atrName.equals(LABEL)) { g.setLabel((String) val); } else if (atrName.equals(ZOOM)) { g.setZoom((ArrayX<String>) val); } else if (atrName.equals(FONT)) { g.setFont((Font) val); } else if (atrName.equals...
8
public void run() { if (Fenetre._list_birds.size() != 0) Fenetre._fenster.changeBird(Fenetre._list_birds.get(0)); while (Fenetre._state == StateFen.Level) { this.printObj(); try { Thread.sleep(_REFRESH_AFF); } catch (InterruptedException e) { e.printStackTrace(); } } }
3
public void mouseClicked(MouseEvent me) { int clickCount = me.getClickCount(); int button = me.getButton(); if (popup != null) { popup.setVisible(false); if (clickCount == 2) { if (journals != null) AccountDetails.getAccountDetails(selectedAccount, journal...
4
private static double[] getSupportPoints(int lineNumber, double[] lowPrices) { double[] sPoints = new double[lineNumber]; for(int i =0;i<lineNumber-1;i++){ double price = 999999999; for(int j=-5;j<=0;j++){ if((i+j>=0) && (i+j<lineNumber-1) && lowPrices[i+j]<pri...
5
@Test public void removeAt() { RandomAccessDoubleLinkedList test = new RandomAccessDoubleLinkedList(); try { test.removeAt(2); // empty list fail("ValueException"); } catch (InvalidAccessException e) { } catch (Exception e) { fail("Unexpected Exception"); } try { test.insertAt(2, 3); test...
8
public void RSAEncrypt(int length, int modulus_size) throws RdesktopException { byte[] inr = new byte[length]; // int outlength = 0; BigInteger mod = null; BigInteger exp = null; BigInteger x = null; this.reverse(this.exponent); this.reverse(this.modulus); System.arraycopy(this.client_random, 0, inr...
7
@Override protected final void finalize() throws Throwable { synchronized (Path.finalizerMonitor) { final Set<PathReference> ss = new HashSet<>( this.successors.values()); for (final WeakReference<Path> s : ss) { if (!s.isEnqueued()) { s.get().finalize(); } } if (this.parent != null) { ...
4
private Sprite getClosestTarget(LinkedList<Sprite>targets){ Sprite closestTarget = null; if(targets == null){ closestTarget = null; }else{ closestTarget = targets.get(0); for(int i = 0; i < targets.size(); i++){ if(distanceBetween(this, closestTarget) > distanceBetween(this, targets.get(i))){ cl...
3
public List<WorldName> sendRequest(String lang) { List<WorldName> result = new ArrayList<WorldName>(); RestTemplate rest = new RestTemplate(); String json = rest.getForObject("https://api.guildwars2.com/v1/world_names.json?lang="+lang, String.class); ObjectMapper mapper = new ObjectMapper(); try { JsonNode...
2
public boolean canBuild(Player player, Block block) { // Default FALSE return unless conditions are true boolean canwg = false; boolean canps = false; if (pstones != null) { if (PreciousStones.API().canBreak(player, block.getLocation())) canps = true; ...
7
@Override public String toString() { if (symbol >= '1' && symbol <= '9') { return "Character " + symbol; } else if (symbol == 'N') { return "North Wind"; } else if (symbol == 'E') { return "East Wind"; } else if (symbol == 'W') { return "West Wind"; } else if (symbol == 'S') { ...
8
public boolean isObfuscated() { return isObfuscated; }
0
public static ArrayList getSerialResumo(String arg_serial) throws SQLException, ClassNotFoundException { SimpleDateFormat sdf3 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); ArrayList<ja_jdbc_plpgsql.bean.bRegistro> aobj = new ArrayList<ja_jdbc_plpgsql.bean.bRegistro>(); ArrayList<ja_jdbc_plpgs...
7
public static void registerSignal(Signal signal) throws SignalNameInUseException { if (linker.containsKey(signal.getSignalName())) { throw new SignalNameInUseException("Error: This signal name is currently in use"); } SignalStructure struct = new SignalStructure(signal.getParams(), new ArrayList<Slot>(), si...
1
public int getRemotePort() { return remotePort; }
0
public static void main(String[] args) { try { AppGameContainer app = new AppGameContainer(new Game("Forgotten Space")); app.setDisplayMode(640, 480, false); app.setTargetFrameRate(60); app.start(); } catch (SlickException e) { Logger.getLogger(Game.class.getName()).log(Level.SEVERE, null, e); } ...
1
@Override public void undo() { // Find the node we will change focus too, note may end up null Node youngestNode = ((PrimitiveUndoableInsert) primitives.get(primitives.size() - 1)).getNode(); Node newSelectedNode = youngestNode.prev(); // Shorthand JoeTree tree = youngestNode.getTree(); OutlineLayoutMan...
7
public String printAST() { StringBuilder ret = new StringBuilder(); int len = rhs.size(); for(int i=0; i < len; i++){ if(rhs.get(0) instanceof Expr && i > 0) ret.append(" "); if(rhs.get(i) instanceof Terminal){ ret.append(((Terminal)rhs.get(i)).printAST()); }else if(rhs.get(i) instanceof Call){ ...
5
public void resolveCollision(int ix, int jx, Player player, boolean isHorizontal) { // First resolve in y // move upward until not touching Rectangle tileRec = new Rectangle(ix * tileSizeX, jx * tileSizeY, tileSizeX, tileSizeY); // Rectangle playerRec = p1.getBounds(); double ...
7
public PreferencesDialog(Frame owner) { super(owner, "Recipe Preferences", true); opts = Options.getInstance(); sb = owner; Enumeration<NetworkInterface> interfaces; try { interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()){ NetworkInterface current = ...
9
private void addFriend(String friend) { if (currentProfile != null) { if (!friend.equals(currentProfile.getName())) { if (database.containsProfile(friend)) { if (currentProfile.addFriend(friend)) { database.getProfile(friend).addFriend(currentProfile.getName()); canvas.displa...
4
@Override public void finishPopulate() { setBbox(new double[]{getCoordinates().getLongitude(), getCoordinates().getLongitude(), getCoordinates().getLatitude(), getCoordinates().getLatitude()}); }
0
private byte[] buildMultipartBody(Map<String, String> params, byte[] photoData, String boundary) throws JinxException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { String filename = params.get("filename"); if (JinxUtils.isNullOrEmpty(filename)) { ...
9