text
stringlengths
14
410k
label
int32
0
9
private MoveDirection getPlayerMove() { MoveDirection moveDirection = null; try { Terminal terminal = Terminal.setupTerminal(); int c = terminal.readVirtualKey(System.in); if (c == VIRTUAL_LEFT) { moveDirection = MoveDirection.MOVE_LEFT; } else if (c == VIRTUAL_RIGHT) { moveDirection = MoveDirec...
5
private int getY(int[][] value, int x) { for (int y=0; y<6; y++) { if (value[x][y] == 0) { return y; } } return -1; //return -1 if column is full }
2
public String wordWrap(String s, int width, double scale) { if (!(s.indexOf(' ') > -1) && !(s.indexOf('\r') > -1)) return s; ArrayList<String> lines = new ArrayList<String>(); String[] currentLines = s.split("\r"); for (String l : currentLines) lines.add(l); String result = ""; for (int i = 0; i < li...
7
public HashMap<Integer, Integer> modificationMap() { HashMap<Integer, Integer> modifs = new HashMap<Integer, Integer>(); for(int i = 0; i < players.length; ++i) { if(players[i].getReserve().isFired() && players[i].getReserve().getModificator().getType() == 0) { modifs.put(i, 0); } ...
9
public boolean ApagarTodosQuandoExcluiPessoa(int idPessoa){ try{ PreparedStatement comando = banco.getConexao() .prepareStatement("UPDATE emails SET ativo = ? WHERE id = ?"); comando.setInt(1, 0); comando.setInt(2, idPessoa); comando.executeUpd...
1
private void TimeSet(int prevmode) { if (prevmode != MODE_TSET) { inputval = clocktime; } if (bl && cursor < 5) { cursor++; } else if (br && cursor > 0) { cursor--; } else if (bu) { inputval = IncTime(inputval, cursor); } else if (bd) { if (GetDigit(inputval, cursor) > 0) { inputval = D...
8
private void recursiveGetBoxesInRegion(Box root, Rectangular r, Vector<Box> result) { if (r.encloses(root.getVisualBounds())) { if (!root.getVisualBounds().isEmpty()) result.add(root); } else { for (int i = 0; i < root.getChildCount(); ...
3
private boolean isExistingLogin(String login){ if (this.file.exists()) { try { BufferedReader br = new BufferedReader( new InputStreamReader( new FileInputStream(this.file))); String ligne; ...
4
public void render(Graphics g){ g.setColor(Color.black); if(lightx >= 0){ g.fillRect(0, 0, lightx, Game.cam.height); } if(lighty >= 0){ g.fillRect(lightx, 0, imageWidth, lighty+5); } if(lighty+imageHeight <= Game.cam.height){ g.fillRect(lightx, lighty+imageHeight-5, imageWidth, Game.cam.height-l...
4
public static AutomatonSimulator getSimulator(Automaton automaton) { if (automaton instanceof automata.fsa.FiniteStateAutomaton) return new automata.fsa.FSAStepWithClosureSimulator(automaton); else if (automaton instanceof automata.pda.PushdownAutomaton) return new automata.pda.PDAStepWithClosureSimulator(aut...
5
public void setExpYears(int expYears) { this.expYears = expYears; }
0
public boolean fromElement(Element ele) { boolean result = true; id = X.getAttribute(ele, C.id, null); type = X.getAttribute(ele, C.type, "mysql"); ip = X.getFirstChildText(ele, C.ip, null); port = X.getFirstChildText(ele, C.port, null); user = X.getFirstChildText(ele, C.user, null); passwor...
1
public void mouseReleased(MouseEvent event) { // Did we even start at a state? if (first == null) return; State state = getDrawer().stateAtPoint(event.getPoint()); controller.gotoGroup(first, event.getPoint(), state); first = null; getView().repaint(); }
1
public void initialize(NeuralNetwork nn) { List<ConnectionCandidate> ccs = new BreadthFirstOrderStrategy(nn, nn.getInputLayer()).order(); for (ConnectionCandidate cc : ccs) { if (cc.connection instanceof FullyConnected) { FullyConnected fc = (FullyConnected) cc.connection; if (Util.isBias(fc.getInputLayer())...
9
public void accMng() throws IOException { Scanner in = new Scanner(System.in); System.out.println("-----------------------"); System.out.println("Account Management Menu"); System.out.println("1.Create New Account"); System.out.println("2.Delete account"); System.out.print...
6
public Object getValue() throws UtilEvalError { if (type == VARIABLE) return nameSpace.getVariable(varName); if (type == FIELD) try { Object o = field.get(object); return Primitive.wrap(o, field.getType()); } catch (IllegalAccessException e2) { throw new UtilEvalError("Can't read field: " + fi...
7
void release(boolean destroy) { Control next = null, previous = null; if (destroy && parent != null) { Control[] children = parent._getChildren(); int index = 0; while (index < children.length) { if (children[index] == this) break; index++; } if (index > 0) { previous = children[inde...
9
private void quicksort(int low, int high) { int i = low, j = high; // Get the pivot element from the middle of the list int pivot = numbers[low + (high-low)/2]; System.out.println("\nPivot: "+pivot); // Divide into two lists while (i <= j) { // If the current value from the left li...
7
public Process setPriority(long id, int priority) // Change priority. { Process process = find(id); if(process==null) return null; else process.setPriority(priority); return process; }
1
private static void parseBergenCellsAndRequestMeasurements() { String fileName = "/Users/Johan/Documents/CellTowers/cell_towers_bergen.csv"; try(BufferedReader br = new BufferedReader(new FileReader(fileName));) { String line = ""; int totalCount = 0; JSONFile jsonFile = new JSONFile(JSONFile.fileP...
4
@Override public void update(float tpf, Node root) { if (phases.get(currentPhase) instanceof HazardTrafficSignalPhase) { phases.get(currentPhase).update(tpf, root); } else { if (inPhase) { if (phases.get(currentPhase).getState() == TrafficSignalPhaseState.RED)...
6
public /*@non_null pure@*/ String toString() { if (m_RangeStrings.size() == 0) { return "Empty"; } String result ="Strings: "; Enumeration enu = m_RangeStrings.elements(); while (enu.hasMoreElements()) { result += (String)enu.nextElement() + " "; } result += "\n"; result +=...
8
public boolean isCollisionBoxColliding(CollisionBox box) { for(int i = 0; i < collidable.size(); i++) { if(box.collisionBox.intersects(collidable.get(i).collisionBox) && collidable.get(i) != null) { box.getAttachedEntity().onCollide(collidable.get(i)); collidable.get(i).getAttachedEntity().onColli...
3
public static Type convertType(String name) { if (name.equals("dir")) return Type.Dir; else if (name.equals("nfs")) return Type.Nfs; else if (name.equals("lvm")) return Type.Lvm; else if (name.equals("iscsi")) return Type.Iscsi; else return Type.Unknown; }
4
private static <T> List<Expression<?>> getGroups(Root<T> root, List<String> group) { List<Expression<?>> groupRet = new ArrayList<Expression<?>>(); if (group != null) { for (String field : group) { try { /** * separate field and function */ String[] splitedfield = field.split(","); ...
7
private void paintFocus(Graphics g, int x, int y, int w, int h) { Color bsColor = getBorderSelectionColor(); if (bsColor != null && (selected || !drawDashedFocusIndicator)) { g.setColor(bsColor); g.drawRect(x, y, w - 1, h - 1); } if (drawDashedFocusIndicato...
7
public LinkTriple [] NodeFilter( Component parent, LinkTriple [] inList ) { GridBagConstraints c = new GridBagConstraints(); final JDialog frame = new JDialog(); JPanel panel = new JPanel(); panel.setLayout( new GridBagLayout() ); panel.add(new Label("Edge Types"), c); c.gridx = 1; panel.add(new Label("...
9
public static StaffArrangement decodeArrangement(File f) throws ParseException, IOException { BufferedReader bf = new BufferedReader(new FileReader(f)); String line = ""; String str = ""; while (true) { line = bf.readLine(); if (line == null) ...
2
public ComplexMatrix subarray_as_Complex_rowMatrix(int start, int end){ if(end>=this.length)throw new IllegalArgumentException("end, " + end + ", is greater than the highest index, " + (this.length-1)); Complex[] cc = this.getArray_as_Complex(); Complex[] retArray = new Complex[end-start+1]; ...
2
@Override public void run() { super.run(); try { while (true) { currentJob = (JobImpl2) qMananager.pull("Queue2"); if (currentJob!=null) { currentJob.startWork(this); System.out.println("2-"+id+" start"+currentJob.name); Thread.sleep(1000); currentJob.endWork(this); System.out...
4
public static Object[] fetchValues(Method[] getterMethods, Integer[] parameterIndexes, Object[] args, List<String> parameterNames) { Object[] values = new Object[getterMethods.length]; for (int i = 0; i < getterMethods.length; i++) { Method method = getterMethods[i]; Integer index = parameterIndexes[i]; ...
1
private java.util.Map<Integer, Integer> findUnmatchedBrackets() { final Segment text = new Segment(); final java.util.Stack<Integer> lefts = new java.util.Stack<Integer>(); final java.util.Map<Integer, Integer> unmatched = new java.util.HashMap<Integer, Integer>(); final int lineCount = ...
7
public Connection getConnection() throws SQLException { try { Connection connection = DriverManager.getConnection("jdbc:derby:.\\db\\music.db;create=true"); createTable(connection); return connection; } catch (Exception e) { log.log(Level.SEVE...
1
@Override public void run() { do { Collection<Transition> values = this.dataset.values(); for (Transition transition : values) { Map<String, Object> datagramContent = new HashMap<String, Object>(); datagramContent.put(Statics.CONTENT_TRANSITION, transition); try { this.out.writeObject(new Data...
5
public void exec(){ boolean nextStep = true; do { try{ inpFirstArg(); inpOperation(); res = unOp(inpOperation); if (res != null){ out.println(res); ...
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
6
public static void enableElements(Container container, boolean shouldBeEnabled) { Component[] components = container.getComponents(); for (Component c : components) { c.setEnabled(shouldBeEnabled); if (c instanceof Container) { enableElements((Container) c, should...
2
@Override void removeChild(@SuppressWarnings("unused") Node child) { // Remove child if(this._const_ == child) { this._const_ = null; return; } if(this._var_ == child) { this._var_ = null; return; } ...
3
private static void checkPrinter() { String queryString = "${^XSET,ACTIVERESPONSE,1}$"; try { PrintService printService = findPrintService(); System.out.println(printService.getAttribute(QueuedJobCount.class).getValue()); if (printService == null) { ...
3
@Override public Point getDirection() { return direction; }
0
private void tablaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tablaMouseClicked if (evt.isMetaDown()){ JOptionPane.showMessageDialog(null, "Pulsado"); } }//GEN-LAST:event_tablaMouseClicked
1
private void setDisplayMode() throws LWJGLException{ DisplayMode targetDisplayMode = null; DisplayMode[] modes = Display.getAvailableDisplayModes(); int freq = 0; for (int i=0;i<modes.length;i++) { DisplayMode current = modes[i]; if ((current.getW...
9
public boolean isLit() { return this != OFF && (!isBlinkAspect() || isBlinkOn()); }
2
private void printBoard() { for ( int i = 0; i < getBoard().length; i++ ) { for ( int j = 0; j < 7 - i; j++ ) { System.out.print(" "); //Forward spacing between cards } for ( Card card : getBoard()[i] ) { System.out.print(car...
8
@Override public void run() { try { // Create a ServerSocket to listen on that port. final ServerSocket masterSocket = new ServerSocket(HttpServer.PORT); // Now enter an infinite loop, waiting for connections and handling // them. while (true) { Socket client = masterSocket.accept(); if ...
8
@Override public void logicUpdate(GameTime gameTime) { for (Entity entity : entityList) { processEntity(entity); } }
1
public void configure(Element pageElement) { this.setName(this.monome.readConfigValue(pageElement, "pageName")); this.setSpeed(Integer.parseInt(this.monome.readConfigValue(pageElement, "speed"))); if (this.monome.readConfigValue(pageElement, "syncEnabled") != null) { if (this.monome.readConfigValue(pageElement...
9
public void editSelected() { Actions action = actionsTree.getSelectedItem(); if (action != null) { if (action.getClass().equals(Delay.class)) { formUI.getDelayTab().loadAction((Delay) action); formUI.getformTabs().setSelectedIndex(FormUI.DELAY_TAB); } if (action.getClass().eq...
6
@Override protected void createReaderWriter() throws JoeException { // try to create an appropriate reader-writer ourReaderWriter = new PdbBFReaderWriter() ; if (ourReaderWriter == null) { throw new JoeException(UNABLE_TO_CREATE_OBJECT) ; } }
1
public double value() { ArrayList<Double> numbers = new ArrayList<Double>(values.size()); for (int i = 0; i < values.size(); i++) { numbers.add(values.get(i).value()); } for (int i = Operator.total_priorities(); i > 0; i--) { int skipped = 0; ...
4
public static void loadMods() { File base = new File(Constant.MODS); if (!base.exists()) { base.mkdir(); } File[] files = base.listFiles(); for (int i = 0; i < files.length; i++) { File[] fles = files[i].listFiles(); for (int a = 0; a < fles.length; a++) { File z = fles[a]; if (z.getName().eq...
9
private String JsonUsername(String username) { JsonObject jasonObject1 = Json.createObjectBuilder().add("username", username).build(); StringWriter stringwriter = new StringWriter(); try (JsonWriter jsonwriter = Json.createWriter(stringwriter)) { jsonwriter.write(jasonObject1); ...
1
private boolean memeChecker(String currentText) { boolean isAMeme = false; for(String currentMeme : memeList) { if(currentMeme.equalsIgnoreCase(currentText)) { isAMeme = true; } } return isAMeme; }
2
public void transitionCreate(State from, State to) { // TODO Auto-generated method stub if (currentStep != TRANSITIONS_TO_TRAPSTATE) { outOfOrder(); return; } if (!to.equals(myTrapState)) { JOptionPane.showMessageDialog(frame, "You have to make transition to the trap state!", "Error", JOpti...
7
public static ArrayList<String> getFeatures(String model) { HashSet<String> features = new HashSet<String>(); for(Entry<String, LinkedHashMap<String, Double>> entry1 : tfidfTable.entrySet()) { if(!entry1.getKey().startsWith(model)) continue; for(Entry<String, Double> entry2 : e...
6
@Override public String toString() { return "Comment {" + (extReferences != null ? " extReferences [" + extReferences + "]" : "") + (cls != null ? " cls [" + cls + "]" : "") + (idx != null ? " idx [" + idx + "]" : "") + (recommendedValue != null ? " recommendedValue [" + recommendedValue +...
9
public static void main(String args[]) { try { //Look and Feel do sistema UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(AppRoot.class.getName()).log(java.util.logging.Level...
4
@Override public double nextDouble() throws IOException { JsonToken token = peek(); if (token != JsonToken.NUMBER && token != JsonToken.STRING) { throw new IllegalStateException("Expected " + JsonToken.NUMBER + " but was " + token); } double result = ((JsonPrimitive) peekStack()).getAsDouble(); ...
5
public static <K,V> Map.Entry<K, V> soloEntry(Map<K, V> m) { if ((m != null) && m.size() == 1) { return m.entrySet().iterator().next(); } throw new IllegalArgumentException(String.format("expected a map of one entry, got %s", m)); }
2
public void run() { InetAddress group = null; try { group = InetAddress.getByName(multicast); } catch (UnknownHostException e) { e.printStackTrace(); } //create Multicast socket to to pretending group MulticastSock...
8
public void changeHideIcon(boolean hidden) { hide.setIcon(hidden ? makeImageIcon("/images/fold_right" + color + ".png") : makeImageIcon ("/images/fold_left" + color + ".png")); hide.setToolTipText(hidden ? "show...
2
private void addStudentToDB(Student student) throws ServerException { if (log.isDebugEnabled()) log.debug("Method call. Arguments: " + student); NodeList groups = document.getElementsByTagName("group"); Element group = null; Element students = null; for (int i = 0; i < groups.getLength(); i++) { if (gro...
5
public void getTester() { networkController.SendMessage("getPromotion#" + clientId + "," + clientType + "," + userTester + "," + userName); clientType = userTester; tester = true; cleanLabels(); if(observer) getObserver.setVisible(true); if(contributor) getContributor.setVisible(true); if(repo...
7
@Override public ExecutionContext run(ExecutionContext context) throws InterpretationException { AbsValueNode temp = (AbsValueNode) getChildAt(this.getChildCount() - 1); assert(temp!=null); Value test = (temp.evaluate(context)); if (test.getType() != VariableType.BOOLEAN) ...
3
private void jButtonCalcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCalcActionPerformed /**This method calculates Monthly Mortgage Payment**/ /**Get Input**/ //Get the vlaue of the text fiels sPrinciple = jTextFieldPrincipal.getText(); ...
3
public void think(double dt) { switch (mode) { case WALK: VillagerEntity closest_villager = grid.getClosestVillager(point.x, point.y, ZOMBIE_FOLLOW_RADIUS); TowerEntity closest_tower = grid.getClosestTower(point.x, point.y, ZOMBIE_FOLLOW_RADIUS); Entity closest_entity = null; if (closest_towe...
8
public void sort(int low, int high) { int i = low, j = high, tmp; int pivot = intArr[(low + high) / 2]; // aufteilen und sortieren while (i <= j) { /** * Wandere mit i nach rechts, bis ein Wert größer oder gleich dem * Pivotelement gefunden wurde. Entsprechend wird mit j nach links * gew...
6
private Character blockPrint(Block block) { switch (block.getColor()) { case BLACK: return '$'; case BLUE: return '@'; case GREEN: return '&'; case RED: return '#'; case YELLOW: ...
5
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
6
public void draw(Graphics surface) { // Draw the sprite sprite.draw(surface, x, y); // Move the object each time we draw it x += xDirection; y += yDirection; // If we have hit the edge and are moving in the wrong direction, // reverse direction // We check the direction because if a box is placed near...
8
@EventHandler public void onPluginEnable(PluginEnableEvent event) { mainLogger.debug("onPluginEnable executing"); PluginManager pm = plugin.getServer().getPluginManager(); Plugin checkVault = pm.getPlugin("Vault"); Plugin checkMobArena = pm.getPlugin("MobArena"); if (checkVault != null && !plugin.isEconomyEn...
7
public boolean checkInput (char input) { if ((input == '1')||(input == '2')||(input == '3')||(input == '4')||(input == '5')||(input == '6') ||(input == '7')||(input == '8')||(input == '9')) { return true; } else { return false; } }
9
private ArrayList<AdvancedLocation> makeAdvanced(ArrayList<Location> list, MapLayer layer) { ArrayList<AdvancedLocation> out = new ArrayList<AdvancedLocation>(); for (Location i : list) { out.add(new AdvancedLocation(i, layer)); } return out; }
1
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); Article article; try { article = em.getRef...
8
private void button11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button11ActionPerformed if (order2code5tf.getText().equals("1001")) { o2c5destf.setText("Chicken Nugget"); } if (order2code5tf.getText().equals("1002")) { o2c5...
9
public void doFrameInGame() { moveAndCheckCollisons(); incrementTimers(); if (finishedFinalLevel()) { addGameState("GameWon"); gameOver(); } else { if (player.timeToWaitAfterKilled == 0) { lifeLost(); } if (existsObject("player")) { if (!onBossLevel()) { if (gameTimer < STAGE_D...
9
public static void singleLineComments(File fileName, DetailObject detailObject, String comment) { detailObject.updateNumberOfFiles(); DetailObject.updateTOTAL_NUMBER_OF_FILES(); try { BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName)); String line; while ((line = bufferedReader....
5
public List findBySumbitIp(Object sumbitIp) { return findByProperty(SUMBIT_IP, sumbitIp); }
0
public double[] getEnergyRange() { if (energyRange != null) { return energyRange; } double max = 0; double max2 = 0; for (MatterInterval mi : intervals) { if (max <= mi.getY()) { max2 = max; max = mi.getY(); } ...
5
public static String checkInteraction(String drugFilling, String drugInList){ String[] interactingDrugs = HelperMethods.splitString(drugInList); String[] activeDrugList = HelperMethods.splitString(currentActive); String conflictFound=""; for(int i = 0; i<interactingDrugs.length; i++){ for(int j = 0; j<active...
5
public void startServer() throws Exception { ServerSocket serverSocket = null; boolean listening = true; try { serverSocket = new ServerSocket(_portNumber); } catch (IOException e) { System.err.println("Could not listen on port: " + _portNumber); System.exit(-1); } while (listening) { handle...
2
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(args.length != 3) { printArgsError(args); printHelp(sender, label); return true; } String target = findTarget(args[1]); int chargeId = -1; try { chargeId = Integer.valueOf(args[2]); } catc...
7
public void setOptions(String[] options) throws Exception { String optionString; optionString = Utils.getOption('X', options); if (optionString.length() != 0) { setAttsToEliminatePerIteration(Integer.parseInt(optionString)); } optionString = Utils.getOption('Y', options); if (optionStrin...
7
@Override public void actionPerformed(ActionEvent e) { Outliner.documents.getMostRecentDocumentTouched().getUndoQueue().undoAll(); }
0
private void groupMatches() { clear(); try { System.out.println("Select group id: "); int id = new Scanner(System.in).nextInt(); Group gm = groupmgr.getById(id); if (gm != null) { ArrayList<MatchScheduling> groupPla...
3
public static boolean isInBoardLimits (int MoveToX, int MoveToY, int MoveFromX, int MoveFromY){ if (MoveToX<8&&MoveToX>-1&&MoveToY<8&&MoveToY>-1&&MoveFromX<8&&MoveFromX>-1&&MoveFromY<8&&MoveFromY>-1) return true; else return false; }
8
public void parseMap() { Tile[][] ret = null; Scanner read = null; try { read = new Scanner(this.mapFile); int mapwidth = read.nextInt(); int mapheight = read.nextInt(); read.nextLine(); ret = new Tile[mapwidth][mapheight]; ...
8
final private boolean jj_3R_133() { Token xsp; xsp = jj_scanpos; if (jj_3R_142()) { jj_scanpos = xsp; if (jj_3R_143()) { jj_scanpos = xsp; if (jj_3R_144()) { jj_scanpos = xsp; if (jj_3R_145()) { jj_scanpos = xsp; if (jj_3R_146()) { jj_scanpos = xsp; if (jj_3R_147()) {...
8
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPData") public JAXBElement<PGPDataType> createPGPData(PGPDataType value) { return new JAXBElement<PGPDataType>(_PGPData_QNAME, PGPDataType.class, null, value); }
0
public static Object escape(Object original) { if (original instanceof Character) { char u = (char) ((Character)original); int idx = "\b\t\n\f\r\"\'\\".indexOf(u); if (idx >= 0) return "\\"+"btnfr\"\'\\".charAt(idx); if (u < 32) re...
8
public void runHuckedInsertionSortV2(int[] array){ // start timer long startTime = System.currentTimeMillis(); // start Huck specific timer long startHuckTime = System.currentTimeMillis(); // length of array int length = array.length; // Array's statistical mean. double mean = StandardDeviation...
7
public void lconst(final long cst) { if (cst == 0L || cst == 1L) { mv.visitInsn(Opcodes.LCONST_0 + (int) cst); } else { mv.visitLdcInsn(new Long(cst)); } }
2
public void pause_ingress() { for (ConnectionProcessor pipe : pipes) { pipe.pause_ingress(); } }
1
@Override public final void contextRun(final Context context, final TaskLogger taskLogger, final Task<?> parent, final Collection<Task<?>> predecessors) { if (transitionRun()) { final Promise<T> promise; ...
7
static void blendingBench(CPLayer l1, CPLayer l2, int iterations, boolean useFullAlpha) { double lastTime = System.currentTimeMillis(), newTime; CPRect size = l1.getSize(); if (useFullAlpha) { for (int i = 0; i < iterations; i++) { l1.fusionWithFullAlpha(l2, size); } } else { for (int i = 0; i < i...
3
public List<Group_schedule> getGroup_scheduleList(int group_id) { List<Group_schedule> list = new ArrayList<Group_schedule>(); try { PreparedStatement ps = con.prepareStatement("SELECT * FROM group_schedule WHERE group_id=?"); ps.setInt(1, group_id); ResultSet rs = ps.executeQuery(); while(rs.next(...
2
public static void main(String args[]) { QueueBuilder builder = new QueueBuilder(); builder.parseInput("input.txt"); Monitor monitor = new Monitor(); RegisterManager manager = new RegisterManager(builder.getRegisters(), monitor); // total number of customers totalCusto...
9
private void initThreads() { EXECUTORS.execute(new Runnable() { @Override public void run() { try { int size = 0; Thread.currentThread().setName(getThreadName()); while (running.get()) { InputStream in0 = inSocket.getInputStream(); OutputStream out0 = outSocket.getOutputStream(); ...
8
@Override public void execute(Joueur jou){ Joueur proprio = this.getProprietaire(); if(proprio == null){ propositionAchat(jou); } else if(proprio == jou && getRanking() < 5 && jou.possede(this.groupePropriete)){ propositionAmeliorat...
6
public static void main(String[] args) { Scanner in = new Scanner(System.in); int cc = 0; while (in.hasNextInt()) { cc++; int n = in.nextInt(); if ( n == 0 ) break; int[][] nn = new int[3*n][3*n]; List<Q> lq = new ArrayList<Q>(); List<Double> lx = new ArrayList<Double>(); List<Double>...
9