text
stringlengths
14
410k
label
int32
0
9
public static boolean isConnected(mxAnalysisGraph aGraph) { Object[] vertices = aGraph.getChildVertices(aGraph.getGraph().getDefaultParent()); int vertexNum = vertices.length; if (vertexNum == 0) { throw new IllegalArgumentException(); } //data preparation int connectedVertices = 1; int[] visited ...
8
private void generateLookupTable() { for (int i = 0; i < 512; i++) { boolean[] bits = toBinaryArray(i, 9); int liveNeighbors = 0; for (int j = 0; j < 9; j++) { if (bits[j] && j != 4) { liveNeighbors++; } } boolean isLiving = bits[4]; if (!isLiving && liveNeighbors == 3) { lookupTabl...
9
public static void binaryInsertionSort(Comparable[] a, int lo, int hi) { for (int i = lo + 1; i <= (hi < lo + 7 ? hi : lo + 7); i++) { for (int j = i; j > lo && less(a[j], a[j-1]); j--) exch(a, j, j-1); } for (int i = lo + 8; i <= hi; i++) { // ...
9
@Basic @Column(name = "CTR_POS_ID") public int getCtrPosId() { return ctrPosId; }
0
public void transformMove() { System.out.println("Coin.transformMove()" + this); lastMovedCoin = this; LudoRegion region = null; path = new Path(); // if region 4 than Cordenate from = new Cordenate(this.getBlockNo().getX(), this .getBlockNo().getY()); MoveTo to = new MoveTo(this.getCenterX(), this.ge...
9
@Override public void sendAllNow() throws IOException { if (isNotReady()) { return; } while (!outbound.isEmpty()) { send(); } while (!bufferOut.isEmpty()) { write(); } }
3
public KeyNoncePair(byte[] key) { byte[] nonce = new byte[NONCE_SIZE]; for(int i = 0; i < NONCE_SIZE; i++) { nonce[i] = key[i]; } this.key = key; this.nonce = nonce; }
1
private void quicksort(final int p, final int r) { if (p < r) { final int q = partition(p, r); quicksort(p, q); quicksort(q + 1, r); } }
1
public void end (String name) { if (warmup) return; long e = System.nanoTime(); long time = e - s; Long oldTime = testTimes.get(name); if (oldTime == null || time < oldTime) testTimes.put(name, time); System.out.println(name + ": " + time / 1000000f + " ms"); }
3
public double historicalEventExecute( double historicalEventTime){ historicalEvent tempEvent; double gen = historicalEventTime; if(currentEvent == null){ System.out.println("Sorry no historical event to execute"); return 0; } else{ dem.dgLog(10 , currentEvent.getGen(), currentEvent.getLabel()); sw...
8
public String getIdName(){ if(id < 10){ return "000" + id; } else if(id >= 10 && id < 100){ return "00" + id; } else if(id >= 100 && id < 1000){ return "0" + id; } else{ return "" + id; } }
5
public URI crawl(URI currentLocation, final String needle) throws URISyntaxException, MalformedURLException, InterruptedException, ExecutionException { String urlContents = downloadContents(currentLocation); visitedUrls.add(currentLocation); if (urlContents.contains(needle)) { return currentLocation; } e...
5
public Map<String, Object> getConfiguration() { @SuppressWarnings("unchecked") Map<String, Object> config = (HashMap<String, Object>) servletContext.getAttribute(Constants.CONFIG); // so unit tests don't puke when nothing's been set if (config == null) { return new HashMap<String,...
1
public int Run(RenderWindow App){ boolean Running = true; Text scenario = new Text(); Font Font = new Font(); try { Font.loadFromFile(Paths.get("rsc/font/mrsmonsterrotal.ttf")); } catch (IOException e) { e.printStackTrace(); return (-1); ...
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((msg.amITarget(affected)) &&(mobs.contains(msg.source()))) { if((msg.targetMinor()==CMMsg.TYP_BUY) ||(msg.targetMinor()==CMMsg.TYP_BID) ||(msg.targetMinor()==CMMsg.TYP_SELL) ||(msg.targetMinor()==CMMsg.T...
8
public void run(String[] args) throws FileNotFoundException, IOException { Card card = PCSCManager.getCard(); if (card != null) { String atr = Hex.printBytesHexa(card.getATR() .getBytes()); Logger.log(card.toString() + "\n"); Logger.log(PCSCManager.getCardName(atr) + "\n"); Logger.log("ATR: " + a...
1
public formHelp() { initComponents(); }
0
public void start(String msgIn) { MSG = msgIn; reset(); }
0
public void clear() { do { CacheableNode cacheableNode = recent.popFront(); if (cacheableNode != null) { cacheableNode.unlink(); cacheableNode.unlinkSub(); } else { capacity = srcCapacity; return; } } while (true); }
2
public static <E extends Comparable<E>> void sortWithStack(Stack<E> stack) { if(stack.isEmpty()) { return; } Stack<E> auxStack = new Stack<E>(); while(!stack.isEmpty()) { E item = stack.pop(); while(!auxStack.isEmpty() && auxStack.peek().compareTo(item)>0) { E tmpItem = auxStack.pop(); s...
6
public void addNodeSorted(treeNode newNode, treeNode curRoot) { if (newNode.value < curRoot.value) {// add to left child tree if (curRoot.leftLeaf != null) { addNodeSorted(newNode, curRoot.leftLeaf); } else { curRoot.leftLeaf = newNode; newNode.parent = curRoot; } } if (newNode.value > curRo...
4
public CycObject readNart() throws IOException { CycNart cycNart = null; int cfaslOpcode = read(); if (cfaslOpcode == CFASL_NIL) { cycNart = CycObjectFactory.INVALID_NART; isInvalidObject = true; } else if (cfaslOpcode != CFASL_LIST) { if (cfaslOpcode == CFASL_SYMBOL) { ...
4
public static int upperBound(int key) { int lower = 0, upper = dig.length - 1, ans = -1; while (lower <= upper) { int mid = (lower + upper) / 2; if (key < dig[mid].s) upper = mid - 1; else { lower = mid + 1; ans = mid; }...
5
private void qsort(Object[] items, Comparator comparator, int l, int r) { final int M = 4; int i; int j; Object v; if((r - l) > M) { i = (r + l) / 2; if(comparator.compare(items[l], items[i]) > 0) { swap(items, l, i); } if(comparator.compare(items[l], ite...
8
private void setupMaps(InputMap input_map, ActionMap action_map) { input_map.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false), "left"); input_map.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.SHIFT_MASK, false), "left"); input_map.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK, false), "l...
0
protected HsqlDaoBase(HsqlUnitOfWork uow) { super(uow); try { Connection connection = uow.getConnection(); ResultSet rs = connection.getMetaData().getTables(null, null, null, null); boolean exist = false; stmt =connection.createStatement(); while(rs.next()) { if(rs.getString("TABLE...
4
public int getLanguageID( TLanguageFile checkFile ) { int back = UNDEFINED_LANG ; if ( checkFile != null ) { if (checkFile.hasLanguageExtension() ) { boolean found = false ; int t = 0 ; int len = langVersions.size() ; while ( ( !found ) && ( t < len ) ) ...
5
@Test public void adenAskEmployeePriceTest(){ LocalDate date = LocalDate.now(); int dayOfWeek = date.getDayOfWeek(); boolean weekend = false; Canteen c2 = new Canteen(new CanteenData(CanteenNames.ADENAUERRING, 0)); int dayShift = (dayOfWeek + 2) % 7; if(dayOfWeek == 0 || (dayOfWeek == 6)) { // weekends ...
4
public Object readParamInXmlFile(String paramName){ ArrayList<String> params = new ArrayList<String>(); try{ File fXmlFile = new File(fileName); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; dBuilder = dbFactory.newDocumentBuilder(); Document do...
7
public void foward(float delta, Level level, int currentRoom) { Float x,y,z,minX,maxX,minY,maxY; minY = level.getRoomList().get(currentRoom).getPos().getY(); maxY = level.getRoomList().get(currentRoom).getPos().getY() + level.getRoomList().get(currentRoom).getDy(); minX = level.getRoomList().get(currentRoom)...
7
public void initialize() { //finding out number of possible tiles File tilelist; try { tilelist = new File(getClass().getResource("resources/tiles.txt").toURI()); } catch(URISyntaxException e) { tilelist = new File(getClass().getResource("resources/tiles.txt").get...
6
public static boolean start(RootDoc root) { // Get some options String title = "My Ant Tasks"; String[] templates = null; String templatesDir = "."; String[] outputdirs = new String[] { "."}; String[][] options = root.options(); for (int opt = 0; opt < options.l...
9
public static List<Query> loadQueriesFromFile(String filePath) { List<Query> queries = new ArrayList<Query>(); InputStream fis = null; BufferedReader reader = null; try { // fis = ClassLoader.getSystemResourceAsStream(filePath); fis = new FileInputStream(filePath); reader = new BufferedReader(new Inpu...
8
public boolean estaEnExtremos(){ boolean resp= false; if (siguiente==null || previo == null) resp = true; return resp; }
2
public void applySortConfig(String config) { int result = applySortConfigInternal(config); if (result == 0) { notifyOfSortCleared(); } else if (result == 1) { sort(); } }
2
@SuppressWarnings("unchecked") @Override public double getScore(Object userAnswer) { if (userAnswer == null) return 0; String ans = (String) userAnswer; ArrayList<String> trueAns = (ArrayList<String>) answer; for (int i = 0; i < trueAns.size(); i++) { if (trueAns.get(i).equals(ans)) return score; ...
3
private String[] letterPairs(String word) { String[] result = new String[0]; int numPairs = word.length() - 1; if (numPairs > 0) { result = new String[numPairs]; for (int letterCounter = 0; letterCounter < numPairs; letterCounter++) { result[letterCounter] = word.substring(letterCounter, letterCou...
2
public int deleteUser(String userID) { try { // Erforderlicher SQL-Befehl String sqlStatement = "DELETE FROM bookworm_database.users WHERE id = " + userID + ";"; // SQL-Befehl wird ausgeführt successful = mySQLDatabase.executeSQLUpdate(sqlStatement); return successful; } catch (Exception e) ...
1
public int compareTo(Instruction instr) { if (addr != instr.addr) return addr - instr.addr; if (this == instr) return 0; do { instr = instr.nextByAddr; if (instr.addr > addr) return -1; } while (instr != this); return 1; }
4
@Override public String toString() { String s = getSignature(); for (String perm : permissions) s += " " + perm; if (this.isSource || this.isSink || this.isNeitherNor) s += " ->"; if (this.isSource) s += " _SOURCE_"; if (this.isSink) s += " _SINK_ "; if (this.isNeitherNor) s += " _NONE_";...
8
@Override public void postInfo() { //before the beginning of the game get all players to rotate and 'find' all of the //in game components if(playMode == PlayMode.BEFORE_KICK_OFF){ canSeeNothingAction(); }else if(playMode == PlayMode.CORNER_KICK_OWN || playMode == PlayMod...
3
public void merge(int A[], int m, int B[], int n) { int j = m-1; int k = n-1; for (int i =m + n -1 ;i>=0;i--) { if (j >=0 && k >=0) { if (A[j] >= B[k]) A[i] = A[j--]; else A[i] = B[k--]; } else if (j >=0) A[i] = A[j--]; else A[i] = B[k--]; } ...
5
public void animate() { Timeline mainAnimation = new Timeline(); mainAnimation.getKeyFrames().addAll( new KeyFrame(Duration.millis(0), new KeyValue( glow.radiusProperty(), 1d)), new KeyFrame(Duration.millis(5000), new KeyValue(glow .radiusProperty(), 13d)), new KeyFrame(Duration.millis(1000...
0
private void initMap() { int[] moves = { 0,-1, 1,0, 0,1, -1,0 }; for( int i = 0; i < 11; i++ ) { for( int j = 0; j < 11; j++ ) { Point currentPos = new Point( i, j ); ArrayList<Point> nextPoss = new ArrayList<Point>(5); nextPoss.add( currentPos ); for( int p = 0; p < 8; p = p + 2 ) { Point n...
7
@Override public boolean equals(Object obj) { if (this == obj) return true; else if (obj == null || obj.getClass() != this.getClass()) return false; CoordXZ test = (CoordXZ)obj; return test.x == this.x && test.z == this.z; }
4
public void tick() { super.tick(); if(lifetime > 0) { lifetime--; } else { remove = true; } for(Entity e : level.entities) { if(this != e) { ...
7
public void init() { if (el.winwidth==0) { // get width/height from applet dimensions el.winwidth=getWidth(); el.winheight=getHeight(); } initCanvas(); if (!el.view_initialised) { exitEngine("Canvas settings not initialised, use setCanvasSettings()."); } if (!i_am_applet) { jre.createWindow(t...
8
protected boolean meetsCriteria(Entity e) { boolean works = true; if(requiredComponents != null) for(Class<? extends Component> comp : requiredComponents) { if(!e.has(comp)) works = false; } if(bannedComponents != null) for(Class<? extends Component> comp : bannedComponents) { if(e.has(comp...
8
@Override public boolean equals(Object o) { if (! (o instanceof PoliLine)) { return false; } Iterator<Point> other = ((PoliLine) o).iterator(); boolean started = false; Iterator<Point> me = this.iterator(); if (! me.hasNext()) { return (! other.hasNext()); } Point otherFirst = other.next...
9
public void addRoute(String path, Callback callback) { URI uri; try { uri = new URI(path); } catch (URISyntaxException e) { throw new IllegalArgumentException("invalid URI format of parameter `path`"); } if (!TextUtils.isEmpty(uri.getScheme())) { ...
3
final void method3983(int i, int i_63_, int i_64_, boolean[][] bools, boolean bool, int i_65_) { anInt5151 = -1; int i_66_ = 0; float[] fs = new float[aClass262_5149.getSize(0)]; for (Class348_Sub1 class348_sub1 = (Class348_Sub1) aClass262_5149.getFirst(4); class348_sub1 != null; class348_sub1 ...
8
public String getDbProperty(String key) { Properties properties = new Properties(); try { FileInputStream fileInputStream = new FileInputStream( getClass().getClassLoader().getResource(".").getPath() + File.separator + "resources" + File.separator + DB_CONFIGURATION_FILE); properties.load(...
1
public static void deleteCustomer(Integer ID) { Database db = dbconnect(); try { String query = "UPDATE customer SET bDeleted = 1 " + "WHERE CID = ?"; db.prepare(query); db.bind_param(1, ID.toString()); db.executeUpdate(); db.close(); } catch(S...
1
public Matrix4f mul(Matrix4f r){ Matrix4f res = new Matrix4f(); for (int i = 0; i < 4; i++){ for (int j = 0; j < 4; j++){ res.set(i,j,m[i][0] * r.get(0,j) + m[i][1] * r.get(1,j) + m[i][2] * r.get(2,j) + ...
2
public static void main(String[] args) { Scanner Terminal = new Scanner(System.in); Scanner Terminal2 = new Scanner(System.in); int choice1; int choice2; int pin = 0; int pinCheck; double balance = 0; double deposit; double withdrawal; String firstName = null; String lastName = null; System.o...
9
public final EsperParser.vartype_return vartype() throws RecognitionException { EsperParser.vartype_return retval = new EsperParser.vartype_return(); retval.start = input.LT(1); Object root_0 = null; Token set44=null; Object set44_tree=null; try { // C:\\...
3
static String getPlatformFont() { if(SWT.getPlatform() == "win32") { return "Arial"; } else if (SWT.getPlatform() == "motif") { return "Helvetica"; } else if (SWT.getPlatform() == "gtk") { return "Baekmuk Batang"; } else if (SWT.getPlatform() == "carbon") { return "Arial"; } else { // photon, etc ... ...
4
public final Token readToken() { while (this.position < this.expression.length()) { if (Character.isWhitespace(this.expression.charAt(this.position))) ++this.position; else break; } if (this.position == this.expression.length()) ...
6
public int[] getAlpha() { return alpha; }
0
public void test_02() { String args[] = { "-v"// , "-noStats" // , "-i", "vcf", "-o", "vcf" // , "-classic" // , "-onlyTr", "tests/filterTranscripts_02.txt"// , "testHg3765Chr22" // , "tests/test_filter_transcripts_001.vcf" // }; SnpEff cmd = new SnpEff(args); SnpEffCmdEff cmdEff = (Sn...
4
private void selectNextItem() { int i = 0; boolean selectNext = true; while(i<elements.size() && (! elements.get(i).isSelected()) ) { i++; } if (i<elements.size()) { if (elements.get(i) instanceof AxesElement && ((AxesElement)elements.get(i)).isXSelected()) { ((AxesElement)elements.get(i)).setSelec...
7
public void processMsg(ServerMsg m) throws IOException{ String tag = m.getTag(); tag = tag.trim(); threadMessage("Processing Msg " + m.srcID + " " + m.destID + " " + m.tag + " " + m.getMessage()); //Messages received as worker if(tag.equals("job_init")){ //set server worker ob...
8
public playerDataSave(CreeperWarningMain plugin) { this.plugin = plugin; this.dir = new File(plugin.getDataFolder() + File.separator + "Players"); this.type = new File(plugin.getDataFolder() + File.separator + "Players" + File.separator + path + ".data"); }
0
public void run(){ sort(); }
0
private void method362(int i, int ai[], byte abyte0[], int j, int k, int l, int i1, int ai1[], int j1) { int k1 = -(l >> 2); l = -(l & 3); for(int l1 = -i; l1 < 0; l1++) { for(int i2 = k1; i2 < 0; i2++) { byte byte1 = abyte0[i1++]; if(byte1 != 0) ai[k++] = ai1[byte1 & 0xff]; els...
8
public JMenu getFileMenu(){ JMenu file = new JMenu("File"); file.setMnemonic('F'); JMenuItem open = new JMenuItem("Open project"); open.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileC...
5
public void setIdPerfil(Integer idPerfil) { this.idPerfil = idPerfil; }
0
private static boolean insertEmployee(Employee bean, PreparedStatement stmt) throws SQLException{ stmt.setString(1, bean.getName()); stmt.setString(2, bean.getUsername()); stmt.setString(3, bean.getPass()); stmt.setDate(4, bean.getDob()); stmt.setString(5, bean.getPhone()); stmt.setString(6, bean.getAddr...
1
public int compare(boolean[] class_list, int datapoint) throws BoostingAlgorithmException{ int c; int class_index = -1; int classification = -1; //determine what class in the classlist the datapoint has for (c = 0; c < classes; c++) { if (data.classes[datapoint].equals(data.classlist[c])) { class_index...
9
@Override public Class<?> getDataType() { return superType.getDataType(); }
1
public void run() { while (this.running) { this.tickCount += 1L; if (this.tickCount % 500L == 0L) { System.gc(); Debug.println("gc() called, freeMemory(): " + Runtime.getRuntime().freeMemory()); } this.timestamp = System.currentTimeMillis(); tick(); l...
4
public int getLength(){ return dataBaseFiles.size(); }
0
public void paint(Graphics g) { if (first != null && current != null) { ((Graphics2D) g).setStroke(new BasicStroke(lineWidth)); g.setColor(lineColor); Rectangle rect = current.getRectangle(); if (rounded) { g.drawRoundRect(rect.x, rect.y, rect.width, rect.height, 8, 8); } else { g....
3
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); // Reset those transient listener guys. listeners = new HashSet(); }
0
public void create(Workstation workstation) throws PreexistingEntityException, RollbackFailureException, Exception { if (workstation.getComputadoraCollection() == null) { workstation.setComputadoraCollection(new ArrayList<Computadora>()); } EntityManager em = null; try { ...
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Fraction other = (Fraction) obj; if (denominator == null || other.denominator == null) return false; if (numerator == null || other.numerator == null)...
8
public static void main(String args[]){ String frase1 ; String frase2 ; int tamano1,tamano2; frase1 =JOptionPane.showInputDialog(null,"Ingrese una frase","Frase 1",JOptionPane.QUESTION_MESSAGE); frase2= JOptionPane.showInputDialog(null,"Ingrese otra frase","Frase 2",JOptionPane...
5
private void moveOutgoingArcs( Node from, Node to ) throws MVDException { while ( !from.isOutgoingEmpty() ) { Arc a = from.removeOutgoing( 0 ); to.addOutgoing( a ); } // check if node is now isolated if ( from.indegree()==0&&from.outdegree()==0 ) from.moveMatches( to ); }
3
protected String addParameters(String path, Map<String, String> parameters) { if (path == null) { path = ""; } StringBuffer sb = new StringBuffer(path); if (parameters != null && parameters.size() > 0) { try { boolean hasParameters = path.indexOf("...
6
@SuppressWarnings({ "unchecked", "rawtypes" }) protected Object convert(Object oldObject, String property) { Object result = oldObject; Class<?> type = propertyTypes.get(property); if (type.isEnum()) { result = Enum.valueOf((Class<Enum>) type, (String) oldObject); } if (type.equals(BigInteger.class)) { ...
5
@Override public boolean validate(String str) { try { String[] data = str.split(","); if (data.length < 3 || data.length > 3) return false; if (!data[0].equals("oo") || !data[0].equals("-oo")) Double.parseDouble(data[0]); if (!data[1].equals("oo") || !data[1].equals("-oo")) Double.parseDouble...
9
@Override public void startOutline () { // initialize the current node to the root node of the outline this.currentNode = tree.getRootNode(); // clear out any existing children. while (currentNode.numOfChildren() > 0) { currentNode.removeChild(currentNode.getLastChild()); } // end while // set the...
1
public void removeState(State state) { if (this.states.contains(state)) { this.states.remove(state); state.setTray(null); } }
1
void setDomParent(final Block block) { // If this Block already had a dominator specified, remove // it from its dominator's children. if (domParent != null) { domParent.domChildren.remove(this); } domParent = block; // Add this Block to its new dominator's children. if (domParent != null) { domPa...
2
public ResultSet getList(String whereString) { StringBuffer sql = new StringBuffer(""); sql.append("SELECT Question_ID,QType_ID"); sql.append(" FROM `Question`"); if (whereString.trim() != "") { sql.append(" where " + whereString); } SQLHelper sQLHelper = new...
1
public void run() { String buffer; while (this.isActive()) { try { while ((buffer = in.readLine()) != null) { handleReceivedData(buffer); if (dataQueue.length() > 0) { out.write(dataQueue); ...
4
public void run() { PokerState currentState = new PokerState(); while( scan.hasNextLine() ) { String line = scan.nextLine().trim(); if( line.length() == 0 ) { continue; } String[] parts = line.split("\\s+"); if( parts.length == 2 && parts[0].equals("go") ) { // we need to move PokerMove move = b...
9
private void fillZipEntries(int nr) { Enumeration zipEnum = zips[nr].entries(); zipEntries[nr] = new Hashtable(); while (zipEnum.hasMoreElements()) { ZipEntry ze = (ZipEntry) zipEnum.nextElement(); String name = ze.getName(); // if (name.charAt(0) == '/') // name = name.substring(1); if (zipDirs[nr...
5
public void draw() { for(int x = 0; x<mapTiles.size(); x++) { mapTiles.get(x).draw(); } }
1
@Override public boolean update(DataRow parameters, DataRow row) { Boolean flaga = false; String stm; String tabelName = row.getTableName(); List<DataCell> cells = row.row; List<DataCell> toUpdate = parameters.row; ...
3
T select(T a[], int r, int i, int j) { int n = a.length; int pIndex = findPivot(a, i, j); int k = new QuickSorter<T>().partition(a, i, j, pIndex); int rPivot = n - k + 1; if (r == rPivot) return a[r]; else if (r < rPivot) return select(a, r, k + 1, j); else if (r > rPivot) return select(a, r - ...
3
private void backTrackingAfter3() { FeatureGenerator fg=new FeatureGenerator(); double result=0.0; String antFeature=featureModelBruteForce; double difference=0.0; //ADD FEATURES TO THE POOL. //If we have 3... // {f1,f2,f3} => { {f1},{f2},{f3},{f1,f2},{f1,f3},{f2,f3},{f1,f2,f3} } // ArrayList<S...
9
public static boolean validate(Stack<Character> p, char k) { Iterator<Character> it = p.iterator(); ArrayList<Character> list = new ArrayList<Character>(); ; while (it.hasNext()) { list.add(it.next()); } int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i) == index) { index = ...
9
public void doPaletteStuff() { int palette; //byte[] pal; int cnt; int bzc; cnt = plyr.damagecount; if (plyr.powers[pw_strength] != 0) { // slowly fade the berzerk out bzc = 12 - (plyr.powers[pw_strength] >> 6); if (bzc > cnt) ...
9
protected void addGlied() { if (nextGlied == null) { //create/add new glied Rectangle newMasse = (Rectangle) getBounds().clone(); newMasse.x -= getDirection().x * width; newMasse.y -= getDirection().y * height; SchlangenGlied newGlied = new SchlangenGlied(newMasse, unit, Zufallsgenerator.zufallsFar...
1
public String [] getOptions() { // Currently no way to set custompropertyiterators from the command line m_UsePropertyIterator = false; m_PropertyPath = null; m_PropertyArray = null; String [] rpOptions = new String [0]; if ((m_ResultProducer != null) && (m_ResultProducer instanceof Opt...
8
private void parseInstruction(Program program) { // Parse mnemonic (easy) String mnemonic = tokenizer.next().text; // Parse operands (hard) List<Operand> operands = new ArrayList<Operand>(); boolean expectcomma = false; while (!tokenizer.check(TokenType.NEWLINE)) { if (!expectcomma) { if (tokenize...
9
public boolean setStance(Player player, Stance newStance) { if (player == null) { throw new IllegalArgumentException("Player must not be 'null'."); } if (player == this) { throw new IllegalArgumentException("Cannot set the stance towards ourselves."); } if...
7
private double minDist(Freckle[] freckles) { double minDistance = 0; boolean[] inTree = new boolean[freckles.length]; double[] minDists = new double[freckles.length]; for (int i = 0; i < freckles.length; i++) { minDists[i] = Double.MAX_VALUE; } int newNode = ...
7
protected void rmBus (Object busname) { USB bus = (USB) busses.get (busname); if (bus != null) { if (trace) System.err.println ("rmBus " + bus); for (int i = 0; i < listeners.size (); i++) { USBListener listener; ...
5