text
stringlengths
14
410k
label
int32
0
9
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" // <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { titreLabel = new javax.swing.JLabel(); nombreLabel = new javax.swing.JLabel(); nombreSpinner = new javax.swing.J...
1
public synchronized void startDecompiler() { if (decompileThread == null) { decompileThread = new Thread(this); decompileThread.setPriority(Thread.MIN_PRIORITY); progressBar.setMinimum(0); progressBar.setMaximum(1000); progressBar.setString("decompiling"); progressBar.setStringPainted(true); dec...
1
private void jButtonValidarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonValidarActionPerformed if (jTextFieldNome.getText() == null || jTextFieldNome.getText().equals("")) { jLabelErro.setErrorText(WORDS.getString("ERRO-CODIGO")); } else if (jTextFieldSenha.getPa...
8
public static void checkJumpPadConfig() { File config = new File(path + "JumpPads/config.yml"); if(!config.exists()) { try { config.createNewFile(); FileConfiguration c = YamlConfiguration.loadConfiguration(config); ArrayList<Integer> jb = new ArrayList<Integer>(); jb.add(19); c.set("SafeJump...
2
public Collection<TimeSlot> queryFreeTime(double startTime, int duration, int resID) { // check all the values first boolean success = validateValue(startTime, duration, 1); if (!success) { return null; } Collection<TimeSlot> resOptions = null; t...
5
public Month(int theMonthNumber) { if (theMonthNumber >=1 && theMonthNumber <= 12) this.theMonthNumber = theMonthNumber; else {this.theMonthNumber = 1;} }
2
public void updateRace(Integer lane, HoleType hole) { assertPositiveInteger(lane, Race.class.getSimpleName() + " - updateRace: lane is mandatory!"); if (hole == null) { throw new IllegalArgumentException("Setting the hole is mandatory!"); } if (!holeTypes.contains(hole)) { ...
7
public int getHeight() { if (image != null) return image.getHeight(null); return 0; }
1
@Override public void keyTyped(KeyEvent key) { if(key.getKeyChar() == '\n'){ String selectedTextAreaName = ""; if(key.getSource() == tfSU){ selectedTextAreaName = "tfSU"; } else if(key.getSource() == tfGer){ selectedTextAreaName = "tfGer"; } else if(key.getSource() == tfUK){ selectedText...
7
public void drawHex(Tile tile, Graphics2D g2) { int x = tile.getLocation().getXCoord(); int y = tile.getLocation().getYCoord(); Polygon poly = makeHex(findCenter(x,y)); String type = tile.getType(); switch (type) { case "DESERT": g2.setColor(new Color(0xFF, 0xFF, 0xA9)); break; case "BRICK": ...
6
private void jButtonFjernVareActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonFjernVareActionPerformed {//GEN-HEADEREND:event_jButtonFjernVareActionPerformed int a = modelVareTilOrdre.size(); for (int i = 0; i < modelVareTilOrdre.size(); i++) { try ...
6
final RasterToolkit createRasterForSprite(ImageSprite class207, boolean bool) { try { anInt7657++; int[] is = new int[(((ImageSprite) class207).indexWidth * ((ImageSprite) class207).indexHeight)]; int i = 0; int i_467_ = 0; if (((ImageSprite) class207).alphaIndex != null) { for (int i_46...
8
public int sendMessage(int priority, int receiver, int context, String content, int queue) { int status = -1; if (messageBroker == null) { log.error("There is no broker connecting to server"); } else { if (messageSenderBroker == null) { messageSenderBroker = messageBroker.createMessageSender(); ...
7
protected synchronized TCPSegment _handleIncomingSegment( TCPSegment s ) throws IOException { boolean sendSyn = false; this.outgoingSocketAddressPair = s.getInverseAddressPair(); if( s.isSyn() && !firstSynReceived ) { firstSynReceived = true; // syn => we are the server (and need to syn+ack back), syn...
9
public String getName() { return this.name; }
0
public static void main(String[] args) { double[][] teeest = new double[0][0]; System.out.println(teeest.length); //Neuron creation test with arbitrary inputs and weights. Neuron myFirstNeuron = new Neuron("min"); double input[] = {5,20,-1}; double weights[] = {0,1,1}; System.out.println(myFirstNeur...
6
public static HashMap<ABObject[], ContactDimension> ExtractDimentsion() { HashMap<ABObject[], ContactDimension> CDDictionary = new HashMap<ABObject[], ContactDimension>(); HashMap<ABObject[], ERA[]> RADictionary = new HashMap<ABObject[], ERA[]>(); HashMap<ABObject[], ContactRelation> CRDictionary = new H...
4
private void calcChromConfig(int c) { chrconf = new ChromConfig(); chrconf.chromseq = new int[popdata.ploidy]; if (popdata.ploidy == 2) { chrconf.chromseq = tools.shuffleArray(Tools.seq(2)); chrconf.quad = 0; } else { assert (popdata.ploidy>2);...
9
private static void disposeColors(Display display) { List toBeRemoved = new ArrayList(1); if (DEBUG) { System.out.println("Display map is " + displays.toString()); //$NON-NLS-1$ System.out .println("Color map is " + requiredFieldColorMap.toString()); //$NON-NLS-1$ } // Look for any stored colors th...
9
public String getSelectedProject() { if (model != null && list != null) { final ObservableList<String> selectedProjectItem = list.getSelectionModel().getSelectedItems(); final String selectedProject = selectedProjectItem.get(0); return selectedProject; } retur...
2
public Listar() { initComponents(); }
0
@Test public void testFactoryMethod() { Person person = PersonImpl.personWithNameAndAge("test", 100); assertEquals(person.getName(), "test"); assertEquals(person.getAge(), 100); }
0
private OfficeWordContainer() { }
5
public void actionPerformed(ActionEvent e) { // We need to get the current layout of the CardLayout panel // before we can change it. CardLayout cl = (CardLayout)(cardPanel.getLayout()); // This section of code finds out the button that has been pressed // and changes t...
8
@Override public List<Article> getArticle(){ List<Article> result = null; //Создаем сессию, она нужна для использования транзакций Session session = HibernateUtil.getSessionFactory().openSession(); try { session.beginTransaction().begin(); //Criteria используется для запроса с ...
2
public double getCurrentKB() { double kb = Math.floor((currentBits / 1024.0) * 1000 + 0.001) / 1000;// 目前下載kb數 return kb; }
0
private boolean saveProjectToFile(File selectedFile){ try { String full = selectedFile.getAbsolutePath(); String partial = full; int index = full.lastIndexOf('.'); int index2 = full.lastIndexOf(File.separatorChar); if(index != -1 && index2 != -1 && index > index2){ partial = full.substring(0,inde...
8
@Override public HeightMap applyTo(HeightMap... heightMaps){ double[][] finalHeights = heightMaps[0].getHeights(); double[][] smoothedHeights = heightMaps[0].getHeights(); int xSize = finalHeights.length; int ySize = finalHeights[0].length; for(int iteration = 0; iteration<nu...
4
public void execute() { m_random = new Random(m_rowNumber * 11); m_dataGenerator.setSeed(m_rowNumber * 11); m_result = new RemoteResult(m_rowNumber, m_panelWidth); m_status.setTaskResult(m_result); m_status.setExecutionStatus(TaskStatusInfo.PROCESSING); try { m_numOfSamplesPerGenerator =...
7
public void checkUpload(CommonsMultipartFile picture) { ParameterUtils.checkUploadEmpty(picture); boolean isPicture = false; try { FileType pictureType = FileTypeJudge.getType(picture.getInputStream()); FileType[] fileTypes = FileType.values(); for (FileType fileType : fileTypes) { if (f...
4
public String getType() { switch (type) { case (0): return "free/deleted record"; case (1): return "message coming from the network and read"; case (3): return "message coming from the network and still to be read"; ...
5
public String getVia(long v) throws IOException{ InputStream inputStream = new FileInputStream(Config.get("UrbanoSHPDir") + "/CARVIA/CARVIA.DBF"); DBFReader reader = new DBFReader(inputStream); Object[] rowObjects; while((rowObjects = reader.nextRecord()) != null) { if ((Double) rowObjects[2] == (v)){ ...
2
public Suggestion( String asker , List<Card> askedCards , List<Reply> replies) { if (asker == null || "".equals(asker)) { throw new IllegalArgumentException("asker can't be null or empty"); } if (askedCards == null) { throw new I...
6
public String levelorder() { ListQueue listqueue = new ListQueue(); BKnoop<E> temp = this; String levelorder = ""; while(temp != null) { levelorder = levelorder + temp.toString(); if(temp.getLeftChild() != null) { listqu...
4
public List<Transition> getTransitionsByState(String stateValue){ List<Transition> tempList = new ArrayList<Transition>(); for(Transition tran: transitions){ if(tran.mathByStateValue(stateValue)) tempList.add(tran); } return tempList; }
2
@EventHandler public void IronGolemBlindness(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.getIronGolemConfig().getDouble("IronGo...
6
Tex nmeter() { if (ntext == null) ntext = new TexI(Utils.outline2( nfnd.render(Integer.toString(nmeter), Color.WHITE).img, Color.BLACK)); return (ntext); }
1
public void deposit(int amount) { this.balance = this.balance + amount; }
0
public RegexTextArea() { super(); regexListeners = new HashSet<>(); getDocument().addDocumentListener(new DocumentChangeAdapter() { public void anyUpdate(DocumentEvent e) { try { String regexString = StringEscapeUtils.unescapeJava(getText()); pattern = Pattern.com...
2
@Test public void test() { // TODO Auto-generated method stub Vehicle bike = new Vehicle(); bike.speed = 20; bike.angle = 0; bike.ownerName = "Roger"; bike.id = 1; Vehicle car = new Vehicle(); car.speed = 60; car.angle = 0; car.ownerName = "Rafael"; car.id = 2; Vehicle trai...
3
public MyTableModel() { data = new ArrayList<NbrCostPair>(Setup.nbrList); refreshRoutes(); }
0
public String toString() { StringBuffer b = new StringBuffer(); for (int x = 0; x < FIELD_SIZE; x++) { for (int y = 0; y < FIELD_SIZE; y++) { FieldObject o = field[x][y]; if (o == null) b.append(' '); else if (o instanceof RockObject) b.append('R'); else if (o instanceof TreeObject) ...
9
private TreeNode gT(int[] preOrder, int pStart, int pEnd, int[] inOrder, int inStart, int inEnd){ if(preOrder==null || inOrder==null || preOrder.length==0 || inOrder.length==0 || inStart>inEnd || pStart>pEnd){ return null; } int childRootVal = preOrder[pStart]; TreeNode child...
9
void saveFormToTransition() { ArrayList<String> alphabet = getTransitionsInputArray(textInput.getText()); if (alphabet.size() > 0) { int counter = sim.autocompleteDFATransitions(alphabet,jComboChooseState.getSelectedIndex()); setVisible(false); dFAMainWin.repai...
2
public static void main(String[] args) { HashSet<Integer> pandigital = new HashSet<Integer>(); // Test multiplication of 1 digit x 4 digit number for (int i = 1; i < 10; i++) for (int j = 1000; j < 10000; j++) { int product = i * j; if (isPandigital(concatenate(i, j, product))) pandigital.add(prod...
7
private void init(String x_label, String y_label, String window_title) { chart = ChartFactory.createScatterPlot("", x_label, y_label, data, PlotOrientation.VERTICAL, false, true, false); // turn off borders of the plot: XYPlot p = chart.getXYPlot(); p.ge...
9
private Place[] grabPlacesFor(Caching caching, final Section section) { ///I.say("Grabbing new places at: "+section.area) ; // // We scan through every tile in this section, and grab any contiguous // areas of unblocked tiles. (These must be flagged just after // acquisition, so that we know to ...
8
public final Pino etsiPolku(int alkuX, int alkuY, int loppuX, int loppuY) { kaymattomatNoodit = new PriorityQueue<Noodi>(11, noodiVertailija); kaydytNoodit = new LinkedList<T>(); kaymattomatNoodit.add(noodit[alkuX][alkuY]); valmis = false; T valittu; whi...
6
@Override public void valueUpdated(Setting s, Value v) { if (s.getName().equals(Selected)) { if (!__lock) { try { if (checkBox_ != null) checkBox_.setSelected(v.getBoolean()); } catch (Exception e) { e.printStackTrace(); } } else __lock = false; } else if (s.getName().equals(T...
6
private void setMines() { int cellAmount = this.high * this.width; Random rand = new Random(); int minesSet = this.minesNumber; while (minesSet > 0) { for (int iteration = 0; iteration < cellAmount && minesSet > 0; iteration++) { final int i = rand.nextInt(thi...
6
public final void setMode(String channel, String mode) { this.sendRawLine("MODE " + channel + " " + mode); }
0
private static int runToInputHiOrLoL(Gameboy gbL, Gameboy gbR, int limit, int joypadInputAdd) { int initialSteps = gbL.stepCount; int add = runToAddressL(limit, gbL, gbR, joypadInputAdd); while (true) { if (add == 0 || gbL.stepCount - initialSteps > limit) return 0; int lastVframe = gbL....
5
private void showTip() { String text = null; tooltipowner = null; String classname = getClass(mouseinside); if (("tabbedpane".equals(classname)) || ("menubar".equals(classname)) || (classname == ":popup")) { if (insidepart != null) { text = getString(insidepart, "tooltip", null); } } else if (cl...
9
public static void save(GameData gD, File f) { DataFile dF = new DataFile(); try { f.createNewFile(); Main.currentGame.dir = f.getAbsolutePath(); FileOutputStream fileoutputstream = new FileOutputStream(f); dF.setProperty("mode", gD.mode + ""); dF.store(fileoutputstream, "Data File"); f...
1
@Override public void mouseDragged(MouseEvent e) { if (!e.isConsumed() && first != null) { gridEnabledEvent = graphComponent.isGridEnabledEvent(e); constrainedEvent = graphComponent.isConstrainedEvent(e); double dx = e.getX() - first.x; double dy = e.getY() - first.y; if (isLabel(index)) { ...
9
public void renderSprite(int xp, int yp, Sprite sprite, boolean fixed) { if(fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < sprite.getHeight(); y++) { int ya = y + yp; for (int x = 0; x < sprite.getWidth(); x++) { int xa = x + xp; if(xa < 0 || xa >= width || ya < 0 || ya ...
9
protected void onDccChatRequest(String sourceNick, String sourceLogin, String sourceHostname, long address, int port) {}
0
public static ComponentUI createUI(JComponent c) { return sharedInstance; }
0
private List<Chromo<T>> getElite(){ return individuals.stream() .sorted((i1, i2) -> Double.compare(i2.getFitness(), i1.getFitness())) .limit(NUM_ELITE) .collect(Collectors.toList()); }
0
public Main(List<Vertex> vertices) { int res = checkEuler(vertices); switch (res) { case 0: String result = calculateCircle(vertices); System.out.println("[INFO] Got result circle: "+result); if(Main.visua...
5
public boolean canFinish(int numCourses, int[][] prerequisites) { int edges = prerequisites.length; if (numCourses < 2 || edges < 1) return true; int[] prereqs = new int[numCourses]; // Count prerequisites for courses for (int i = 0; i < edges; i++) prereqs[prerequisites[i][0]]++; Queue<Integer> queue...
9
static final public Object nestedValue(Map map, String path){ Object val = null; String[] names = path.split("\\."); Map m = map; int lastIdx = names.length - 1; for (int i = 0; i < names.length; i++) { String name = names[i]; // assume the map have string Keys Object v = m.get(name); if (i == la...
3
private void setupBranchListener() { textbBranchListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e){ java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); JTextPane textPane = (JTextPane) e.getSource(); Point pt = new Point(e.getX(), e.getY()); int pos = textPane....
6
public void schemeEditorDelInput() { if(ce_input.getSelectionIndex() == -1) return; String inputName = ce_input.getText(); Contact contact = new Contact(inputName, -1); List<String> sourceFor = new LinkedList<String>(); for(String circuitName : scheme.getCircuits().keySe...
4
public void mouseClicked(MouseEvent event) { ((AutomatonEnvironment)getDrawer().getAutomaton().getEnvironmentFrame().getEnvironment()).saveStatus(); if(event.getButton() == MouseEvent.BUTTON1) { State state = getDrawer().stateAtPoint(event.getPoint()); if(state == null) ...
2
@Override public DayInWeek getDayInWeek() { DayInWeek diwEnum = null; int day = calendar.get(Calendar.DAY_OF_WEEK); if (day == 1) { diwEnum = DayInWeek.SUN; } else if (day == 2) { diwEnum = DayInWeek.MON; } else if (day == 3) { diwEnum = D...
7
public static void main(String[] args) throws InvalidFieldException { Contestant c = new data.Contestant("ad", "Jon", "silver", "booby"); try { System.out.println(c.toJSONObject().toString()); } catch (ParseException e1) { e1.printStackTrace(); } try { Contestant p = new data.Contestant(); p.fro...
2
private void injectLyricsForPath(String path) { // Create a thread pool that will inject lyrics into audio files // Start up 3 times as many threads as logical processors this.lyricThreadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 3); // Get all of the audio files from the ...
3
void savePrefs() { Properties prefs = new Properties(); StringBuilder b = new StringBuilder(); for (int i = 0; i < workCombo.getItemCount(); i++) { String dir = ((File) workCombo.getItemAt(i)).getPath(); b.append(dir.replace('\\', '/')); if (i < workCombo.getI...
3
private void displayPattern() { int l = 0, r = m-1, t = 0, b = n-1; int valuesRemaining = m*n; int i; while(valuesRemaining != 0) { for (i = l; i <= r && valuesRemaining != 0; i++) { valuesRemaining--; System.out.print(arr[t][i] + " "); } for (i = t+1; i <= b && valuesRemaining != 0; i++) { ...
9
private String getAvailableShares(StockPriceProvider provider) { Share[] bufferShare = provider.getAvailableShare(); String s = ""; for (int j = 0; j < bufferShare.length; j++) { if(bufferShare[j].getExchange()!=null){ s += bufferShare[j].name +"<pre>"+ (float)bufferShare[j]...
2
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int t = in.nextInt(); int c = in.nextInt(); int streak = 0; int result = 0; for(int i=0;i<n;i++){ int curr = in.nextInt(); if(curr<=t) streak++; else streak=0; if(streak >= c) result++; ...
3
public boolean foundObjectInImage(WebPicture picture, String object) throws IOException { if(!this.supported) { //throw new RuntimeException("Your systeme doesnt support OpenCV Beta version."); return false; } Point[] locations; File folder = new File("images/" + object); String file ...
9
private void sendHeaders(HttpRequest request, PrintWriter remotePrintWriter) { Map<String, List<String>> clientHeaders = request.getHeaders(); for (String header : clientHeaders.keySet()) { List<String> values = clientHeaders.get(header); for (String value : values) { ...
2
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
7
@Override public boolean eIsSet(int featureID) { switch (featureID) { case statePackage.STATE__PLAYERS: return players != null && !players.isEmpty(); case statePackage.STATE__COUNTRY_STATE: return countryState != null && !countryState.isEmpty(); case statePackage.STATE__TURN: return turn != null...
9
public static Object invokeConstructor(Class c, Object[] args) throws Exception{ try { Constructor[] allctors = c.getConstructors(); ArrayList ctors = new ArrayList(); for(int i = 0; i < allctors.length; i++) { Constructor ctor = allctors[i]; if(ctor.getParameterTypes().length == args.length) ctor...
9
private List<SnapshotFile> trainFiles(List<SnapshotFile> files) { for (int i=0; i<this.training; i++) { nextSnapshot(files); } // After the training, it is necessary to add modify files // for the correct execution of the dataset. List<SnapshotFile> initialFiles = new ArrayList<SnapshotFile>(); for...
3
private static int applyLetterScore(String passwd) { int letterScore = 0; // LETTERS Matcher mL = Pattern.compile(".??[a-z]").matcher(passwd); if ( mL.find() ) // [verified] at least one lower case letter { letterScore = 1; log.debug("1 point for a lower case character\n"); } Matcher mU =...
2
public E pop() { Node<E> newHead; Node<E> oldHead; do { oldHead = head.get(); if (oldHead == null) { return null; } newHead = oldHead.next; } while (!head.compareAndSet(oldHead, newHead)); return oldHead.element; }
2
public static int sizeOf(int type) { switch ( type ) { case MatDataTypes.miINT8: return miSIZE_INT8; case MatDataTypes.miUINT8: return miSIZE_UINT8; case MatDataTypes.miINT16: return miSIZE_INT16; case Ma...
9
public byte[] RMI_baj(String filename, String name, String key) throws RemoteException { addLog(name + " : baj " + filename); String[] dfile = new String[2]; dfile[0] = filename; dfile[1] = name; // Verifica que el archivo este en la lista de archivos validos en el servidor if (files.contains(dfil...
5
public static void setNodesToVisible(ObservableList<Animation> animations) { for (Animation a : animations) { if (a instanceof ScaleTransition) { ScaleTransition st = (ScaleTransition) a; st.getNode().setScaleX(0); st.getNode().setScaleY(0); ...
7
public void updateList() { listModel.clear(); ArrayList<String> a = new ArrayList<>(); for (Course co : aList) { if (co.getInstructor() == null && co.getLab() == null) { listModel.addElement(co.getClassCode() + "," + co.getSection() + " : " + "n/a"); } el...
8
public LineaAerea getLinea(int index){ if (index > 0) { return lineas.get(index); } return null; }
1
public void drawPacDot( int y, int r, Graphics screen ) { screen.setColor( new Color(1.0f, 1.0f, 1.0f) ); for( double i = BLOCKSIZE+r; i < (double)((COLS*BLOCKSIZE) - 1+((double)r/2)); i+=3*r ) if( i > (PACX*BLOCKSIZE) ) //if pac hasn't passed - creates eating effect Circle( (int)(i), (int)(gameHeight-y), (...
2
private Adherent creationAdherent(HttpServletRequest request) { Adherent adh = new Adherent(); adh.setLogin(request.getParameter("id")); adh.setPwd(request.getParameter("pwd")); adh.setNom(request.getParameter("ndf")); adh.setPrenom(request.getParameter("prenom")); String adresse = request.getParameter("ad...
4
public void render(Graphics2D g) { g.setColor(Color.WHITE); g.fillRect(0, 0, width, height); g.setColor(Color.BLACK); double[][][] points = new double[sim.getHeight()][sim.getWidth()] [2]; for (int i = 0; i < sim.getHeight(); i++) { for (int j = 0; j < sim.getWidth(); j...
6
private static void output(int array[][]) { for (int i = 0; i < array.length; i++) { for (int j = 0; j < array.length; j++) { System.out.print(Integer.toString(array[i][j]) + " "); } System.out.println(); } }
2
private ImageProcessor doMinimumSuppression(ImageProcessor in, ImageProcessor adjusted){ //Generate a mask with threshold 0.2*255 ImageProcessor adjImg = adjusted.duplicate(); adjImg.threshold(51); //now median filter with a 5x5 kernel to denoise filter.rank(adjImg, 2, RankFilters.MEDIAN); //ap...
0
private int splitTreeNode(TreeNode currentNode, Set<Node> curCandidates, boolean isTrueChild) { Set<Integer> sampleList = null; if (isTrueChild) { sampleList = currentNode.sampleSetTrue; } else { sampleList = currentNode.sampleSetFalse; } Node chosenFeatu...
8
boolean inBlockComment(int start, int end) { for (int i=0; i<blockComments.size(); i++) { int[] offsets = (int[])blockComments.elementAt(i); // start of comment in the line if ((offsets[0] >= start) && (offsets[0] <= end)) return true; // end of comment in the line if ((offsets[1] >= start) && (offsets[1] <=...
7
public void playBattleLoop() throws InterruptedException{ while(true){ try { in = new FileInputStream(battle); as = new AudioStream(in); ap.player.start(as); } catch(Exception e) { System.out.println("Got an IOEx...
2
public static void write(String filename, PackedImage image) throws IOException { File out = new File(filename); FileOutputStream fos = new FileOutputStream(out); String header = "P6\n" + image.cols() + " " + image.rows() + "\n255\n"; fos.write(header.getBytes()); byte[] buf = new byte [image.cols() * image.row...
3
public final void update(Level level, int x, int y, int z, Random rand) { int var6 = level.getTile(x, y - 1, z); if(level.isLit(x, y, z) || var6 != Block.STONE.id && var6 != Block.GRAVEL.id && var6 != Block.COBBLESTONE.id) { level.setTile(x, y, z, 0); } }
4
public void setCapacity(int newCapacity) { if (newCapacity == capacity) { return; } byte[] newBuffer; if (newCapacity > 0) { newBuffer = new byte[newCapacity]; if (capacity > 0) { int len = capacity; if (newCapacity < le...
4
public static void sevendrome(int a, int b) { if(b <1000000) { return; } for(int d=1; d<10; d++) { for(int d2=0; d2<10; d2++) { for(int d3=0; d3<10; d3++) { for(int d4=0; d4<10; d4++) { int test = 1000000*d +100000*d2 + 10000*d3 + 1000*d4 +100*d3 + 10*d2 + d; if(isPrime(test) && test>=a && t...
8
public void userDataEvent(VisualizePanelEvent e) { if (m_propertyDialog != null) { m_propertyDialog.dispose(); m_propertyDialog = null; } try { if (m_focus != null) { double wdom = e.getInstances1().numInstances() + e.getInstances2().numInstances(); if (wdom == 0) { w...
7
public void mouseMoved(MouseEvent e) { if( e.getX() >= 5 && e.getX() <= 45 && e.getY() >= 5 && e.getY() <= 45){ this.returnBtnFlag = true ; }else{ this.returnBtnFlag = false ; } }
4
public static QuestionManager getInstance() { return instance; }
0