text
stringlengths
14
410k
label
int32
0
9
public List<Integer> preorderTraversal(TreeNode root){ List<Integer> list = new ArrayList<Integer>(); if(root == null) return list; preOrderRec(list, root); return list; }
1
public FileInputStream nextElement() { if(next != null){ try { next.close(); } catch (IOException e) { e.printStackTrace(); } } try { FileInputStream in = new FileInputStream(streamList[index]); index++; return in; } catch (FileNotFoundException e) { e.printStackTrace(); } //Imp...
3
public ConstantVolumeJoint(World argWorld, ConstantVolumeJointDef def) { super(argWorld.getPool(), def); world = argWorld; if (def.bodies.size() <= 2) { throw new IllegalArgumentException( "You cannot create a constant volume joint with less than three bodies."); } bodies = def.bodie...
9
private static Fonttype getFonttype(String s) { Fonttype ret = null; if ((s != null) && !s.equals("")) { try { ret = Fonttype.valueOf(s.trim().toUpperCase()); } catch (IllegalArgumentException e) { ret = null; } } retu...
3
public String noteInfo(String what){ if(!System.getProperty("user.home").equals("C:/Users/fireblade") //Don't record stats if im... me, So much testing, so much falseness. && McLauncher.tglbtnSendAnonData.isSelected()){ //An option to let players send usage data anonymously. URL url = null; String we...
3
private Object getRussianRedoName(String redoPresentationName) { if (redoPresentationName.contains("deletion")) return "Вернуть удаление"; if (redoPresentationName.contains("style")) return "Вернуть"; if (redoPresentationName.contains("addition")) return "Вернуть ввод"; return redoPresentationName; }
3
public static void startupConses() { if (Stella.currentStartupTimePhaseP(0)) { if (!(Stella.NIL != null)) { Stella.NIL = new Cons(); Stella.NIL.value = null; Stella.NIL.rest = Stella.NIL; } } { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = ...
8
private void literal() { if (accept(NonTerminal.LITERAL)) { } }
1
public void Launch() { try { String OS = System.getProperty("os.name").toUpperCase(); if(OS.contains("WIN")) { AppDataPath = System.getenv("APPDATA"); LauncherName = "\\." + LauncherName; Slash = "\\"; } else if(OS.contains("MAC")) { AppDataPath = System.getProperty("user.home") + "/Library/...
8
public CheckResultMessage checkDayofMonth2() { int r1 = get(10, 2); int c1 = get(11, 2); date(); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (!(getValueString(r1 - 2, c1 + maxDay, 2).equals(maxDay + "日"))) { return...
5
public static int getPlayerID(String playerName) { for(int i = 0; i < maxPlayers; i++) { if(playersCurrentlyOn[i] != null) { if(playersCurrentlyOn[i].equalsIgnoreCase(playerName)) return i; } } return -1; }
3
@Override public Collection<Class<?>> getAutoCompleteClasses() { if(getDescriptor().getClassRestriction() != null) { ArrayList<Class<?>> classRestriction = new ArrayList<Class<?>>(1); classRestriction.add(getDescriptor().getClassRestriction()); return classRestriction; } return null; }
4
public static void copyFile(File sourceFile, File destFile) { try { if (!sourceFile.exists()) { return; } if (!destFile.exists()) { destFile.createNewFile(); } FileChannel source = null; FileChannel ...
7
@Override public void onPlayerInteract (PlayerInteractEvent event) { if(event.isCancelled()) { return; } long cooldown = 0; Date currentDate = new Date(); Player player = event.getPlayer(); int weaponID = player.getItemInHand()....
9
@SuppressWarnings("deprecation") public List<ComponentIn> search(Map<String, String> critieras) { Session session = HibernateUtil.sessionFactory.getCurrentSession(); session.beginTransaction(); Criteria hibernateCriteria = session.createCriteria(ComponentIn.class); Set<String> keySet = critieras.keySet(); fo...
9
public void addMeetingtoCalendar(Meeting meeting, String starttime, String endtime, int day){ String selectedCell; starttime = starttime.substring(11, 16); endtime = endtime.substring(11, 16); for(int row = 0; row < tablemodel.getRowCount(); row++){ selectedCell = (String) tablemodel.getValueAt(row, 0)...
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Schedule schedule = (Schedule) o; if (id != schedule.id) return false; if (seqNumber != schedule.seqNumber) return false; return true;...
5
public BuilderControlPanel(BuilderController controller) { // super(new GridLayout(1,0)); this.controller = controller; initView(this, controller); }
0
public void bytesRead(int bytesRead) { totalBytesRead = totalBytesRead + bytesRead; updateUploadInfo("progress"); try { Thread.sleep(delay); } catch (InterruptedException e) { e.printStackTrace(); } }
1
private void rotate(boolean clockwise) { clear(); shape.rotate(clockwise); // lefts while (currentX + shape.getMostWest() < 0) { currentX++; } // right while (currentX + shape.getMostEast() > width - 1) { currentX--; } // down while (currentY + shape.getMostSouth() > height - 1) { currentY...
3
private void censored(int row) { if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) { return; } PaidDetail selectedRow = result == null ? null : result.get(row); if (selectedRow != null) { int result = JOptionPane.showConf...
6
public DragAndDropClassObject findNearestClass(int x, int y){ DragAndDropClassObject c; double minDist = Double.MAX_VALUE; int minDistIndex = -1; for(int i=0; i < components.size(); i++) { c = (DragAndDropClassObject)(components.get(i)); if(c.distanceTo(x,y) < minDist) { minDist = c.distanceTo(x,y); ...
4
@Override protected AIBundle doInBackground() throws Exception { long startTime = System.currentTimeMillis(); //use this instead of a timer thread to know when to stop. bundle = new AIBundle(operation); switch(operation){ //Switching on what we want returned. case OPERATION_MOVE: bundle = getNextM...
5
public static void method526(String s, Stream stream) { if(s.length() > 80) s = s.substring(0, 80); s = s.toLowerCase(); int i = -1; for(int j = 0; j < s.length(); j++) { char c = s.charAt(j); int k = 0; for(int l = 0; l < validChars.length; l++) { if(c != validChars[l]) continue; ...
9
public static final boolean StateIsCharState(int index) { return index < 7; }
0
@EventHandler public void onPlayerQuit(PlayerQuitEvent event){ Player player = event.getPlayer(); if(player.getWorld() == DeityNether.plugin.getServer().getWorld(DeityNether.config.getNetherWorldName())) if(!player.hasPermission(DeityNether.OVERRIDE_PERMISSION) && player.hasPermission(DeityNether.GENERAL_PERMIS...
4
@Override protected void setColoredExes() { // TODO Auto-generated method stub ParametricCurve besie = new BesieCurve(allex); coloredEx = besie.Calculation(); }
0
public Component getComponentFor(LodResource lodResource, TaskObserver taskObserver) throws InterruptedException { this.sourceLodResource = lodResource; taskObserver.taskProgress(lodResource.getName(), 1f / (float)taskObserver.getRange()); JPanel panel = new JPanel(new BorderLayout...
6
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 fe...
6
@Override public Object getMetaPacket(Object watcher) { Class<?> DataWatcher = Util.getCraftClass("DataWatcher"); Class<?> PacketPlayOutEntityMetadata = Util.getCraftClass("PacketPlayOutEntityMetadata"); Object packet = null; try { packet = PacketPlayOutEntityMetadata.getConstructor(new Class<?>[] { int.c...
9
private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed if(modCoche == null){ try{ taller.crearCoche(matText.getText(),marcaText.getText(), modeloText.getText(),numKmText.getText(), ...
3
public OSCJavaToByteArrayConverter() { }
0
public static <T extends AppWindow> ArrayList<T> getActiveWindows(Class<T> windowClass) { ArrayList<T> list = new ArrayList<>(); for (T window : new FilteredIterator<>(WINDOW_LIST, windowClass)) { if (window.isShowing()) { list.add(window); } } return list; }
2
public int adxrLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; if( optInTimePeriod > 1 ) return optInTimePeriod + adxLookback ( ...
4
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
7
private void fillTechnicals() { int better = 0; int worse = 0; for (String s : dbSet) TECHNICAL_PRICE_DATA.put(s, new TreeMap<Float, float[]>()); for (float[][][] tech : Database.DB_PRICES.values()) { for (int id = 0; id < tech.length; id++) { for (int i = 0; i < tech[id].length; i++) { if (isDa...
5
public static double Func(int i,int T){ double result1=Double.MAX_VALUE,result2=Double.MAX_VALUE; if(i==n){return 0;} if(c[i]!=-1) return c[i]; if(T==0){ double temp=0; if(t[i] < (M-5)){ temp= Math.pow((M-5) - (t[i]), 4); } result1 = temp+Func(i+1,0); } if(T+t[i] <= M){ result2 = Fu...
6
@Override public void toCode(XDataOutput dataOutput) { super.toCode(dataOutput); switch(opcode){ case LOADB: dataOutput.writeByte(((Number)_const).byteValue()); break; case LOADS: if(_const instanceof Character){ dataOutput.writeShort((Character)_const); }else{ dataOutput.writeShort(((Numbe...
8
int test5() throws MiniDB_Exception{ int points = 0; // IN_SOLUTION_START MiniDB db = new MiniDB( "minidb.test5" ); BufMgr bm = db.getBufMgr(); int size = 8; BPlusTree bpt = db.createNewBPlusTreeIndex( "table", "val", 8 ); int iters = 50; MiniDB_Record insertedRecords[] = new MiniDB_Reco...
9
public static int melyJatekosKovetkezik( int b, int jatekos, int mi ) { logger.info("Kiválasztja mely játékos következik."); if( b%2 == 1 ) { logger.info("1 játékos következik"); jatekos = 1; if( mi == 0 ) System.out.println( "Az első játékos rak bábút: " ); if( mi == 1 ) System.out.println( ...
5
public static String basicInspect(Object object) { if ((object instanceof Class) || (object instanceof Boolean) || (object instanceof Integer) || (object instanceof Double) || (object instanceof Float) || (object instanceof Byte) || (object instanceof Character)) { return object.toS...
9
public void setVar(PVar node) { if(this._var_ != null) { this._var_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
3
public void scan() { SAMFileReader inputSAM = new SAMFileReader(inputSAMFile); SAMFileWriter outputSAM = new SAMFileWriterFactory().makeBAMWriter( inputSAM.getFileHeader(), true, outputSAMFile); SAMFileWriter outputSAM2 = new SAMFileWriterFactory().makeBAMWriter( inputSAM.getFileHeader(), true, outputSAMF...
8
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) { Raster source = sources[0]; Rectangle srcRect = source.getBounds(); int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest); M...
9
@Override protected void writeChildren(XMLStreamWriter out) throws XMLStreamException { super.writeChildren(out); if (scopes != null) { for (Scope scope : scopes) { scope.toXMLImpl(out); } } if (allowedWorkers != null) { fo...
7
public static int[][][][] read3model(String path){ int[][][][] out = new int[3][aa][aa][windowsize]; try{ FileReader input = new FileReader(path); BufferedReader br = new BufferedReader(input); String line; line = br.readLine(); if(line.startsWith("//")){ int dim = Integer.parseInt(line.substrin...
8
protected void paint(Graphics2D g2) { // draw all creatures for (IDrawable d : getDrawables()) { // save transformation for each drawable AffineTransform cT = g2.getTransform(); d.paint(g2); // restore transformation g2.setTransform(cT); } }
1
public double getLatitude() { return latitude; }
0
public void run() { String s; try { System.out.println(Server1.getCurrentTime() + "1::" +"Starting Status thread"); statusSocket = new ServerSocket(statusPort); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } while (true) { try { statusAcceptSocket = s...
5
@Override public boolean equals(Object o){ if(this == o) return true; if(o == null) return false; if(!(o instanceof Carta)) return false; final Carta other = (Carta) o; return this.numero.equals(other.numero) && this.palo.equals(ot...
4
public static void main(String[] args) { // ## DEFINE VARIABLES SECTION ## // define the driver to use String driver = "org.apache.derby.jdbc.EmbeddedDriver"; // the database name String dbName="jdbcDemoDB"; // define the Derby connection URL to use String connectionURL = "jdbc:derby:" + dbName + ";create=true...
9
public String getLecturaPrimitivaCSharp() { if (nombre.equals("String")) { return "Console.ReadLine()"; } if (nombre.equals("int")) { return "int.Parse(Console.ReadLine())"; } if (nombre.equals("float")) { return "float.Parse(Console.ReadLine()...
9
public Boolean dropGraph(String graphURI) { if(graphURI==null){ log.warning("to be deleted Graph URI is null"); return false; } String query = "DROP SILENT GRAPH <"+graphURI+">"; if(autoCommit){ return this.writeData(query.replace(" ", "+")); } this.queries += query.replace(" ", "+")+"\n"; return...
2
public static int[] simularPartido(Cancha cancha, Pelota pelota, int formacionA, int formacionB){ int[] equipoGanador= new int[2]; int comienza=(int)(Math.random()*2+1); //1 o 2 //Primer tiempo if (comienza==1){ cancha.getEquipoX(0).getJugadorX(0).setTieneBalon(true); ...
8
public void printResult(final String[][] aArray) { for (final String[] subArray : aArray) { for (int j = 0; j < subArray.length; j++) { if (!subArray[j].equals(".")) { System.out.print(subArray[j]); } else { System.out.print(" "...
4
private void heapify(int cur) { while (getRight(cur) < heapSize) { E left = (E)array[getLeft(cur)]; E right = (E)array[getRight(cur)]; if (comparator.compare(array[cur], left) > 0 || comparator.compare(array[cur], right) > 0) { ...
6
public double[] sumColumns() { int nRows = getRowDimension(); int nCols = getColumnDimension(); double data[][] = getDataRef(); double[] result = new double[nCols]; for (int c = 0; c < nCols; c++) { result[c] = 0; for (int r = 0; r < nRows; r++) { ...
2
public ListNode deleteDuplicates(ListNode head) { ListNode headNew = new ListNode(-1); headNew.next = head; if(head == null || head.next == null) return head; ListNode pre = headNew; ListNode index = pre.next; boolean isDuplicates = false; while(index...
6
public void paintComponent(Graphics g) { // Draw a rect around the whole thing g.fillRect(0, 0, getWidth()-1, getHeight()-1); // Draw the line separating the top int spacerY = yPixel(tc.displayBoard.getHeight() - TetrisController.TOP_SPACE - 1); g.setColor(Color.WHITE); g.drawLine(0, spacerY, getWi...
3
public static void main(String[] args) { Thread t = new Thread(new TestThread()); t.start(); try { t.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("End"); }
1
public void createMusic(){ try { Sequence musicData = MidiSystem.getSequence(new File("Music Files/" + gameMusic +".mid")); musicPlayer = MidiSystem.getSequencer(); musicPlayer.open(); musicPlayer.setSequence(musicData); musicPlayer.se...
3
public static void main(String[] args) { Thread server = new Thread(new Runnable(){ @Override public void run() { try { ServerSocketChannel serverChannel = ServerSocketChannel.open(); ServerSocket serverSocket = serverChannel.socket(); Selector selector = Selector.open(); serverS...
8
public static void initialize(Component canvas) { keys = new boolean[402]; // MAKE KEY EVENT LISTENER KeyAdapter keyAdapter = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { //System.out.println("Key code: " + e.getKeyCode()); if (keys[e.getKeyCode()] || e.getKeyCode() >=...
6
public int OpenTable(int Column, String ID){ //Controllo se l'ID sia presente nella lista for (int i = 0; i < this._MyTableList.size(); i++) { if (this._MyTableList.get(i).GetID().equals(ID)) { //Creo la tabella con il numero di colonne inpostato this._PdfPTa...
2
@Override public void main() { cleanOutput(); Creator[] creators = {new ConcreteCreatorA(), new ConcreteCreatorB()}; for (Creator creator : creators) { Product product = creator.factoryMethod(); addOutput(product.getClass().getSimpleName()); } super.main("Factory Method"); }
1
public MealyConfiguration(State state, MealyConfiguration parent, String input, String unprocessed, String output) { super(state, parent); myInput = input; myUnprocessedInput = unprocessed; myOutput = output; }
0
private static Etudiant annulerInscription() { ArrayList<Etudiant> listeEtudiant = ListeEtudiants.getInstance().getListe(); // Liste des etudiants int itNoCours = 1; // Compteur pour l'affichage des cours int itNoEtudiant = 1; // Compteur pour l'affichage des etudiants int nbEtudiant = 0; ...
8
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if (value == null) { this.put(key, 1); } else if (value instanceof Integer) { this.put(key, ((Integer)value).intValue() + 1); } else if (value instanceof Long) { ...
5
public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); ...
6
public Matrix invertFull() { Matrix ret = new Matrix(); float[] mat = values; float[] dst = ret.values; float[] tmp = new float[12]; /* temparray for pairs */ float src[] = new float[16]; /* array of transpose source matrix */ float det; /* determinant */ /* * transpose m...
3
public boolean checkInput(int i, String input) { if (null == _form[i]) return true; return _form[i].test.run(input); }
1
public void DropPlayer(int playerID) { for (Planet p : planets) { if (p.Owner() == playerID) { p.Owner(0); } } for (Fleet f : fleets) { if (f.Owner() == playerID) { f.Kill(); } } }
4
public double rate(EnhancedMove move){ int dropHeight = move.getBoard().dropHeight(move.getPiece(), move.getX()); Point[] pos = move.getPiece().getBody(); Board board = move.getBoard(); int gaps = 0; for(int i = 0; i < 4; i ++){ int x = pos[i].x + move.getX(); int y = pos[i].y + dropHeight; ...
2
@Override public void channelRead( ChannelHandlerContext ctx, Object msg ) throws Exception { ByteBuf buffer = (ByteBuf)msg; buffer.markReaderIndex(); boolean needReset = true; try { if(buffer.readUnsignedByte() != 254) return; String version = MCListener.pingMcVersion; if(MCListen...
7
public void reproduction() { final Getoptions opt = new Getoptions(); //final AudioOption ao = new AudioOption(); try { byte audio[] = Wuuii.out.toByteArray(); InputStream input = new ByteArrayInputStream(audio); final AudioFormat format = getTransmissionFormat(); final ...
4
public String getValue() { return value; }
0
public ConfigurationController(ConfigurationPane pane, AutomatonSimulator simulator, SelectionDrawer drawer, Component component) { this.configurations = pane; this.simulator = simulator; this.drawer = drawer; this.component = component; changeSelection(); this.configurations.addSelectionListener(this...
0
public ServiceThread(RendezvousObject robj) { this.robj = robj; }
0
* @param relationname * @return List */ public static List getRelevantRulesForRelation(String modulename, String relationname) { { Module module = edu.isi.powerloom.PLI.getModule(modulename, null); LogicObject relation = edu.isi.powerloom.PLI.sGetRelation(GuiServer.guiNameToPlName(relationname), modul...
7
public boolean downloadFile(String url_, String localPath) { try { URL url = new URL(url_.replace(" ", "%20")); FileOutputStream fstream = new FileOutputStream(new File(localPath)); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.connect(); int c...
4
public SkillSet getSkillSet() { return skillSet; }
0
final void method3528(int i) { if (i < 45) aFloatArray7327 = null; IDirect3DDevice idirect3ddevice = ((DirectxToolkit) aClass378_7328).anIDirect3DDevice9810; int i_0_ = ((Class367_Sub5) this).aHa_Sub3_4479.method3941(-103); Class101_Sub2 class101_sub2 = ((Class367_Sub5) this).aHa_Sub3_4479.method3887...
5
public static String encode(String input) { String nrml = Normalizer.normalize(input, Normalizer.Form.NFD); StringBuilder stripped = new StringBuilder(); for (int i = 0; i < nrml.length(); ++i) { char c = nrml.charAt(i); if (Character.getType(c) != Character.NON_SPACING_MARK && (Character.isLetterOrDig...
8
public void setSteps(List<Step> steps) { this.steps = steps; }
0
@Override public boolean canSelectAll() { for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) { if (!mSelectedRows.contains(row)) { return true; } } return false; }
2
public static void initialize() { for (int i=0; i<TERRAIN_TYPE.values().length; i++) { TERRAIN_IMAGE[i] = MetaData.mainWindow.loadImage("/images/terrain/" + TERRAIN_TYPE.values()[i].toString() + ".png"); } for (int i=0; i<RESOURCE_TYPE.values().length; i++) { RESOURCE_IMAGE[i] = MetaData.mainWi...
9
public long doUpdate(Master master, UpdateRequest updateRequest) { incrementAccessAndMaybeRecalibrate(master); File f = updateRequest.getFile(); Location accessLoc = updateRequest.getLocation(); MasterMeta fm = master.map.get(f.getId()); boolean allSucceeded = true; long maxDelay = -1; Set<C...
8
public void cacher(Position pos, int dist){ for (int x=pos.getX() - dist; x <= pos.getX() + dist; x++){ for (int y=pos.getY() - dist; y <= pos.getY() + dist; y++){ if ((x >= 0) && (x < IConfig.LARGEUR_CARTE) && (y >= 0) && (y < IConfig.HAUTEUR_CARTE)){ map[x][...
6
public static void rectangle(double x, double y, double halfWidth, double halfHeight) { if (halfWidth < 0) throw new RuntimeException("half width can't be negative"); if (halfHeight < 0) throw new RuntimeException("half height can't be negative"); double xs = scaleX(x); double ys = scal...
4
public static float AvgRentsPerMonth(int month, int year, int endMonth, int endYear) { //Bij deze kon ik het niet allemaal in de statement steken daarmee heb ik het gedeeltelijk in code gedaan ArrayList<Integer> avg = new ArrayList<Integer>(); float x=0; //deze lus loopt de maanden en jaren af. Bij een ma...
9
public boolean isOnGround(BlockMap bmap) { for(int i = 0; i < bmap.entities.size(); i++) { Block tile = (Block) bmap.entities.get(i); { if(groundPoly.intersects(tile.poly)) { return true; } } ...
2
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String orderid = request.getParameter("orderid"); String orderdat...
8
public Field findFieldWithAnnotation(Class<? extends Annotation> annotationClass) { for(Field field : getFields()) { if(field.isAnnotationPresent(annotationClass)) { return field; } } return null; }
3
public Color getSelectedColor() { ColorValue cv = (ColorValue) getSelectedItem(); return null == cv ? null : cv.color; }
1
public static boolean isValidSnapshot(File f) throws IOException { if (f==null || getZxidFromName(f.getName(), "snapshot") == -1) return false; // Check for a valid snapshot RandomAccessFile raf = new RandomAccessFile(f, "r"); try { // including the header and th...
8
public void set(Protocol con, Component widget, JSONObject obj, Map styleMap) throws JSONException { if (obj.has("item")) { JSONArray array = obj.getJSONArray("item"); for (int j = 0; j < array.length(); j++) { JSONObject itemObj = array.getJSONObject(j); ...
9
public Long getCreatedAt() { return createdAt; }
0
public Object readMap(AbstractHessianInput in) throws IOException { String name = null; String type = null; String description = null; MBeanParameterInfo []sig = null; int impact = 0; while (! in.isEnd()) { String key = in.readString(); if ("name".equals(key)) name = in....
7
private static int findUnfairness(int kids, int[] packets) { // Sort array using mergeSort O(n logn) mergeSort(packets); int minPointer = 0; int maxPointer = kids - 1; int minUnfairness = Integer.MAX_VALUE; // find mininum difference between packets within range kids O(n) while (maxPointer < packets...
2
public void print(String dataStructure) { System.out.print(dataStructure + ": "); for (int i = 0; i < size; i++) if (heap.get(i) != null) System.out.print(heap.get(i).element() + " "); else System.out.print("--"); System.out.println(); int nBlanks = 32; int itemsPerRow = 1; int column = 0; ...
8