text
stringlengths
14
410k
label
int32
0
9
private void checkKeys() { if (Keyboard.typed(KeyEvent.VK_LEFT)) { moveTiles(Direction.LEFT); if (!hasStarted) hasStarted = true; } if (Keyboard.typed(KeyEvent.VK_RIGHT)) { moveTiles(Direction.RIGHT); if (!hasStarted) hasStarted = true; } if (Keyboard.typed(KeyEvent.VK_UP)) { moveTiles(...
8
public void writeControl (byte type, byte request, short value, short index, byte buf []) throws IOException { if (buf == null) { // assume we're doing a No-Data-Control, and somebody // has to make a 0-length buf buf = new byte[0]; } if (buf.length >= MAX_CONTROL_LENGTH || (type & Cont...
5
public void parse() throws FileNotFoundException, IOException { BufferedReader br = new BufferedReader(new FileReader(getFichierObject())); String line = null; String[] lineSplit; String[] vertex; List<Vecteur> vts = new ArrayList<>(); List<Vecteur> vns = new ArrayList<>(...
5
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) { int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest); MediaLibAccessor srcMA1 = new MediaLibAccessor(sources[0], destRect, forma...
9
public boolean isLayer() { return isLayer; }
0
@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 DeliveryPacket)) { return false; } DeliveryPacket other = (DeliveryPacket) object; if ((this.id == null && othe...
5
public int getMax(int[][] matrix, int startRow) { int curMax = 0; for (int i = startRow; i < matrix.length - 1; i++) { for (int j = i + 1; j < matrix.length; j++) { if (matrix[i][j] > curMax) { curMax = matrix[i][j]; } } } return curMax; }
3
public static void rebuildSessionFactory() { try { configuration.configure(configFile); sessionFactory = configuration.buildSessionFactory(); } catch (Exception e) { System.err .println("%%%% Error Creating SessionFactory %%%%"); e.printStackTrace(); } }
1
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
5
private int getMaxChildHeuristic(Map <Integer, Integer> heuristicMap) { int maxWeight = 0; for (TrieNode child : this.children.values()) { Integer weight = heuristicMap.get(Integer.valueOf(child.getId())); if (weight != null && weight > maxWeight) { maxWeight = weight; } } return ma...
3
public DirectionalDeltaSource getDirectionalDelta() { if (empty) throw new IllegalStateException("No element(s) have been added to cumulative delta"); return new DirectionalDeltaSource() { private DirectionalFragment fragment = forward; private int number = 0; private int dataAt = 0; public boole...
7
@Override public Iterator<T> iterator() { return new Iterator<T>(){ // Classe anonyme LLIterator private SLLNode<T> nextNode = head; private int nbLeft = size; @Override public boolean hasNext() { return nbLeft > 0; } ...
3
public String getPrettyWarnings() { String warnings = null; if (hasWarnings()) { for (String warnMsg : getWarnings()) { warnings = warnings + "|" + warnMsg; } } else { warnings = "Unknown"; } return warnings; }
2
private void demo() { String protocol = "http://"; String port = ":5910"; String hostname=""; try { hostname = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(hostname.equals("127.0.0.1")) ho...
7
@Override public void run() { try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } double x = 0., y = 0.; ThreadLocalRandom rand = ThreadLocalRandom.current(); ...
3
@Test public void lineOneTomorrowAdenExpl() { LinkedList<String> meals = new LinkedList<String>(); LinkedList<String> price = new LinkedList<String>(); Canteen curCanteen = new Canteen(new CanteenData(CanteenNames.ADENAUERRING, 1));// 1 for "tomorrow" for (MealData m : curCanteen.getCanteenData().getLines().ge...
3
public static void playSound(String pathToFX) { try { soundFile = new File(pathToFX); } catch (Exception e) { e.printStackTrace(); } try { audioStream = AudioSystem.getAudioInputStream(soundFile); } catch (Exception e) { e.printStackTrace(); } audioFormat = audioStream.getFormat(); DataLi...
7
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
7
public static double cbrt(double x) { /* Convert input double to bits */ long inbits = Double.doubleToLongBits(x); int exponent = (int) ((inbits >> 52) & 0x7ff) - 1023; boolean subnormal = false; if (exponent == -1023) { if (x == 0) { return x; } ...
4
public void makeDeclaration(Set done) { block.propagateUsage(); block.makeDeclaration(done); if (nextByAddr != null) nextByAddr.makeDeclaration(done); }
1
public static List<Long> triggerAfterSubmissionEvaluation(Submission submission) { Problem problem = submission.getProblem(); if (problem==null){ throw new IllegalArgumentException("Problem cannot be null"); } if (problem.getId()==0){ throw new IllegalArgumentException...
9
@Override public void sort(int[] array) { for( int i = 0, s = array.length; i < s; ++i ) { Integer min = array[i]; int minIndex = i; for( int j = i+1; j < s; ++j ) { if( min > array[j] ) { minIndex = j; min = array[j]; } } int swap = min; array[ minIndex ] = array[i]; array...
3
public static void main(String[] args) { for (String arg : args) { params += arg + "\n"; } }
1
@Override public void mousePressed(final MouseEvent e) { final Point p = e.getPoint(); final Element element = getGraphicPanel().getElementAt(p); if (element instanceof Vertex) { final Vertex vertex = (Vertex) element; if (this.edge == null) { this.edg...
5
public void mouseClicked(MouseEvent mouse){ System.out.println(mouse.getSource()); if(conversationJLabels!=null){ for(JLabel jl:conversationJLabels){ if(mouse.getSource().equals(jl)){ System.out.println("Clicked JLabel"); for(DialoguePart dp:conversationDialogue){ if(jl.getText().equals(dp.ge...
8
public EmployeeGUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel = new JPanel(); panel.setBounds(0, 0, 448, 271);...
5
@Override public void init(){ global.setSystemLaF(true); if(getParameter("url")!=null) if(!(getParameter("url").equals("none"))){ //loaders.WebFile file=null; String in=""; try { URL url = new URL(getParameter("url")); Buffe...
5
public void advance() { try { switch (parser.ttype) { case StreamTokenizer.TT_NUMBER: tokenType = TYPE_INT_CONST; intValue = (int)parser.nval; break; case StreamTokenizer.TT_WORD: String w...
5
public static int searchInsert(int[] A, int target) { if (null == A || 0 == A.length) return 0; int low = 0; int high = A.length - 1; while (low < high) { int mid = (low + high)/2; if (A[mid] == target) return mid; else if (A[mid] < target) low = mid + 1; ...
7
public static void main(String[] args) { System.out.println("Opening port..."); try { serverSocket = new ServerSocket(PORT); } catch (IOException iex) { System.out.println("Unable to attach to port!"); System.exit(1); } do { handeClient(); } while (true); }
2
public void setSubExpressions(int i, Expression expr) { int diff = expr.getFreeOperandCount() - subExpressions[i].getFreeOperandCount(); subExpressions[i] = expr; expr.parent = this; for (Operator ce = this; ce != null; ce = (Operator) ce.parent) ce.operandcount += diff; updateType(); }
1
public void mouseReleased(MouseEvent e) { if (layerDrag && (e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) { Dimension d = getSize(); CPArtwork artwork = controller.getArtwork(); Object[] layers = artwork.getLayers(); layerDrag = true; layerDragY = e.getPoint().y; int layerOver = (d.heigh...
6
public final void handleDestroy(BlockBreakEvent event) { destroy(event); if (event.isCancelled()) return; event.setCancelled(true); Block block = event.getBlock(); block.setType(Material.AIR); if (event.getPlayer().getGameMode() != GameMode.CREATIVE) { for (Iterator<ItemStack> dropped = getDrops().it...
9
public ObjectInfoObjectType(SyntaxPart n1, UnitsPart n2, AccessPart n3, StatusPart n4, DescriptionPart n5, ...
8
private void pollInput() { while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { if (!toast.visible) { if (Keyboard.getEventKey() == Keyboard.KEY_A) { Main.getGamestate().getPlayer().move(-1, 0); } else if (Keyboard.getEventKey() == Keyboard.KEY_D) { Main.getGamestate().getPlayer()...
9
public byte[] findAttribute(String name) { if (unknownAttributes != null) return (byte[]) unknownAttributes.get(name); return null; }
1
public void reset() { for (int z = 0; z < mapSizeZ; z++) { for (int x = 0; x < mapSizeX; x++) { for (int y = 0; y < mapSizeY; y++) { groundTiles[z][x][y] = null; } } } for (int i = 0; i < SceneGraph.anInt472; i++) { for (int j = 0; j < SceneGraph.cullingClusterPointer[i]; j++) { SceneGra...
7
public void toggle(){ if (bombsBeingRevealed || isOpen) return; if (markIndex == 0) MainFrame.changeFlagCount(true); else if (markIndex == 1) MainFrame.changeFlagCount(false); ++markIndex; markIndex %= 3; /* if (markIndex != 0) getModel().setEnabled(false); else{ getModel().setEnabled(tru...
4
public List<AssignmentObj> getAssignmentTable(PreparedStatement pre, boolean inner) { List<AssignmentObj> items = new LinkedList<AssignmentObj>(); try { ResultSet rs = pre.executeQuery(); if (rs != null) { while (rs.next()) { AssignmentObj item...
4
private void isEqualToInteger(final Object param, final Object value) { if (value instanceof Integer) { if (!((Integer) value).equals(((Integer) param))) { throw new IllegalStateException("Integers are not equal."); } } else { throw new IllegalArgumentException(); } }
2
public Node getNodeAt(Graphics2D g2, Point point) { Rectangle rect = new Rectangle(point.x - 1, point.y - 1, 3, 3); for (Node node : tree.getExternalNodes()) { Shape taxonLabelBound = tipLabelBounds.get(node); if (taxonLabelBound != null && g2.hit(rect, taxonLabelBound, false)) { return node; } } ...
8
Item newDouble(final double value) { key.set(value); Item result = get(key); if (result == null) { pool.putByte(DOUBLE).putLong(key.longVal); result = new Item(index, key); put(result); index += 2; } return result; }
1
public void setHora(int hora) { this.hora = hora; }
0
public void addNewOccurrence(String document) { //Duplicate checking boolean add = true; for(Occurrence occ: docsList.toArray()){ if(occ.getDocName().compareTo(document) == 0){ add = false; occ.incFrequency(); } } if(add){ ...
3
@Override public boolean tick(Tickable ticking, int tickID) { final Physical affected = this.affected; if((affected instanceof MOB)&&(this.beingSpoken(ID()))) { final MOB mob=(MOB)affected; final Room R=mob.location(); if((R!=null) &&(R.getArea() instanceof BoardableShip) ||((mob.riding()!=null)&...
7
@Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { logger.info("User Login to initialize authorized....."); ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal(); //1)获取用户信息的所有资料,如权限角色等. User user = userService.findUser(shiroUser....
3
public void buyPotatoes(String hisName) { Scanner scan = new Scanner(System.in); for (int i = 0; i < theGame.listOfFarmers.length; i++) { if (hisName.equalsIgnoreCase(theGame.getFarmersName(i))) { System.out.println("You can buy " + theGame.getFarmersA...
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ScyReturPabrikItemPK other = (ScyReturPabrikItemPK) obj; if (!Objects.equals(this.noDokumen, other.noDoku...
4
@Override public String toString() { return "rlog:" + name(); }
0
private static Player nightPhaseHelper(GameState state, Color faction) { for(Player p : state.getPlayerList()) { if(p.getFaction().equals(faction)) { while(state.getTime() == Time.NIGHT) { Player player = state.getPlayer(faction); if(player != null) { ArrayList<Card> den = ...
9
@Override public void actionPerformed(ActionEvent e) { if(e.getSource() == krakButton) { if(task.isDone()) { view.setVisible(true); } else { krakButton.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURS...
4
private void load(){ String path=""; defaults = new ArrayList<ArrayList<String>>(); try { path = SBStringUtils.getAppPath("data"); File file = new File(path, fileName); if (file.exists()){ CSVReader reader = new CSVReader(new FileReader(file)); try { while (true){ String[] f...
5
static void lireChoix() { int choix = 0; while (choix < 5) { choix = afficheMenu(); switch (choix) { case 1: // deplacer(porteAvion pa, Avion avion);break; case 2:// decoller(Avion avion);break; case 3:// atterir(Avion avion); break; case 4: // rienFaire(); break; case 5: quitter(); br...
6
void printBandwidth(PassthroughConnection ptc, long time) { int total = 0; for(int cnt=0;cnt<256;cnt++) { total += ptc.packetCounters[cnt] - ptc.packetLastCounters[cnt]; } ptc.printLogMessage(""); ptc.printLogMessage("Bandwidth Stats - last " + (period/1000) + " seconds" ); for(int cnt=0;cnt<256;cnt++) ...
6
public void setSampleOutput(String sampleOutput) { this.sampleOutput = sampleOutput; }
0
public void ge_while_jump(TextArea area,String prefix,int cur_while_num){ if(or_last<=0 && and_last<=0){ String instr =prefix+ "br i1 %cmp"+String.valueOf(cmp_num-1)+", label %land.lhs.true"+String.valueOf(true_num)+", label %lor.lhs.false"+String.valueOf(false_num)+"\n\n"; area.append(i...
8
private void calculateExtremPoints() { ModelProxy tmp; String[] lowest = new String[]{"bottom", "left", "far"}; String[] highest = new String[]{"top", "right", "near"}; for (Map.Entry i : models.entrySet()) { tmp = (ModelProxy) i.getValue(); for (String k : high...
5
public static void arquivoPerceptron(String nome, Perceptron perceptron, Double[][] amostras, Double[] esperado, Double[][] testes, Double taxa, Integer maxEpocas) { try { FileWriter fileWriter = new FileWriter(nome); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); // for (int i = 0; i ...
5
public void doGet(HttpServletRequest sreq, HttpServletResponse sres) throws ServletException, IOException { String path = (String) sreq.getAttribute("javax.servlet.include.servlet_path"); if (path==null) path=sreq.getServletPath(); if (path.length()==0) ...
7
public void setMinus(GoTerm goTerm) { if( symbolIdSet != null ) symbolIdSet.removeAll(goTerm.symbolIdSet); if( interestingSymbolIdSet != null ) interestingSymbolIdSet.removeAll(goTerm.interestingSymbolIdSet); }
2
public boolean existComplaint(int id) { for (int i=0; i < complaints.size(); i++) { if (complaints.get(i).getId() == id) return true; } return false; }
2
public void doGame() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("what will your fingerprint be?"); String in = br.readLine(); this.client.network.setFingerprint(in); System.out.println("commands are 'connect' and 'disconnect'"); whi...
5
public boolean isDefault(aos.apib.Base o) { HeartBeatTimer v = (HeartBeatTimer)o; if (v.peerID != __def.peerID) return false; if (v.upload != __def.upload) return false; if (v.download != __def.download) return false; if (baseclasses != null && baseclasses.length == 1) return baseclasses[0].isDe...
5
@Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._tipo_ == oldChild) { setTipo((PTipo) newChild); return; } for(ListIterator<PVar> i = this._var_.listItera...
4
public LSystemInputPane getInputPane() { return (LSystemInputPane) getSource(); }
0
@Override public Vehicule putVehicule(Vehicule v) throws BadResponseException, JSONException { Representation r = new JsonRepresentation(v.toJSON()); r = serv.putResource("intervention/" + interId + "/vehicule", null, r); Vehicule vehicule = null; try { vehicule = new Vehicule(new JsonRepresentation(r).ge...
2
public boolean getGodMode(){ return godMode; }
0
public void setPanel(Panel p) { this.panel = p; }
0
public void setSenao(List<?> list) { for(PComando e : this._senao_) { e.parent(null); } this._senao_.clear(); for(Object obj_e : list) { PComando e = (PComando) obj_e; if(e.parent() != null) { e.parent()...
4
private void updateOffsets() { if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_LEFT)) { xOffset = 0.0; yOffset = 0.0; } else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM)) { xOffset = -this.blockWidth / 2.0; yOffset = 0.0; } ...
9
private DetectorMatch mozillaCheck( String fileName ) { DetectorMatch back = null ; nsDetector det = new nsDetector() ; // Set an observer... // The Notify() will be called when a matching charset is found. MyMozillaObserver observer = new MyMozillaObserver() ; det.Init( observer ) ; t...
9
public void setWaypoint(double x, double y) { targetX = x; targetY = y; double myTheta = state.get(7) % (Math.PI * 2); //my theta, between 0 and 6.28 if(myTheta < 0) myTheta+= Math.PI * 2.0; double yDist = (state.get(1)+scrollY) - targetY; //y and x distance to the waypoint ...
7
public Vector<String[]> filterTypes( Vector<String[]> oldStreams) { //contains filtered streams Vector<String[]> newStreams = new Vector<String[]>(0,1); if(oldStreams.capacity()>0) { for(int i=0; i < oldStreams.capacity(); i++) { //add mp3 streams if(showMP3Streams.isSelected() && oldStreams.ge...
8
public String getName() { return name; }
0
public boolean hasPrayItemInHand(Player p) { //material equals if(!p.getItemInHand().getType().equals(ConfigHandler.prayItem) || !p.getItemInHand().hasItemMeta()) return false; //another check -.- if(!p.getItemInHand().getItemMeta().hasDisplayName()) return false; //has correct name if(p.getItemInHand...
4
private void CalcNormals(Vertex[] vertices, int[] indices) { for(int i = 0; i < indices.length; i += 3) { int i0 = indices[i]; int i1 = indices[i + 1]; int i2 = indices[i + 2]; Vector3f v1 = vertices[i1].GetPos().Sub(vertices[i0].GetPos()); Vector3f v2 = vertices[i2].GetPos().Sub(vertices[i0].Ge...
2
public Integer LookupValue(Variable x) { Integer i = valueMap.get(x); return i; }
0
public void testFactory_between_RInstant() { // test using Days DateTime start = new DateTime(2006, 6, 9, 12, 0, 0, 0, PARIS); DateTime end1 = new DateTime(2006, 6, 12, 12, 0, 0, 0, PARIS); DateTime end2 = new DateTime(2006, 6, 15, 18, 0, 0, 0, PARIS); assertEquals(3, Si...
3
public void renderTile(int xp, int yp, Tile tile) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < tile.sprite.SIZE; y++) { int ya = y + yp; for (int x = 0; x < tile.sprite.SIZE; x++) { int xa = x + xp; if (xa < -tile.sprite.SIZE || xa >...
7
public void move() { int pinkoLHS = area.x; int pinkoRHS = area.x + area.width; if (pinkoLHS <= PINKO_MOVE_AREA_LHS) { currentDirection = RIGHT; } if (pinkoRHS >= PINKO_MOVE_AREA_RHS) { currentDirection = LEFT; } ...
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Player other = (Player) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fa...
7
public void paint(Graphics g) { super.paintComponent(g); Graphics2D graphics_2d = (Graphics2D) g; //draw the chess board graphics_2d.setColor(new Color(0,0,0)); graphics_2d.drawRect(0,0,600,600); graphics_2d.setColor(new Color(128,121,124)); for(int i = 0; i < 500; i += 150) { for(int k = 75; k <= 525...
8
protected boolean setEstatCasella( EstatCasella e, int fila, int columna ) throws IndexOutOfBoundsException { switch ( getEstatCasella( fila, columna ) ) { case JUGADOR_A: num_fitxes_a--; break; case JUGADOR_B: num_fitxes_b--; break; case BUIDA: break; } switch ( e ) { case J...
6
public void atBinExpr(BinExpr expr) throws CompileError { int token = expr.getOperator(); int k = CodeGen.lookupBinOp(token); if (k >= 0) { /* arithmetic operators: +, -, *, /, %, |, ^, &, <<, >>, >>> */ if (token == '+') { Expr e = atPlusExpr...
4
protected int countNeighbours(int col, int row) { int total = 0; total = getCell(col-1, row-1) ? total + 1 : total; total = getCell( col , row-1) ? total + 1 : total; total = getCell(col+1, row-1) ? total + 1 : total; total = getCell(col-1, row ) ? total + 1 : total; total = getCell(col+1, row ) ? total +...
8
private void fillHotels(List<Hotel> hotels, AbstractDao dao) throws DaoException { if (hotels != null) { for (Hotel hotel : hotels) { Criteria descCrit = new Criteria(); descCrit.addParam(DAO_ID_DESCRIPTION, hotel.getDescription().getIdDescription()); ...
4
private FactoryPoint<?> getFactoryPointByName(final List<FactoryPoint<?>> factoryPoints, final String name) { for (final FactoryPoint<?> factoryPoint : factoryPoints) { final FactoryPointMethod<?> factoryPointMethod = (FactoryPointMethod<?>) factoryPoint; if (factoryPointMethod.getMetho...
7
public void stop() { if (volume != Volume.MUTE) { if (clip.isRunning()) clip.stop(); } }
2
public void removePiece(Pawn pawn){ if (this.type.equals("start")){ this.numOccupants--; if (this.numOccupants == 0) this.occupied = false; this.pawnList.remove(pawn); } else if (this.type.equals("home")){ this.numOccupants--; if (this.numOccupant...
4
public TDRodCutting(int n, int price[]) { this.n = n; r = new int[price.length]; p = price; cuts = new String[price.length]; r[0] = 0; p[0] = 0; cuts[0] = ""; for (int i = 1; i < price.length; i++) r[i] = Integer.MIN_VALUE; r[n] = cutRod(n); }
1
public static boolean chooseOpen() { JFileChooser cho = new JFileChooser(file); cho.setFileSelectionMode(JFileChooser.FILES_ONLY); FileFilter emu = new FileFilter(){{} @Override public boolean accept(File f) { if (f.isDirectory()) return true; String ext = getExtension(f); if (ext != null) { ...
6
public String loadAgendamento() throws ParseException { Map parametros = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String dataStr = parametros.get("dataHora").toString(); DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dat...
5
void start (){ timer.start(); for (int i = 0; i < form.field.length; i++){ for (int j = 0; j < form.field[i].length; j++){ form.field[i][j] = false; } } for (int i = 0; i < form.field.length; i++){ for (int j = 0; j < form.field[i].length...
9
public ClientHandeler(ServerConnectionHandler serverConnectionHandler, IdDto oo) { this.conn = serverConnectionHandler; this.id = oo.id; }
0
public static void DFS(int r, int used, int mask, double curD) { if (used >= dist.length || curD > min) { min = Math.min(curD, min); return; } else for (int i = r; i < dist.length; i++) if ((mask & (1 << i)) == 0) { mask |= (1 << i); for (int j = i + 1; j < dist.length; j++) if ((mask &...
6
private void updateButtonState() { if (Simulation.isPaused() && !Simulation.isStarted()) { //if paused and simulation stopped pauseSim.setText("Pause Simulation"); startSim.setText("Start Simulation"); pauseSim.setEnabled(false); } else if (Simulation.isPaused() && ...
8
public boolean addModule(Module module){ boolean attemptToSchedule=true; boolean coupled = false; int count = 0; if (scheduledModules.size() != 0){ for (Module moduleTwo : scheduledModules) { if (checkCoupledModules(module, moduleTwo) != 0) { //ie cannot be scheduled today, as already scheduled one...
7
public static int BruteForce (String str, int start, String pattern) { if (str == null || str.length() == 0 || pattern == null || pattern.length() == 0) { return -1; } int i = start, j =0; int sizeS = str.length(), sizeP = pattern.length(); while (i < sizeS && j < sizeP) { if (str.charAt(i) == patter...
8
public List<Controls> getControls(boolean detachPrimaryCheckbox) { List<Controls> controlsList = new ArrayList<Controls>(); if (controls == null) { OptionsPanel optionsPanel = new OptionsPanel(); final JCheckBox showTextCHeckBox = new JCheckBox("Show " + getTitle()); ...
7
@Before public void setUp() { h = new BinaryHeap(); v = new Vertex(0, 0); }
0