text
stringlengths
14
410k
label
int32
0
9
public double[] standardizedPersonStandardDeviations(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedPersonStandardDeviations; }
2
public int binarySearch(int value, int[] array, int lowIndex, int highIndex) { if (value == 0) return -1; runCount++; if (lowIndex == highIndex) { if (value == array[lowIndex]) return lowIndex; else return -1; } int midIndex = (lowIndex + highIndex) / 2; // System.out.println("Looking in ...
6
public void setScoreboardFormat(String scoreboardText, String scoreboardScoreType) { if(scoreboardText == null || scoreboardScoreType == null) throw new NullPointerException(); if(!scoreboardScoreType.matches("(?i)d|h|m|s|ms")) throw new IllegalArgumentException(); String oldText = this.scoreboardText; sc...
5
private JsonObject getFreesoundAPISoundInstanceFromId() { // sets headers Header[] headers = { new BasicHeader("Content-type", "application/json") }; // sets Freesound API Sound Instance url String tempUrl = "http://www.freesound.org/apiv2/sounds/" + id + "/?token=" + apiKey; // executes GET request ...
3
public void Login() { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); String username = userTextField.getText(); char[] password = passwordField.getPassword(); String passwordString = new String(password); try { answer = Switch.switchMethod("logIn", username, passwordString); } catch (Excepti...
5
private static StringBuilder normalizeHex(StringBuilder hex, int step) { // strip and white space int length = hex.length(); for (int i = 0; i < length; i++) { if (isNoneHexChar(hex.charAt(i))) { hex.deleteCharAt(i); length--; i--; ...
6
public Boolean isOnline() { long time = System.currentTimeMillis(); if(time-lastSignal > Constants.NOT_ALIVE_INTERVAL*1000) { return false; } else { return true; } }
1
@Override public int compareTo(final Lap o) { int ret; if (this.getId() == null) { ret = 1; } else if (o == null || o.getId() == null) { ret = -1; } else { ret = this.getId().compareTo(o.getId()); } return ret; }
3
public boolean onMouseUp(int mX, int mY, int button) { if(button == 0) { screenClicked = false; } return false; }
1
public void restore() { String[] split = _backupouts.split(","); _outs = new BoardObject.type[split.length]; for(int j=0; j<split.length; j++) { for (BoardObject.type c: BoardObject.cardtypes) { if (split[j].equalsIgnoreCase(c.toString())) { _outs[j] = c; } } } String[] split2 = _backupi...
6
public static int countColumns(String file) { try { // Open a file and read one line BufferedReader reader = new BufferedReader(new FileReader(file)); String line = reader.readLine(); reader.close(); // Nothing to read? if (line == null) return 0; // Count fields String fields[] = line.split...
2
public String reverse1(String str) { char chars[] = str.toCharArray(); int forward = 0; int backward = chars.length - 1; boolean forwardReady = false; boolean backwardReady = false; while (forward < backward) { if (forwardReady && backwardReady) { ...
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
7
public XMLTable() throws XPathExpressionException, SAXException, IOException, ParserConfigurationException{ FileInputStream file = new FileInputStream(new File(xml)); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); ...
8
public static void main(String[] args) { MyGraph g = new MyGraph(); g.addNode(1); g.addNode(999); g.addNode(12); g.addNode(13); g.addNode(2); g.addEdge(1, 999); g.addEdge(12, 999); g.addEdge(999, 2); g.addEdge(999, 999); // introduce cycle g.addEdge(999, 1); if(g.hasNode(999)...
8
public static void main(String[] args) { if (args.length < 2) { System.out.println("Please specify the type of lock (B or C) and test (count or print) as command line arguments."); return; } if (args[0].equals("B")) { Test.set_lock(new LockB(THREADS)); } else if (args[0].equals("C")) { Tes...
8
private void preprocessDataThree(){ // Check row and column lengths this.numberOfRows = this.values.length; this.numberOfColumns = this.values[0].length; for(int i=1; i<this.numberOfRows; i++){ if(this.values[i].length!=this.numberOfColumns)throw new IllegalArgumentExcept...
5
public void checkForDeath(Tile tile) { if (tile.hasUnit()) { Unit unit = tile.getUnit(); if (unit.getCurrentHealth() <= 0) { getCurrentPlayer().getUnits().remove(unit); if (getCurrentPlayer().getUnits().isEmpty()) { getCurrentPlayer().setDefeated(true); //EXTRA: Change this to check for rout b...
3
public T removeMin() { T response = (T)store[1]; //insert the last entry to the root if heap does not only contains root if(tail!=1){ store[1] = store[tail]; } //nullify the tail node since its copied to the root store[tail] = null...
9
public static void renderLine(int x, int y, int length, boolean horizontal, boolean doubled) { glEnable(GL_BLEND); bindTexture("/graphics/textures/ui/gui.png"); int height = (doubled) ? 17 : 12; int width = length; int lineLength = (doubled) ? 73 : 74; // if (!horizontal) // { // width = height; //...
7
public boolean mousedown(Coord c, int button) { if(folded) { return super.mousedown(c, button); } parent.setfocus(this); raise(); if (button == 1) { ui.grabmouse(this); doff = c; } return super.mousedown(c, button); }
2
public Vector<Integer> outdoorChoices(Room R) { final Vector<Integer> choices=new Vector<Integer>(); if(R==null) return choices; for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--) { final Room room=R.getRoomInDir(d); final Exit exit=R.getExitInDir(d); final Exit opExit=R.getReverseExit(d); if((ro...
9
public String getLastName() { return lastName; }
0
public final void decorators() throws RecognitionException { try { // Python.g:86:11: ( ( decorator )+ ) // Python.g:86:13: ( decorator )+ { // Python.g:86:13: ( decorator )+ int cnt5=0; loop5: while (true) { int alt5=2; int LA5_0 = input.LA(1); if ( (LA5_0==AT) ) { alt5=1; }...
7
public static void main(String[] args) { logger.setLevel(Level.SEVERE); ConsoleHandler handler = new ConsoleHandler(); handler.setLevel(Level.SEVERE); logger.addHandler(handler); if (args.length == 0) { logger.warning("Invalid arguments count."); return; ...
6
private void setButtonsWidthAndHeight() { Dimension newSize = new Dimension(0, 0); Dimension currentSize = new Dimension(0, 0); // Get the size of each button and preserve the widest for (int x = 0; x < keys.length; x++) { currentSize = theButtons[x].getPreferredSize(); if (currentSize.width > newSize.wi...
3
public void update( ArrayList<PhysicObject> objectList, float delta ) { if ( objectList == null ) return; for ( PhysicObject object : objectList ) physics( object, delta ); for ( int i = 0; i < objectList.size(); i++ ) { for ( int j = i + 1; j < objectList.size(); j++ ) intersect( objectList.get( ...
4
public static void main(String[] args) { // Initialize notProcessedNodes with all nodes for (int i = 0; i < GRAPH_SIZE; i++) { if (NODE != i) { notProcessedNodes.add(i); } } // Initialize distances with very big values Arrays.fill(distance...
8
public int getLastLightChange(int x, int y) { if(chunkID < 0) { x = 15-x; } if(x < 0 || x >= blocks.length || y < 0 || y >= blocks[0].length) return 0; return lightChanges[x][y]; }
5
public void recieveInput(int mouseX, int mouseY){ mouseY = Standards.W_HEIGHT - mouseY; if (isInPanesSelector(mouseX, mouseY)){ if (Mouse.isButtonDown(0)){ Boot.getGUIHandler().changeActivePane(findPane(mouseX, mouseY)); } } }
2
public boolean isMatch_2d_method(String s, String p) { int m=s.length(), n=p.length(); boolean[][] dp = new boolean[m+1][n+1]; dp[0][0] = true; for (int i=1; i<=m; i++) { dp[i][0] = false; } // preprocess * for(int j=1; j<=n; j++) { if(p.charAt(j-1)=='*'){ dp[0][j] = true; } else { break;...
9
@Override public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return teachers.get(rowIndex).getIdTeacher(); case 1: return teachers.get(rowIndex).getName(); case 2: return teachers.get(r...
6
private double testPriorityQueuePoll(int[] inserts) { System.out.println("Testing PriorityQueue with " + inserts.length + " polls"); long[] times = new long[20]; long startTime; long endTime; for (int i = 0; i < 20; i++) { priorityQueue = new PriorityQueue(); ...
4
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(args.length < 4) { return this.showHelp(sender); } if(Validate.isPlayer(sender)) { UPlayer player = plugin.getPlayerManager().getUPlayer(sender.getName()); ...
5
public static void maxHeaplify(int[] array, int index, int size){ int left, right, temp; int big = index; while(true){ left = 2 * index + 1; right = 2 * index + 2; if(left < size && array[left] > array[index]) big = left; if(right < size && array[right] > array[big]) big = right; if(big == ...
6
public Element get(String name) { for(Element e : elements) if(e.getName().equals(name)) return e; return null; }
2
private Integer createDirection(Criteria criteria, AbstractDao dao) throws DaoException { Integer idDescription = dao.createNewDescription(criteria).get(0); criteria.remuveParam(DAO_ID_DESCRIPTION); criteria.addParam(DAO_ID_DESCRIPTION, idDescription); List<Integer> res = dao.createNewD...
2
private double getAngle(Edge edge) { double x1 = edge.getFromNode().getxCoord(); double y1 = edge.getFromNode().getyCoord(); double x2 = edge.getToNode().getxCoord(); double y2 = edge.getToNode().getyCoord(); double xDiff = x2 - x1; double yDiff = y2 - y1; double angle = -Math.atan2(yDiff, xDiff); if ...
1
@Override public Balance createNewChild(TreeMap<String, String> properties) { Balance balance = new Balance(accounts); balance.setName(properties.get(NAME)); balance.setLeftName(properties.get(Balances.LEFTNAME)); balance.setRightName(properties.get(Balances.RIGHTNAME)); bala...
2
public String activate(Participant p, LifeEventType lifeEventType, HtmlColor backcolor) { if (lastDelay != null) { return "You cannot Activate/Deactivate just after a ..."; } if (lifeEventType == LifeEventType.CREATE) { pendingCreate = new LifeEvent(p, lifeEventType, backcolor); return null; } if (la...
9
public void onMouseClick(int x, int y, int button) { }
0
public IDResult joinGame (String gameName, String playerName) { try { if(gameName == null) { return new IDResult("illegal game name"); } if((!_gameManager.isGameExists()) || !(_gameManager.isGameSameName(gameName))) ...
9
public static int genomeIdFromJsonArray(JSONArray organizedJson, String name){ int len = organizedJson.length(); int i,j,k,l; int id = -1; boolean ok = false; for(i = 0; i < len && !ok; i++) { JSONArray groups = organizedJson.getJSONObject(i).getJSONArray("groups"); int leng = groups.length(); for...
9
static final void method135(boolean flag, String s) { if (Class43.aClass142_Sub17Array730 == null) { return; } if (flag) { return; } int i = 0; long l = NodeCache.nameToLong(s); if (l == 0L) { return; } for (; ~C...
7
public void remove(int val) { Node current = head; while (current.next != null) { Node tempNext = current.next; if (tempNext.value == val) { if (tempNext.next == null) current.next = null; else current.next = tempNext.next; return; } } }
3
public void setSourccePreview() { InputStream is; try { BufferedImage src = ImageIO.read(new File(sourcePath)); if (src.getWidth() >= 150 || src.getHeight() >= 150) { BufferedImage prevIMG = new BufferedImage(150, 150, src.getType()); for (int i =...
5
@Override public void open() { switch (this.getState()) { case LIFTCLOSE: this.setState(LiftState.LIFTOPEN); break; case LIFTOPEN: case LIFTRUNNING: case LIFTSTOP: break; } }
4
public PageScraper(URL url, String[] words, String[] args) throws IOException, BadLocationException { HTMLDocument doc = scrap(url); page.setUrl(url.toString()); for (String arg : args) { executeArg(arg, words, doc); } }
1
public void processWeatherStationConfiguration() throws ConfigurationException { weatherStations.clear(); for (int i = 1; i < Integer.MAX_VALUE; i++) { final String weatherStationValue = "weatherstation" + i; final String weatherStationName = config.getProperty(weatherStationValue + "_name"); ...
9
@Override public void addComponent(Component component, LayoutParameter... layoutParameters) { Set<LayoutParameter> asSet = new HashSet<LayoutParameter>(Arrays.asList(layoutParameters)); if(asSet.contains(MAXIMIZES_HORIZONTALLY) && asSet.contains(GROWS_HORIZONTALLY)) throw new IllegalArg...
4
private void performElimination(Instruction i) throws Exception { // if i is dead, but hasn't already been eliminated if(i.isDeadCode() && !i.isDeleted()) { i.delete(deleteFor); for(Value v : i.getArguments()) { v.removeUse(i); // v may now be dead...
4
public static final void PetCommand(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) { final byte petIndex = chr.getPetIndex(slea.readInt()); if (petIndex == -1) { return; } MaplePet pet = chr.getPet(petIndex); slea.skip(5); final byte command = slea.readByte(); final...
5
public static void sort (int[] array) { for (int i = 0; i < array.length -1; i++) { for (int j = i + 1; j < array.length; j++) { if (array[i] > array[j]) { array[i] ^= array[j]; array[j] ^= array[i]; array[i] ^= array[j...
3
@Override public void updurgency(HWindow wnd, int level) { if ((wnd == awnd) && !folded) level = -1; if (level == -1) { if (wnd.urgent == 0) return; wnd.urgent = 0; } else { if (wnd.urgent >= level) return; ...
8
public void generate(EnumGenerationType paramGenType) { Random genRdm = new Random(); switch (paramGenType) { case coinStruct: genBox.generate(theWorld, new EntityCoin(1), Display.getWidth() + 30, Display.getHeight()); break; case cashStru...
4
private BufferedImage[] cutMobSheet() { BufferedImage mobSpriteSheet = null; try { mobSpriteSheet = ImageIO.read(new File( "Images/CondensedOverworldSprites.png")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedImage spriteSheet = null; try { ...
6
public ComprarJuego2() { initComponents(); setLocationRelativeTo(null); c_perfiles.getEditor().getEditorComponent().addKeyListener(new KeyAdapter(){ @Override public void keyReleased(KeyEvent evt){ String cadenaEscrita=c_perfiles.getEditor()....
8
public Set<Man> spawnMen(int amount, int speed) { int amountPerSquare = (amount / amountOfFloorTiles) < 1 ? 1 : amount / amountOfFloorTiles; Set<Man> men = new HashSet<Man>(); int x = orig_x; int y = orig_y; for(int r = 0; r < tiles.length; r++) { for(int c = 0; c < tiles[r].length; c++) { ...
6
@Override public void deserialize(Buffer buf) { position = buf.readUShort(); if (position < 0 || position > 65535) throw new RuntimeException("Forbidden value on position = " + position + ", it doesn't respect the following condition : position < 0 || position > 65535"); total = ...
4
public static <T extends Comparable<T>, E> Node<T,E> search(T value, Node<T,E> node){ if(node == null) return null; if(node.getValue().compareTo(value) < 0 && node.getRightNode() != null){ return search(value, node.getRightNode()); }else if(node.getValue().compareTo(value) > 0 && node.getLeftN...
6
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); HashMap<Integer, HashMap<Integer, Integer>> g = new HashMap<Integer, HashMap<Integer, Integer>>(); int[][] dist = new int[n + 1][n + 1]; for (int i = 0; i <= n; i++) { g.put(i, new Ha...
8
public static void main(String[] args) { String key = "QWERTY"; LinkedList<Character> word = new LinkedList<>(); for (int i = 0; i < 3; i++) { word.append(key.charAt(i)); } System.out.println(word.toString()); // Setting up the conditions Node<Character> temp = new Node<Character>(null, null); No...
1
public String addResourceNode(String resource_id) { String node_id = null; int count = 0; try { while((node_id == null) && (count != retryCount)) { if(count > 0) { //System.out.println("ADDNODE RETRY : regi...
6
public ResultSet retry(String query) { // boolean passed = false; Statement statement = null; ResultSet result = null; // while (!passed) { try { statement = connection.createStatement(); result = statement.executeQuery(query); // passed = true; return result; } catch (SQLException ex) { if ...
3
public ArrayList<Network> moleculeArrToNetworkArr(ArrayList<Molecule> molecules){ ArrayList<Network> networks = new ArrayList<Network>(); for(int i=0; i<molecules.size(); i++){ networks.add(retrieve(molecules.get(i))); } return networks; }
1
@Override public void insert(int i, int j, double value) { for (Element e : elems) { accessCount += 1; // durchsuchen des elements if (e.getI() == i && e.getJ() == j) { elems.remove(e); break; } } if (Double.compare(value, 0.0) != 0) { // only non zero values need to // be added e...
4
public ClassLoader getClassLoader() { URL[] urls = getUrls(); System.out.println(Arrays.toString(urls)); ClassLoader parent = Thread.currentThread().getContextClassLoader(); if (parent == null) { parent = ClassPath.class.getClassLoader(); } if (parent == null)...
2
private Dimension computeSize(Container target) { synchronized (target.getTreeLock()) { int hgap = getHgap(); int vgap = getVgap(); int w = target.getWidth(); // Let this behave like a regular FlowLayout (single row) // if the container hasn't ...
7
static void tick(int delta) { if (Mouse.isButtonDown(0)) { if (dragging) { // mouseDrag: dragHere = mouseToSphere(); // new ending position quatHere = new Quaternion( dragStart.dot (dragHere), // angle between position vectors dragStart.cross(dragHere) // normal of position vectors...
5
public synchronized void regenerate() { Iterator<Map.Entry<ChunkSQL, ArrayList<LocationSQL>>> it = this.possibleLocations.entrySet().iterator(); HashMap<String, Integer> properties; while(it.hasNext()) { //TODO: Implement HIGHEST_BLOCK Map.Entry<ChunkSQL, ArrayList<LocationSQL>> set = it.next(); //ChunkSQL...
6
public static float getFloat() { float x = 0.0F; while (true) { String str = readRealString(); if (str == null) { errorMessage("Floating point number not found.", "Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE); } ...
4
public State usingId(Id id) { if (this.id != null) { throw new IllegalStateException("Id already assigned!"); } this.id = id; return this; }
1
private void addDetailsToListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addDetailsToListButtonActionPerformed //SYG hardcoded crime. skift snarligt int resTypeID = 0; if (dropDownRes.getSelectedItem().equalsIgnoreCase("Lille Stang")) { resTypeID ...
7
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean.T...
6
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for (String line; (line = in.readLine())!= null; ) { StringBuilder sb = new StringBuilder(); boolean isCapsLock = true; for (int i = 0; i < line.length() && isCapsLock; i++) {...
7
@Test public void test3() { xmlReader.setContentHandler(new DefaultHandler() { List<Book> books = new ArrayList<>(); private String currentQName; private Book currentBook; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { cu...
8
private void splitIntoQuadrants(int startx, int endx, int starty, int endy) { int halfLength = Math.abs(starty - endy) / 2; for (int i = startx + halfLength; i < endx; i++) for (int j = starty + halfLength; j < endy; j++) board[i][j] += "4"; for (int i = startx + ha...
9
@Override public String getName() { return this.name; }
0
public final List<Double> generateValueAxisMarkPositions(double minData, double maxData, int segmentsNumber) { List<Double> result = new ArrayList<Double>(); double step = calculateValueAxisStepInDataScale(minData, maxData); double dataDistance = getDataDistance(maxData, minData); double...
8
public static boolean portAvailable(int port) { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(port); serverSocket.setReuseAddress(true); } catch(IOException e) { // do nothing return false; } finally { if (null != serverSocket && !serverSocket.isClosed()) { try { ...
9
public static void main(String[] args) { //comment out one of the next two lines depending on whether environmental variables or a credentials file is being used // AmazonEC2 ec2 = new AmazonEC2Client(new BasicAWSCredentials(System.getenv("AWS_ACCESS_KEY"), System.getenv("AWS_SECRET_KEY"))); AmazonEC2 ec2 = new A...
9
private Connect parseConnect ( ) { Connect connect = new Connect(); boolean isAfterConnect = false; for(int i = 0; i < container.length; i++) { if ("connect".equals ( container[i] )) { isAfterConnect = true; continue; ...
7
public List findAll() { log.debug("finding all Problem instances"); try { String queryString = "from Problem"; Query queryObject = getSession().createQuery(queryString); return queryObject.list(); } catch (RuntimeException re) { log.error("find all failed", re); throw re; } }
1
public static boolean checkDate(String date){ // M M / D D / Y Y Y Y - H H : M M : S S // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 if (date.length() != 19){ return false; } if (date.charAt(2) != '/'){ return false; } if (date.charAt(5) != '/'){ return false; } if ...
7
@Override public Ticket in(Car car, List<Park> parkList) { int no = -1; double num = -1d; for(int i = 0; i < parkList.size(); i ++) { Park park = parkList.get(i); if(park.isFull()) { continue; } double _rate = Math.round((float)park.getEmptyNu...
5
public void ecriturePGM(String nomFichier){ try{ String fichier = nomFichier+".pgm"; String test = ""; BufferedWriter file = new BufferedWriter(new FileWriter(fichier)); file.write("P2"); file.newLine(); file.write("#")...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; HtmlCommentToken other = (HtmlCommentToken) obj; if (COMMENT == null) { if (other.COMMENT != null) return false; } else if (!COMMENT.equ...
6
public void run(){ while(true){ this.cal = new GregorianCalendar(); stunde = cal.get(Calendar.HOUR_OF_DAY); minute = cal.get(Calendar.MINUTE); sekunde = cal.get(Calendar.SECOND); if (stunde < 10){ zeit="0"+stunde+":"; } else{ zeit=""+stunde+":"; } ...
5
public ArrayList viewCheckout() { ArrayList al = new ArrayList(); al = shsmb.viewMyBookingCheckout(); return al; }
0
public boolean isTransition(String ref, String alt) { if (ref.equals("A") && alt.equals("G")) return true; if (ref.equals("G") && alt.equals("A")) return true; if (ref.equals("C") && alt.equals("T")) return true; if (ref.equals("T") && alt.equals("C")) return true; return false; }
8
@Override public Object getParam(String name) { String sname = "get" + name.substring(0, 1).toUpperCase() + name.substring(1); try { Method m = getClass().getMethod(sname); return m.invoke(this); } catch (NoSuchMethodException e) { return null;...
5
public ArrayList<ArrayList> allMovesDefending(){ ArrayList<ArrayList> a=new ArrayList<ArrayList>(); for(int i=0;i<pMovesDefending().size();i++){ a.add(pMovesDefending().get(i)); } for(int i=0;i<nMovesDefending().size();i++){ a.add(nMovesDefending().get(i)); } for(int i=0;i<bMovesDefending().size();i++...
6
private void drawInterface(Graphics g) { // Draw a basic 10 X 20 grid for (int i = 0; i < 10; i++) for (int j = 0; j < 20; j++) g.drawRect(i*32, j*32, 32, 32); g.drawString("Next piece:", 383, 16); g.setColor(Color.BLACK); g.drawRect(343, 32, 128, 128); for (int i = 0; i < 4; i++) for (int j = 0;...
4
static void dradf2(int ido, int l1, float[] cc, float[] ch, float[] wa1, int index){ int i, k; float ti2, tr2; int t0, t1, t2, t3, t4, t5, t6; t1=0; t0=(t2=l1*ido); t3=ido<<1; for(k=0; k<l1; k++){ ch[t1<<1]=cc[t1]+cc[t2]; ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; t1+=ido; ...
7
private void startElement(XMLStreamReader reader) throws DAOException { switch (reader.getLocalName()) { case TagConstants.ARTIFICIAL_FLOWER_TAG: int id = getID(reader.getAttributeValue(null, TagConstants.ID_ATTRIBUTE)); currentFlower = new ArtificialFlower(id); ...
6
public static boolean writeUserSelectedFile() { if (fileDialog == null) fileDialog = new JFileChooser(); fileDialog.setDialogTitle("Select File for Output"); File selectedFile; while (true) { int option = fileDialog.showSaveDialog(null); if (option != JFileChooser.APPR...
8
public void invert(int invDir){ int lown = -1; int highn = -1; for(int i=0; i < highnote-lownote+1; i++){ if(keyon[i] == true){ lown = i; break; } } if(lown >= 0){ for(int i=highnote-lownote; i>lown; i--){ if(keyon[i] == true){ highn = i; break; } } } if(highn >= 0){ ...
9
public static void main(String[] arg) { Socket capture = null; InputStream is = null; OutputStream os = null; try { capture = new Socket("www.baidu.com", 80); os = capture.getOutputStream(); String commandStr = "GET / HTTP/1.0"; String ente...
8
@Override public void caseAAvalieExpLogicaDefinicaoComando(AAvalieExpLogicaDefinicaoComando node) { inAAvalieExpLogicaDefinicaoComando(node); if(node.getPontoVirgula() != null) { node.getPontoVirgula().apply(this); } if(node.getFimAvalie() != null) { ...
8
public Socket connect(String host, int port) throws ProxyConnectionException { setPrimaryConnectionPort(port); InetSocketAddress isa = null; try { isa = new InetSocketAddress(InetAddress.getByName(host), port); } catch (IOException ioe) { throw new P...
7