text
stringlengths
14
410k
label
int32
0
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Funcionario other = (Funcionario) obj; if (this.Id != other.Id) { return false; } ...
5
private boolean depthFirstSearchRecursive(VertexType vertex, VertexType fromVertex, PreWorkPostWorkHandler<VertexType> handler) throws InvalidVertexException { //TODO:Implementing non-recursive version //int vertexId = vertex.getId(); vertex.setMark(true); if (handler != null...
8
@Override public <T> T getObject(Class<T> clazz, Long id) { Session session = null; T obj = null; try{ session = sessionFactory.getCurrentSession(); session.beginTransaction(); obj = (T)session.get(clazz, id); ...
4
private int FindTileCol(int mouseX) { for (int i = 0; i < tileCol; i++) { if(mouseX > i * tileWidth && mouseX < (i + 1) * tileWidth) { return i; } } return -1; }
3
public Stage getPrimaryStage() { return stage; }
0
@Override public void endResizingFrame(JComponent f) { //System.out.println("endResizingFrame"); super.endResizingFrame(f); }
0
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { if(target instanceof MOB) { final Room R=((MOB)target).location(); boolean found=false; if(R!=null) for(int r=0;r<R.numInhabitants();r++) { final MOB M=R.fetchInhabitant(r); if((M!=null)&&(M!=mo...
9
@Test public void whoIsTheBiggest() { for (int n1 = 999; n1 > 0; n1--) { for (int n2 = 999; n2 > 0; n2--) { int candidate = n1 * n2; if (PalindromicNumber.isPalindromic(candidate)) { if (candidate > biggest) { biggest = candidate; } } } } System.out.println(biggest); }
4
public DataTable getDataTable() throws Exception { int l = bitString.length(); int bits[] = new int[l]; // Initialize both arrays that will contain // the voltage and the time axis. int ticks = DIVISIONS * l; x = new Double[ticks]; y = new Double[tick...
4
@Override public boolean removeItem(String itemID) { Statement stmt = null; try { stmt = con.createStatement(); if (itemID.length() == 9) { // item is a book stmt.executeUpdate("delete from Book where ISBN = " + itemID); } else if (itemID.length() == 8) { // item is a periodical stmt.executeUpdat...
5
private boolean move(int d) { boolean changed = false; int in, out; if (d % 2 == 0) { out = col; in = row; } else { out = row; in = col; } int[] line = new int[in]; for (int o = 0; o < out; o++) { for (int i = 0; i < in; i++) { ...
9
public Location[] findAvailableMoves(char[][] board){ Location[] available_locations_l; boolean[][] available_locations = new boolean[4][12]; // Track how many are available int count = 0; // Check every spot for (int i = 0; i < 4; i++){ for (int j = 0; j < 12; j++){ // Anywhere is legal on fi...
9
private String getDuration() { if (this.start == 0) return "not started"; if (this.stop == 0) return "not finished"; // calculate duration and matching unit double duration = this.stop - this.start; String unit = "ms"; if (duration > 1000) { duration /= 1000; unit = "sec"; if (duration > 6...
5
private String resolveOperation(String field) { if (field.endsWith("!")) return "!="; if (field.endsWith(">")) return ">"; if (field.endsWith("<")) return "<"; if (field.endsWith("%")) return " LIKE "; return "="; }
4
public int getAdjacentAntsRed() { return adjacentAntsRed; }
0
private ProfilesAPI getProfilesApi() { if (profilesApi == null) { profilesApi = new ProfilesAPI(config); } return profilesApi; }
1
private boolean resolveCollision(String name) { int row = 0; for (Row i : ((KeystrokeTableModel) myTable.getModel()).rows) { if (i.key.equals(name) && row != myRow) { boolean ret = JOptionPane.showConfirmDialog(null, String.format(Runner.editorInterface.getS...
4
public void performSetupMenu(User u) throws MenuExitException{ String menuString = "Configure Spot The Fed Game:\r\n"; menuString += "(01) Add Player \r\n"; menuString += "(02) Remove Player \r\n"; menuString += "(03) List Players \r\n"; menuString += "(04) Config Round Times \r\n"; menuString += "(05) Star...
9
private void addStreets(int[][] temp, int startx, int starty) { for(int i = 0; i < 6; i++) { int roadX = startx - (random.nextInt(3) + 1) * 3 + 3; int roadY = starty - (random.nextInt(3) + 1) * 3 + 3; int roadW = (random.nextInt(2) + 1) * 3; int roadH = (random.nextInt(2) + 1) * 3; for(int x = roadX; x...
8
protected boolean sendCancelGridlet(int tag, Gridlet gl, int gridletId, int destId) { if (tag != GridSimTags.GRIDLET_CANCEL) { return false; } long gridletSize = 0; if (gl != null) { gridletSize = gl.getGridletOutputSiz...
4
public static Severity fromLevel(final Level level) { if (level == null) { throw new IllegalArgumentException("Level cannot be null"); } final int levelValue = level.intValue(); if (levelValue >= org.jboss.logmanager.Level.FATAL.intValue()) { ...
9
public static String getSourceByLanguage(Language lang) { if(lang == Java) return ".java"; else if(lang == Pascal || lang == Delphi) return ".pas"; else if(lang == Cplus) return ".cpp"; else if(lang == C) return ".c"; else if(lang == Python) return ".py"; else return ".tx...
6
public static PropertyDescriptor[] listPropertyDescriptors(Object o) { final BeanInfo beanInfo; try { beanInfo = Introspector.getBeanInfo(o.getClass()); } catch (IntrospectionException e) { throw new AnnoYAMLException(e); } PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors(); return ...
1
public static String stringToHTMLString(String string) { StringBuffer sb = new StringBuffer(string.length()); // true if last char was blank boolean lastWasBlankChar = false; int len = string.length(); char c; for (int i = 0; i < len; i++) { c = string.charAt(i); ...
9
public units.Base CreateUnit(int type, int owner, int xx, int yy, boolean active) { switch (type) { case 0:return new units.Infantry(owner, xx, yy, active); case 1:return new units.Mechanic(owner, xx, yy, active); case 2:return new units.SmallTank(owner, xx, yy, active); case 3:return new units.Artillery(...
5
public SongEntry [] getSongs () throws IOException { int temp = getFirstFreeEntryOffset (); // a lot of these calculations feel quite odd // they're from the c code int blocks = temp / BLOCKSIZE; int count = 8 * blocks; temp %= BLOCKSIZE; if (temp > 0) blocks++; count +...
2
public static double[][] readMatrix(Path path, HamaConfiguration conf, int rows, int columns, int blockSize) { int finalRows = getBlockMultiple(rows, blockSize); int finalCols = getBlockMultiple(columns, blockSize); double[][] matrix = new double[finalRows][finalCols]; SequenceFile.Reader reader = null; ...
8
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((hasHead() && head() != null) ? head().hashCode() : 0); result = prime * result + ((hasTail() && tail() != null) ? tail().hashCode() : 0); return result; }
4
public void setServiceEmployeeId(String serviceEmployeeId) { this.serviceEmployeeId = serviceEmployeeId; setDirty(); }
0
private void validaData(Date dateToValidate) throws ValidacaoException { if (!validacao.obrigatorio() && dateToValidate == null) { return; } SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); String result = sdf.format(dateToValidate); if (result.length() != 1...
3
public TreeWorker (String jsonPath, String saveFolder, String name, String type, boolean createTree, boolean save) throws IOException{ this.jsonPath = jsonPath; this.saveFolder = saveFolder; this.name = name; this.type = type; if(createTree)createJsonTree(); if(save)saveTreeWorker(); //experimental - save...
2
public void setType(TypeEntity types) { this.types = types; }
0
public static PatchGroup read(final InputStream inputStream) throws IOException { int line = 1; final BufferedReader in = new BufferedReader(new InputStreamReader( inputStream)); try { final int patchCount = Integer.parseInt(in.readLine()); line++; final PatchGroup result = new PatchGroup(); fo...
9
public List<Integer> findSubstring(String S, String[] L) { List<Integer> list = new LinkedList<>(); if (S == null || L == null) return list; Map<String, Integer> covered = new HashMap<String, Integer>(); ArrayList<Integer> res = new ArrayList<Integer>(); int wordlength = L[0].length(); int wordnum = L.le...
9
private Boolean addOperator(CalculatorReader expressionReader) throws BinaryOperatorException { String el = expressionReader.getSymbol(); BinaryOperator lastBinaryOperator = expressionStack.binaryOperator.get(el); if (null != lastBinaryOperator) { expressionReader.incPosition(); ...
6
private List<Reducer> estimateReducers(List<Mapper> newMapperList, boolean useRuntimeMaxJvmHeap) { int fReducerNum = finishedConf.getMapred_reduce_tasks(); if(fReducerNum == 0) return null; //if(isMapperConfChanged == false && isSplitSizeChanged == false && isReducerConfChanged == false) // return job.getR...
4
public void action(GraphData graphData) { GraphModel g1 = graphData.getGraph(); GraphModel g2 = new GraphModel(false); g2.setIsEdgesCurved(true); for(Vertex v : g1.getVertexArray()) { Vertex tmp = new Vertex(); tmp.setLocation(v.getLocation()); g2.ad...
8
public void displayBoard(Board board) { this.board = board; int gridNums = 1; int rows= board.rows; // pass these values in int columns=board.columns ;// pass these values in int nums [][] = new int [rows][columns]; for (int i=0; i<rows; i++){ ...
5
public void valueChanged(ListSelectionEvent lse) { selectedAccount = null; if (!lse.getValueIsAdjusting() && lijst.getSelectedIndex() != -1) { selectedAccount = lijst.getSelectedValue(); } boolean accountSelected = (selectedAccount != null); accountDetails.setEnabled(...
2
@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 EtlLink)) { return false; } EtlLink other = (EtlLink) object; if ((this.id == null && other.id != null) || (thi...
5
public CheckResultMessage checkDayofMonth9() { int r1 = get(13, 5); int c1 = get(14, 5); date(); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (!(getValueString(r1 + maxDay, c1 - 1, 3).equals(maxDay + "日"))) { return...
5
public static void makeLevel2() { int size = 25; initializeLevel(size, 22, 12); //First for loop for(int i = 1; i<5; i++){ matrix.rowWall(i, 4, 12); matrix.rowWall(i, 16, 19); } matrix.rowWall(4, 1, 19); //Second for loop for(int i = 4; i<9; i++){ matrix.columnWall(i, 4, 7); matrix....
4
private void appendFieldToTheDS(Object object, Field field, StringBuilder signature) throws IllegalAccessException { if (!field.isAccessible()) { field.setAccessible(true); } Object fieldValue = field.get(object); if (null != fieldValue) { if (fieldValue instanceo...
8
@Override public void handleStartTag(Tag tag, MutableAttributeSet attributes, int pos) { if (Tag.TABLE.equals(tag) && !gotFirstTable) { gotFirstTable = true; } if (Tag.TR.equals(tag) && !gotFirstRow) { gotFirstRow=true; } ...
7
public boolean isOutOfBound(short n, Dimension bound) { if (n < 0) throw new IllegalArgumentException("n<0"); if (n >= path.length) throw new IllegalArgumentException("overflow"); if (bound == null) return false; if (x[n] < -bound.width / 2 || x[n] > bound.width / 2 || y[n] < -bound.height / 2 || y[n] ...
7
@Override public void MacOSXDriverNotFound(String installer) { String text = "fuse4x is required in order to get the file system working.\n\nI'm launching the installer, which requires additional rights."; switch (usemode) { case GUI: JOptionPane.showMessageDialog(null, text); break; case CONSOLE:...
4
public void paintComponent(Graphics g) { g.clearRect(0, 0, getWidth(), getHeight()); int y = 30; g.setColor(Color.black); g.drawString("Species tree", 20, y); y+=30; g.setColor(Color.black); g.drawString("species tree", 50, y); g.setColor(ParamManager.cLineagesIn); g.fillRect(15, y-15, 30, 2...
9
@SuppressWarnings("unused") public void sendNotificationToUser(String nick, String message) { byte[] buf = new byte[1000]; String str = (ServerMain.cypher .doCeaserCypher("##NOTIFICATION~[Server]: ~" + message)); int q = 1000; int w = 0; int e = 0; // Logger.writeInfo(str.length() + ""); if (true) {...
9
public static void main(String[] args) throws FileNotFoundException { int num_rows = 15; String filename = "problem018.txt"; int[] [] pyramid_array = new int[num_rows] [num_rows]; File txtfile = new File(filename); Scanner pyramid = new Scanner(txtfile); for (int i=0; i<num_rows; i++) { for (int j=0...
5
public static int choosePivot(int offset, int len, int type) { int pivot; switch (type) { //choose the first element case 0: pivot = offset; break; //choose the last element case 1: pivot = offset + len - 1; break; //choose the median case 2: if (len < 3){ pivot = offset; ...
9
protected void onPart(String channel, String sender, String login, String hostname) {}
0
public static Contents contents() { return new ParcelContents(); }
0
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the container // has not yet been calculated so lets ask for the maximum. int ...
8
public int findMaxValue(int sackSize, int N, int val[], int wts[]) { int maxVals[][] = new int[N+1][sackSize+1]; for(int i=0; i<=N; i++) { for(int w=0; w<=sackSize; w++) { if(i==0 || w==0) maxVals[i][w] = 0; else if(wts[i-1]>w) maxVals[i][w] = maxVals[i-1][w]; else { maxVals[i]...
5
public void visitMultiANewArrayInsn(final String desc, final int dims) { buf.setLength(0); buf.append(tab2).append("MULTIANEWARRAY "); appendDescriptor(FIELD_DESCRIPTOR, desc); buf.append(' ').append(dims).append('\n'); text.add(buf.toString()); if (mv != null) { ...
1
private String int2str(int value){ if(value==512) return "N"; if(value==1536) return "S"; StringBuilder sb = new StringBuilder(); int baseValue = value>>9; char base='E'; char base2='N'; switch (baseValue){ case 0: base='E'; ...
9
public void createLogsFolderAndFile() { try { LOG_PATH = PROJECT_PATH + OS_SEPARATOR + "logs"; LOG_PATH = createFolder(LOG_PATH); LOG_FILE_NAME = LOG_PATH + OS_SEPARATOR + "AutomationLog_" + resultFileNameSf.format(dt) + ".log"; createFile(LOG_FILE_NAME); ...
1
@Override public boolean supportsComments() {return false;}
0
public static void main(String[] args) throws Exception { boolean server = (args.length == 1 && args[0].compareTo("--server") == 0); String id = UUID.randomUUID().toString(); Window window = new Window((server) ? "server" : "client"); window.setVisible(true); Game game = new Game((server...
4
private boolean update(ClassPool cp, String oldName, String typeName) throws BadBytecode { if (typeName == null) return false; else if (oldName == null) return true; else if (oldName.equals(typeName)) return false; else if (...
8
public static boolean isInterComparable(Iterable<?> objects) { Iterator<?> iter = objects.iterator(); if (!iter.hasNext()) { return true; } Object o = iter.next(); if (o == null || !(o instanceof Comparable)) { return false; } while (iter.h...
8
public void playDraw(int card, boolean fromDiscard, int new_discard, boolean visible){ animate_visible = true; animate.visible = visible || fromDiscard; animate.x = fromDiscard ? pile_discard.x : pile_draw.x; animate.y = fromDiscard ? pile_discard.y : pile_draw.y; animate.card = card; if (fromDiscard)...
4
public void insertBeforeMethod(CtMethod origMethod, CtMethod beforeMethod) throws CannotCompileException { try { transformers = new TransformBefore(transformers, origMethod, beforeMethod); } ...
1
public void addSaldo(double monto, boolean registrarComoDeposito){ if(activa){ this.saldo+=monto; if(registrarComoDeposito){ montoDepositos+=monto; } }else{ saldo+=(monto-(monto*0.2)); if(registrarComoDeposito){ montoDeposit...
4
int f(int k, int[] prices) { //这种解法的最大时间复杂度为 N*N*1/k 其中k是大于2的常数 if (prices.length < 2) return 0; //dif代表要达到"宇宙"最大收益 还需要(不够)的买入卖出机会 int dif = prices.length / 2 - k; for (int i = 0; i < dif; ++i) { prices = merge(prices); } int result = 0; for (int ...
4
public void UpdateMenu(){ if(start){ start = false; switch(menuItem){ case 0: Host(); break; case 1: Join(); break; case 2: break; case 3: menuRunning=false; gameRunning=false; System.exit(0); break; ...
5
private List<Gate> getPreparedCircuit(List<Gate> gates, int n1, int addedInputs, int startOfP2Output, int m2, int gatesToBeAdded) { for (Gate g: gates) { int leftIndex = g.getLeftWireIndex(); int rightIndex = g.getRightWireIndex(); int outputIndex = g.getOutputWireIndex(); if (outputIndex >= startOfP...
5
@Test public void RegularGrid() { //Make two identical models but one parallel and one sequential AbstractModel paraModel=DataSetLoader.getRegularGrid(100, 800, 40, new ModelParallel()); AbstractModel seqModel=DataSetLoader.getRegularGrid(100, 800, 40, new Model()); //Step through each model stepNumber step...
3
public TravelTrip() { }
0
private void downloadFile(String adress, String localFileName) { OutputStream out = null; URLConnection conn; InputStream in = null; try { URL url = new URL(adress); out = new BufferedOutputStream( ...
5
private void generateMoveList() { moveList = new ArrayList<Integer>(); int curX = startX, curY = startY; boolean upperCase = startUpperCase; for(int i=0;i<name.length();i++) { char c = name.charAt(i); int newX = getCharX(c); int newY = getCharY(c); if(newX == -1 || newY == -1) throw new RuntimeE...
9
public void deleteDupNode(ListNode head){ if(head == null) return; Hashtable table = new Hashtable(); ListNode pre = null; while(head.next!=null){ if(table.contains(head.val)){ pre.next = head.next; }else{ table.put(head.val,true); ...
3
@Override public List<Integer> save(List<Country> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException { try { return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Country bean) -> { Object[] objects = new Object[3]; objects...
1
@Override public String toString() { String map = ""; for (int i = 0; i < 15; i++){ for (int j = 0; j < 11; j++){ if (rooms[i][j] != null && (rooms[i][j].hasVisited() || isAdjacent(rooms, i, j))) if (i == currentY && j == currentX) map += "[*]"; else map += rooms[i][j]; else m...
7
public static void save(String filename) { File file = new File(filename); String suffix = filename.substring(filename.lastIndexOf('.') + 1); // png files if (suffix.toLowerCase().equals("png")) { try { ImageIO.write(offscreenImage, suffix, file); } catch (IOExce...
4
public User getUser (String username) throws SQLException { String uName = null; String uIp = null; int uStatusInt = 0; String getUser = "SELECT * " + "FROM " + tableName + " WHERE " + keyUsername + "=\"" + username + "\""; ResultSet rs = this.database.statement.executeQuery(getUser); while (rs.next...
2
@Override public void positionnementAleatoire() { Iterator iterator = this._partie.getParametre().getBateaux(this._partie.getParametre().getEpoque()).keySet().iterator(); while(iterator.hasNext()) { Random rand = new Random(); int sens = rand.nextInt(2)+...
9
public int longestValidParentheses(String s) { if (s == null || s.isEmpty()) { return 0; } Stack<Integer> parenthese = new Stack<Integer>(); boolean []pos = new boolean[s.length()]; for (int i = 0; i < pos.length; i++) { pos[i] = false; } char[] allStr = s.toCharArray(); for (int i = 0; i < allS...
9
private boolean isValidKeyboardInput(int keycode){ return keycode == KeyEvent.VK_SPACE || keycode == KeyEvent.VK_DOWN || keycode == KeyEvent.VK_RIGHT || keycode == KeyEvent.VK_LEFT || keycode == KeyEvent.VK_UP || keycode == KeyEvent...
5
private DATAPacket receiveRRQanswer() { byte[] data = new byte[DEFAULT_PACKET_SIZE]; DatagramPacket dtg = new DatagramPacket(data, data.length); try { //écoute de la réponse du serveur this.getSocket().receive(dtg); if (DATAPacket.isDataPacket(dtg)) { ...
5
@Override public void register() throws ServiceRegistrationException { try { POA rootPOA = POAHelper.narrow(orb_.resolve_initial_references("RootPOA")); RepairHandlePOA repairServant = provider_.get(); rootPOA.activate_object(repairServant); String[] ID = Repa...
4
public static HelloCorba.Hello narrow (org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof HelloCorba.Hello) return (HelloCorba.Hello)obj; else if (!obj._is_a (id ())) throw new org.omg.CORBA.BAD_PARAM (); else { org.omg.CORBA.portable.Delegate...
3
private float[][] getQuad(int x, int y, int size) { float[][] quad = new float[size][size]; float element; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { if ((y + i) >= height || (x + j) >= width) { element = 0; ...
4
public Automaton getAutomaton() { return myAutomaton; }
0
public void setUrl(String url) { this.url = url; }
0
@Override public Token login(String username, String password, String... scopes) throws IOException { if (username == null || password == null) { throw new IllegalArgumentException("username or password is null"); } final Request request = addScope(Request.to(Endpoints.TOKEN).with( ...
2
@Override public void onBlockPlace(BlockPlaceEvent event) { final Block block = event.getBlock(); final Player player = event.getPlayer(); final PlanArea area = BuildingPlanner.plugin.areaManager.getAffectedArea(block); if (area == null) { return; } if (!area.checkPermission(event.getPlayer(), OpType.MO...
6
public static List<String[]> readCSVContentAll() { CSVReader reader = null; List<String[]> list = null; try { // 读取指定文件中的信息 reader = new CSVReader(new FileReader(CSV_SOURCE)); // 跳过首行header信息 reader.readNext(); // 读取剩余所有信息内容 list = reader.readAll(); } catch (FileNotFoundException e) { logge...
4
private void setupToolBar() { // Create a transparent panel to hold the toolbar content toolbarPanel = new CustomPanel(toolBarFile); toolbarPanel.setOpaque(false); // Create a transparent panel for the toolbar panel to hold toolbarContent = new JPanel(); toolbarContent.setOpaque(false); // Setup the hea...
9
@EventHandler public void SlimeResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSlimeConfig().getDouble("Slime.Resista...
6
public static boolean zipFile( String sourceDir, String destinationFile, String... excludes ) { File srcDir = new File( sourceDir ); if( !srcDir.exists() ) return( false ); // Delete the file if it exists. File destFile = new File( destinationFile ); if( destFile.exi...
6
private static boolean getMouseDown(int mouseButton) { return getMouse(mouseButton) && !lastMouse[mouseButton]; }
1
public static void main(String[] args) { // TODO Auto-generated method stub String failureSettingFile = ""; GetOpt getopt = new GetOpt(args, "i:f:"); serverId = 1; try { int c; while ((c = getopt.getNextOption()) != -1) { switch(c) { case 'i': serverId = Integer.parseInt(getopt.get...
7
private void startActionPerformed(ActionEvent e) { String location = locationBox.getSelectedItem().toString(); String dropbank = dropOrBank.getSelectedItem().toString(); String chop = treeBox.getSelectedItem().toString(); if (location.equals("Edgeville") && chop.equals("Yew")) { MahTreez.activeTree = Tree.Y...
5
public static List<String> getAllSkills() { Collection<String> skis = skillsMap.values(); if (skills == null) skills = new ArrayList<String>(skis); return skills; }
1
public void setSelection(int i, double s, int mode) { if (!data.isDB) propagate(i, s, mode); else switch (mode) { case Selection.MODE_STANDARD: hilite[i] = s; //System.out.println("REPLACE at: "+i+" with: "+s); ...
9
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); Node h = null; Node curr = h; while(n-->0){ if(h==null){ h = new Node(in.nextInt()); curr = h; } else { curr.next = new Node(in.nextInt()); curr = curr.next; } } printList(h); ...
2
public synchronized void signalStatus(HTSMsg msg, int clientId){ Subscription s = getSubscription((Long) msg.get("subscriptionId"), clientId); HTSPServerConnection c = monitor.getServerConnection(s.serverConnectionId); msg.put("subscriptionId", s.serverSubscriptionId); try { c.send(msg); } catch (IOExcepti...
2
@Override public void keyPressed(KeyEvent e) { int input = e.getKeyCode(); switch (input) { case KeyEvent.VK_UP: localGame.rotateClockwise(); network.sendKey(ProtocolConstants.UP); break; case KeyEvent.VK_DOWN: localGame.rotateCounterClockwise(); network.sendKey(ProtocolConstants.DOWN); break...
7
public Desktop(){ frame = new JFrame(Settings.title); frame.setAlwaysOnTop(false); frame.setSize(800,600); frame.setLocationRelativeTo(null); frame.setResizable(true); frame.setLayout(new BorderLayout()); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowListe...
1