text
stringlengths
14
410k
label
int32
0
9
protected void startGame(String sender) { if (!bot.getNick().equals(name)) { bot.changeNick(name); } if (doBarks) idleTimer.cancel(); // don't make comments while the game's on. players2.reset(); players2.start(MAXPLAYERS); for (int i = 0; i < players2.numPlayers(); i++) { bot.voice(gameChan, pl...
3
public static byte[] rotateLeft(byte[] in, int len, int step) { int numOfBytes = (len - 1) / 8 + 1; byte[] out = new byte[numOfBytes]; for (int i = 0; i < len; i++) { int val = getBitInt(in, (i + step) % len); setBit(out, i, val); } return out; }
1
public void loadHandlers() throws IOException{ for (String line = reader.readLine(); line != null; line = reader .readLine()) { if (line.contains("#")) { String thePackage = stringModifier.removeSingleChar(line, line.indexOf("#")); String name = stringModifier.substringFirstCapitalChar(thePackage); ...
5
@Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(citation).append(EOL); if (comments != null ) { for (Comment comment : comments) { stringBuilder.append(comment).append(EOL); } } ...
9
private ItemIdList() { ItemIdList.idSIIS = new SIIS(); File datadump = new File("data.dump"); if (!datadump.exists()) { parse(); // buildFromScratch(); } else { idSIIS = SIIS.deSerializeFile(datadump); System.out.println(idSIIS.size()); } }
1
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public void write(AnnotationsWriter writer) throws IOException { String typeName = pool.getUtf8Info(typeIndex); if (members == null) { writer.annotation(typeName, 0); return; } writer.annotation(typeName, members.size()); Iterator it = members.values().it...
2
private void checkWhatLineExpected() throws AssemblerException { abortMnem = true; if (atOperandFieldEncodings) { abortMnem = true; throw new AssemblerException( "MnemonicData error: Line format or indentation error, operand field encodings line expected. Line should begin with two tabs.\n" + ge...
5
public static void severe(String message) { FMLRelaunchLog.log("MattparksCore", Level.ERROR, message); }
0
private synchronized boolean contains(Object p){ if(p instanceof Peer) return peerList.contains((Peer)p); return false; }
1
public static void before(PrintWriter out){ out.println("<html>"+ head()+ "<body>"+ "<table id=\"hor-minimalist-b\">"+ thead()); }
0
public CodeMap31 set(final int index, final int value) { final int i0 = index >>> 24; int[][] map1; if (i0 != 0) { if (map == null) map = new int[MAX_INDEX_ZERO][][]; map1 = map[i0]; if (map1 == null) map[i0] = map1 = new int[MAX_INDEX_ONE][]; } else map1 = map10; final int i1 = (index >...
5
public int ID() { return ID; }
0
@Override public void actionPerformed(ActionEvent e) { Reference.lastActionMinute = new DateTime().getMinuteOfDay(); if (e.getSource() == overviewButton) { Reference.overPanel = new OverPanel(); ...
8
public void registerBookJobs(BookMeta book, Minecart minecart, Player player) { if (!enable) { return; } if (minecartBookJobMap.get(minecart) != null){ ItemStack bookItemStack = new ItemStack(Material.BOOK_AND_QUILL, 1); bookItemStack.setItemMeta(getBook(mine...
8
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public JSONObject getJSONObject(int index) throws JSONException { Object object = this.get(index); if (object instanceof JSONObject) { return (JSONObject)object; } throw new JSONException("JSONArray[" + index + "] is not a JSONObject."); }
1
private int transferFromLargestOverlap(int count, AreaObject[] array) { int smallestWasted = Integer.MAX_VALUE; int bestPick = -1; for (int i = 0; i < count; i++) { int wasted = areaWasted(mBounds, array[i].getBounds()); if (wasted <= smallestWasted) { smallestWasted = wasted; bestPick = i; } ...
4
public boolean saveItemList(ArrayList<Package> packList, Connection con) { int rowsInserted = 0; int tal = 0; String SQLString1 = "insert into pakker values(?,?,?)"; String SQLString2 = "select pakkeseq.nextval from dual"; String SQLString3 = "insert into pakkedetails values(?,?...
8
public static char getIndexPos(int index) { switch(index) { case 0: return '^'; case 1: return 'N'; case 2: return 'V'; case 3: return 'A'; case 4: return 'R'; case 5: return 'O'; case 6: return '.'; } return ' '; }
7
@ScriptyCommand(name="map-create") public static Map mapCreate(Object[] aArgs) throws CommandException { { Map<Object, Object> lMap = new HashMap<Object, Object>(); for(int i = 1; i < aArgs.length; i++) { if(aArgs[i] instanceof String) ...
7
private void editarDatosUsuario() throws IOException, ServletException { String nombre = request.getParameter("nombre"); String apellido = request.getParameter("apellido"); String username = request.getParameter("username"); String email = request.getParameter("mail"); if (apellido != null && nombre != null &...
5
public void setResponseWrapper(ResponseWrapper responseWrapper) { this.responseWrapper = responseWrapper; }
0
public static final int getMPEaterForJob(final int job) { switch (job) { case 210: case 211: case 212: return 2100000; case 220: case 221: case 222: return 2200000; case 230: case 231: case 232: return 2300000; } return 2100000; // Default, in case GM }
9
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case LEFT_RHINO_ID: return isSetLeftRhinoId(); case LEFT_TITAN_ID: return isSetLeftTitanId(); case RIGHT_RHINO_ID: return isSetRightRhinoId(); case RIG...
7
public void paint(Graphics g) { int startRow = 0; int endRow = rows; int startColumn = 0; int endColumn = columns; Rectangle clip = g.getClipRect(); if (clip == null) { computeVisibleRect(visibleRect); clip = visibleRect; } ...
5
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public void setLastLargest() { lastLargest = largest; }
0
public static void classClass(){ Olive o = new Olive(OliveName.PICHOLINE, OliveColor.GREEN); // using Class Class Class<?> c = o.getClass(); System.out.println(c); System.out.println(c.getName()); System.out.println(c.getSimpleName()); ArrayList<Integer> aa = new ArrayList<>(); Class<?> bb = aa.ge...
8
private static void parseDriverNode(Node node) { String jdbcDriver = null, jdbcUrl = null, name = null; NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node childNode = nodeList.item(i); if (childNode.getNodeType() != Node.ELEMEN...
7
public void mouseReleased(int mouseX, int mouseY) { //Iterate through each object for (ImageButton obj : screenObjects) { obj.mouseReleased(mouseX, mouseY); } if(loopMenuOpen){ loopMenu.mouseRelease(mouseX, mouseY); } }
2
public Projectile createProjectile(float direction, Position pos){ if (timeNow()-lastTimeFired>rateOfFire && !isReloading()){ if (ammunitionInMagazine==0){ return null; } else { ammunitionInMagazine-=1; lastTimeFired=timeNow(); boolean visible = (getType() == Type.GUN) ? true : false; re...
4
public void printError(int err) { if(err==-1) System.out.println("File not found"); }
1
@Override public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable { log.debug("before method invoke..."); Object result = arg1.invoke(delegate, arg2); log.debug("after method invoke..."); return result; }
0
@Override public String getPinyin() { if(getInput().replaceAll("\\d", "").equals(getInput()) || getInput().replaceAll("\\d", "").isEmpty()) return getInput();//just return input if the input is all numbers or no numbers String unprocessedInput = getInput(); // split up each syllable and then put the string ba...
5
public static List<List<Integer>> subsetsWithDup(int[] num) { List<List<Integer>> res = new ArrayList<List<Integer>>(); Arrays.sort(num, 0, num.length); res.add(new ArrayList<Integer>()); if (null == num || 0 == num.length) { return res; } int j = 0; int ...
6
public static ArrayList<Member> searchMemberByCity(String city){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<Member> members = n...
5
@DataProvider public Collection getChartResult(Map param) throws Exception { // sql的内容为根据时间的分组,然后分别计算出当月的利润率和从开户到当月截至的利润率 /****** * SQL********* select dm, round(profit/(SELECT profit_ FROM * accounttransactionsinfo WHERE TYPE_='balance' and SIZE_ in * ('AddFunds') order by OPENTIME_,TICKET_ limit 1),4) a...
8
public void javaToNative (Object object, TransferData transferData) { if (!checkMyType(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } MyType[] myTypes = (MyType[]) object; try { // write data to a byte array and then ask super to convert to pMedium ByteArrayOutputStream out...
4
public String download(PeerInfo peerInfo, String filename) throws PeerNotConnectedException, TrackingServerNotConnectedException, FileNotFoundException { if(peerInfo == null) { peerInfo = getPeerInfoFromPeerSelectionAlgorithm(filename); } if(peerInfo == null) { throw new PeerNotConnectedException("Cannot de...
6
public void sizeline() { int dumy = 0; MyDrawing buffer; if(selectedDrawings.size() != 0){ for(int i=0;i<selectedDrawings.size();i++){ selectedDrawings.elementAt(i).move(selectedDrawings.elementAt(i).getX(), 400 - selectedDrawings.elementAt(i).getH()); } for(int i=0;i<selectedDrawings.size();i++){ ...
5
void paintDirect(CPRect srcRect, CPRect dstRect, byte[] brush, int w, int alpha, int color1) { int[] opacityData = opacityBuffer.data; int by = srcRect.top; for (int j = dstRect.top; j < dstRect.bottom; j++, by++) { int srcOffset = srcRect.left + by * w; int dstOffset = dstRect.left + j * width; f...
4
public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JButton) { SoundManager.playSound(SoundManager.SoundType.BUTTON); } //TODO Program functionality of buttons? if(e.getSource() == home) { mathGame.showMenu(MathGame.Menu.MAINMENU); // Return to the main menu // choosefraction(); ...
5
public ArrayList<ArrayList<Integer>> subsetsWithDup(int[] S) { result = new ArrayList<ArrayList<Integer>>(); result.add(new ArrayList<Integer>()); Arrays.sort(S); if ((S.length) == 0) return result; put(S[0], 1); Arrays.sort(S); int range = result....
3
@Override public boolean equals(Object o) { if (!(o instanceof Matrix)) { return false; // o is not a matrix } Matrix a = (Matrix) o; if ((!this.isJagged && !a.isJagged) && this.sameOrder(a)) { for (int row = 0; row < this.rowCount; row++) { fo...
7
public static boolean line_box_xywh(double lx0, double ly0, double lx1, double ly1, double rx0, double ry0, double rWidth, double rHeight) { int out1, out2; if ((out2 = outcode(lx1, ly1, rx0, ry0, rWidth, rHeight)) == 0) { return true; } while ((out1 = outcode(lx0, ly0, rx0, ry0, rWidth, rHeight)) != 0) { ...
6
public Object[] toArrays() { Object objs[] = new Object[count]; int n = 0; if ((flags&InputFlags.TA_IN_PRICE_OPEN)!=0) { objs[n++] = getO(); } if ((flags&InputFlags.TA_IN_PRICE_HIGH)!=0) { objs[n++] = getH(); } if ((flags&InputFlag...
6
private static String toNumber(String s) { String result = ""; for (int i =0; i < s.length(); i ++){ if("ABC".indexOf("" + s.charAt(i)) > -1) result += "" + 2; if("DEF".indexOf("" + s.charAt(i)) > -1) result += "" + 3; if("GHI".indexOf("" + s.charAt(i)) > -1) result += "" + 4; if("JKL".index...
9
public ButtonPanel() { super(); listeners = new EventListenerList(); setLayout(new FlowLayout(FlowLayout.RIGHT)); install = new JButton(Localization.translate("ButtonPanel.install")); update = new JButton(Localization.translate("ButtonPanel.update")); uninstall = new JButton(Localization.translate("ButtonPa...
5
@SuppressWarnings("unchecked") private void _unload(PythonPlugin pl) throws Exception { PluginManager man = plugin.getServer().getPluginManager(); if (!(man instanceof SimplePluginManager)) { throw new ClassCastException("cannot unload plugins from a non-SimplePluginManager"); } ...
7
static void printAnalyzerResult(MethodNode method, Analyzer a, final PrintWriter pw) { Frame[] frames = a.getFrames(); TraceMethodVisitor mv = new TraceMethodVisitor(); pw.println(method.name + method.desc); for (int j = 0; j < method.instructions.size(); ++j) { method.instructions.get(j).accept(mv); ...
6
public String evaluate(String in){ in = in.trim(); String command = in.substring(0,in.indexOf(" ")); String args = in.substring(in.indexOf(" ")+1); if(command.equals("help")) man.get("help"); if(command.equals("save")){ if(man.save())return "Saved successf...
5
public void parseWrite(StringBuilder code, ApplySentence s, Environment e) { List<Value> args = s.value; boolean gr6taken = willPushRegister(6); takeRegister(code, 6); boolean gr7taken = willPushRegister(7); takeRegister(code, 7); code.append(spc + " LAD GR6, 0" + "\n"); code.append(spc + " LAD GR7, WR...
6
public Matrix subMatrix(int startRowIndex, int endRowIndex, int startColIndex, int endColIndex) { if (startRowIndex < 0 || endRowIndex > getNumRows() || startColIndex < 0 || endColIndex > getNumCols()) { throw new IndexOutOfBoundsException("Sub-matrix index out of range"); }...
7
private static void destroy_Launcher(War war) { LauncherDestroyer destroyer; EnemyLauncher user_launcher = null; String launcherId; int destroyerId = 0; if (war.getWarLauncherDestroyer().isEmpty()) { System.out.println("\tNo Destroyer available to hit the launcher"); } else { System.out.println("Ente...
8
private void creerTblOffre() { if (!m_offInit) { try (BufferedReader br = new BufferedReader(new FileReader(Constant.m_offreList))) { String sCurrentLine; m_tblEmplois.clear(); String[] results; // int i = 0; while ((sCur...
6
public static void setSpeed(int x) { if(x < 1 || x > 10) return; crawlOff = false; crawlSpeed = 0.05 / x; }
2
* * @return <tt>true</tt> iff any ground formula instances exist having the given predicate, and * the given term in the given argument position * * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public b...
2
public void newGame() { /** Choose mode - Player vs Player or Player vs Computer */ System.out.println("Press Y to play against the AI. \n Alternatively, press any other key to continue with 2 players. \n Confirm your choice by pressing Enter"); Scanner sc = new Scanner(System.in); String yn = sc.nextLine().t...
3
public static void loadConfig() { // set standard values config.put("DBURL", "jdbc:mysql://localhost:55555/server"); config.put("DBUSER", "root"); config.put("DBPW", "root"); config.put("PORT", "1234"); // overwrite them with the values from the config file try (BufferedReader br = new BufferedReader( ...
5
private void createSpecies(int num,int inputs,int outputs){ if(species==null){ species=new Species(history); for(int i=0;i<num;i++) species.getIndividuals().add(new SpeciationNeuralNetwork(history,inputs,outputs)); if(species2==null) currentSpe...
8
public void setCategorie(Categorie categorie) { if (getCategorie() != null) { getCategorie().getSujets().remove(this); getCategorie().ajouterNbreSujets(-1); getCategorie().ajouterNbreReponses(-(getReponses().size() - 1)); } this.categorie = categorie; if (ge...
3
@Override public void run() { boolean fim = false; LOGGER.info("Cliente Aguardando dados"); while (!fim) { System.out.println("Cliente Aguardando dados"); System.out.flush(); int read = is.nextInt(); LOGGER.info("Recebido " + read + " do servidor"); switch (read) { case -1: // mario cli...
4
private void playCard(ICard card, List<ICard> taking) { if (table.action(card, taking)) { log("Giocata la carta " + card.getCardStr()); cardsOnHand.remove(card); // rimuove la carta dalla mano if (taking.size() != 0){ personalDeck.addAll(taking); // Aggiungo le carte al mazzetto log("Presa: " + cards...
3
@Override public void onCloseDocument(PdfWriter writer, Document document) { //la cella con il numero totale di pagine avrà le stesse caratteristiche della cella originaria contentente il testo #Page //ma l'allineamento sarà a sinistra if (this._TotalNumberOfPageFooter != null) { ...
2
public ContentObjectRelation getParentChildRelation(ContentType childType, String childId) { if (childType instanceof RegionType) return null; else if (childType instanceof LowLevelTextType) { //Text lines, word, glyph for (int i=0; i<regions.size(); i++) { Region reg = regions.getAt(i); if (reg inst...
5
protected String getGasType(int userChoice){ if (userChoice == UNLEAD) return UNLEAD_STR; else if (userChoice == PLUS_UNLEAD) return PLUS_UNLEAD_STR; else if (userChoice == PREMIUM_UNLEAD) return PREMIUM_UNLEAD_STR; else if (userChoice == DIESEL) return DIESEL_STR; return null; }
4
public void Insert(BinaryNode item) { if(item.elementNumber < elementNumber) if(left != null) left.Insert(item); else setLeft(item); else { if(right != null) right.Insert(item); else ...
3
public static void main(String args[]) throws Throwable{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); for(String ln;(ln=in.readLine())!=null;){ StringTokenizer st=new StringTokenizer(ln);String a=st.nextToken(),b=st.nextToken(); boolean ws=fal...
8
@Override public void setBuffer() { if (isDirty()) { // calculate how many bytes we need to store all the involved people int length = 0; for(InvolvedPerson involvedPerson : involvedPeople) { length += stringToBytes(encoding.getCharacterSet(), involved...
3
public Load(){ try{ aFileReader = new FileReader(aFilePath); aBufferedReader = new BufferedReader(aFileReader); for(;;){ String aString = aBufferedReader.readLine(); if(aString != null){ stringLines.add(aString); }else{ break; } } }catch(FileNotFoundException error){ error....
5
private static boolean isUpdateAvailable(URI remoteUri, File localFile) { URLConnection conn; try { conn = remoteUri.toURL().openConnection(); } catch (MalformedURLException ex) { log.error("An exception occurred", ex); return false; } catch (IOException ex) { log.error("An exception occu...
4
private static long ageDifferenceInDays(String firstname1 , String surname1, String firstname2, String surname2) throws InvalidPersonException { Person person1 = null; Person person2 = null; for (Person person : people){ String firstname = person.getFirstname(); String surname = person.getSurname(); ...
7
@Override public String getOptionsXML() { StringBuffer sb = new StringBuffer(); if( anRot != 0 ) { sb.append( " AnRot=\"" + anRot + "\"" ); } if( anElev != 15 ) { sb.append( " AnElev=\"" + anElev + "\"" ); } if( pcDist != 30 ) { sb.append( " pcDist=\"" + pcDist + "\"" ); } if( pcHeight ...
9
public void setTimestep(String timestep) { if ((!timestep.equals(SimConst.DAILY)) && (!timestep.equals(SimConst.DAILY_MEAN)) && (!timestep.equals(SimConst.MONTHLY_MEAN)) && (!timestep.equals(SimConst.MEAN_MONTHLY)) && (!timestep.equals(SimConst.ANN...
9
public void modifyCountry(Country cnt) { Connection con = null; PreparedStatement pstmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), ...
4
public long getLastReceiptTime() { return lastReceiptTime; }
0
private static void mirror() throws Exception { int initialSize = frames.size(); if (mapCenter == -1) { throw new Exception("map-center was never declared."); } for (int fr = 0; fr < initialSize; fr++) { if (fr != mapCenter) { //This loop should be...
7
@Basic @Column(name = "CTR_ID_ELEMENTO") public int getCtrIdElemento() { return ctrIdElemento; }
0
public NusmvSTS explore(String nusmvFile) throws IOException { logger.info("Using NuSMV to retrieve STS from SMV file"); init(nusmvFile); int iteration = 0; while (!this.pathsToExplore.isVisited()) { iteration++; logger.info("Starting up.."); startNuSMVConsole(nusmvFile); // sendCommandToCons...
7
private void read(){ try{ String str = ""; String seqstr = ""; Sequence curseq = new Sequence(); while((str=input.readLine())!=null){ if(str.startsWith(">")){ if(seqstr.compareTo("")!=0&&curseq!=null){ curseq.seqSeq(seqstr); seqstr = ""; seqs.add(curseq); } curseq = ne...
7
public boolean move(int newBase) { //Save the registers if we're the currently running process if(this == m_currProcess) save(m_CPU); //Get the relative locations to make for easier moving based on newBase int relLIM = registers[CPU.LI...
5
private void parameter() { if (have(NonTerminal.PARAMETER)) { tryDeclareSymbol(current); nextToken(); expect(Token.Kind.COLON); type(); } }
1
private static String _v2DirStr(Vector2d v) { if (v.equals(NIL)) return "DNIL"; if (v.equals(NONE)) return "DNONE"; if (v.equals(UP)) return "DUP"; if (v.equals(DOWN)) return "DDOWN"; if (v.equals(LEFT)) return "DLEFT"; if (v.equals(RIGHT)) return "DRIGHT"; re...
6
public SecondaryPowerFailure(Grid grid, int lifetime, PrimaryPowerFailure parentPowerFailure, Rotation rotation, Position pos) { super(grid, lifetime); if (parentPowerFailure == null) throw new IllegalArgumentException("The given PrimaryPowerFailure is invalid!"); if (rotation == null) throw new IllegalArg...
3
public void addTrack(Song song) { // System.out.println("Album called " + title + " inserting track named " + song.getTitle() + "..."); if(song.getTitle() == null) { song.setTitle("No Title"); } if(!albumContainsTrack(song)) { tracks.put(song.getTitle(), song); } }
2
public void visitInstanceOfExpr(final InstanceOfExpr expr) { if (expr.expr() != null) { expr.expr().visit(this); } print(" instanceof " + expr.checkType()); }
1
private void decode(byte[] bytes) throws InvalidUIntException { if (bits != 1 && bits != 2 && bits != 4 && bits != 8) throw new InvalidUIntException(); byteBuffer = ByteBuffer.wrap(bytes); switch (bits) { case 1: value = byteBuffer.get(); break; case 2: value = byteBuffer.getShort(); b...
8
public boolean equals(Object obj) { if (obj == this) return true; /* is obj reference null */ if (obj == null) return false; /* Make sure references are of same type */ if (!(getClass() == obj.getClass())) return false; else { Style tmp = (Style) obj; if (tmp.name.equalsIgnoreCase(...
4
public Move(GameBoard b, Position start, Position dest) { this.startPiece=b.getPiece(start); this.start = start; this.dest = dest; killedPiece=b.getPiece(dest); if(startPiece.getType()==Piece.KING&&!b.hasKingMoved(startPiece.getColor())){ flags=(byte)BitField.setBit(flags, KING_MOVED_FLAG); } if...
8
protected Direction moveRandomly(String logMe, Direction direction) { final Unit unit = getUnit(); if (unit.getMovesLeft() <= 0 || unit.getTile() == null) return null; if (logMe == null) logMe = "moveRandomly"; Random aiRandom = getAIRandom(); if (direction == null) { ...
9
@Override public boolean equals(Object obj) { if (obj == null) return false; if (getClass() != obj.getClass()) return false; ControlScheme other = (ControlScheme) obj; if (Jump != other.Jump) return false; if (Left != other.Left) return false; if (Right != other.Right) return false; return...
5
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public static RecordableTextAction getAction(int action) { if (action<MIN_ACTION_CONSTANT || action>MAX_ACTION_CONSTANT) return null; switch (action) { case COPY_ACTION: return copyAction; case CUT_ACTION: return cutAction; case DELETE_ACTION: return deleteAction; case PASTE_ACTION: r...
9
public static void main(String[] args) { DataGIS gis = null; TopRegionalRC rc = null; DataGridUser user = null; //FIRST STEP--------------------------------------------- //Initialize the GridSim package int num_user = 1; // number of grid users Calendar calendar...
7
final public void Assignment() throws ParseException { /*@bgen(jjtree) Assignment */ BSHAssignment jjtn000 = new BSHAssignment(JJTASSIGNMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtreeOpenNodeScope(jjtn000);int op ; try { PrimaryExpression(); op = AssignmentOperator(); ...
8
public int[] twoSum(int[] numbers, int target) { int[] a = {0,0}; Hashtable<Integer, Integer> hash = new Hashtable<Integer, Integer>(); for (int i = 0; i <= numbers.length-1; i++) { hash.put(numbers[i], i); } for (int i = 0; i <= numbers.length-1; i++) { Integer n = hash.get(target - numbers[i]); if ...
5
private void processEvent(MouseEvent e, TouchCommandMessageType down) { Dimension componentDimension = e.getComponent().getSize(); float xRate = (float) e.getX() / (float) componentDimension.width; float yRate = (float) e.getY() / (float) componentDimension.height; switch (down) { case TOUCH_DOWN: client...
3
public Object invoke(JMSRemoteRef jmsRemoteRef, Method method, Object[] params) throws Exception { boolean oneway = JMSRemoteRef.isOneWay(method); long timeout = 0; if (!oneway) { timeout = REQUEST_TIMEOUT; if (method.isAnnotationPresent(Timeout.class)) { ...
7
public void setTotalTicketsSold(long totalTicketsSold) { this.totalTicketsSold = totalTicketsSold; }
0