text
stringlengths
14
410k
label
int32
0
9
private void isaac() { lastResult += ++counter; for (int i = 0; i < 256; i++) { int j = memory[i]; if ((i & 3) == 0) { accumulator ^= accumulator << 13; } else if ((i & 3) == 1) { accumulator ^= accumulator >>> 6; } else if ((i & 3) == 2) { accumulator ^= accumulator << 2; } else if ((i &...
5
public static void main(String[] args) { System.out.print("Ile znajduje sie w bankomacie banknotow o nominale 100: "); int nominalStoKomora = IO.readInt(); System.out.print("Ile znajduje sie w bankomacie banknotow o nominale 50: "); int nominalPiecdziesiatKomora = IO.readInt(); ...
8
public static char[] encodeText(char[] c, int n, char[] A) { char[] o = new char[c.length]; //create an array to output encrypted message for (int i = 0; i < c.length; i++) { //if array elemnt is punc. mark or space, copy it if (c[i] == ' ' || c[i] == '.' || c[i] == ',') o[i] = c[i]; //else, find in alpha...
6
public void actionPerformed(ActionEvent e) { JComboBox combo = new JComboBox(); // Figure out what existing environments in the program have // the type of structure that we need. EnvironmentFrame[] frames = Universe.frames(); for (int i = 0; i < frames.length; i++) { if (!isApplicable(frames[i].getEnviron...
9
public static void main(String[] args) { try { if (args.length < 5) { System.out.println("parameters error!"); showHelp(); System.exit(0); } else { txtPath = args[1]; xmlPath = args[2]; StanfordInputpath = args[3]; outputPath = args[4]; } if(args[0].equals("-o")){ System.o...
4
@Override public void loop() { switch (step) { case 0: if(Motors.movement.isMoving()){ if(Motors.ts.isPressed()){ Motors.movement.forward(); reset(); step++; } } else{ Motors.movement.backward(); } break; case 1: if (delta()>400){ Motors.movement.stop(); Mot...
5
public int maxWins(int initialLevel, int[] grezPower) { int n = grezPower.length; Arrays.sort(grezPower); int ans = 0; while(true){ if(ans == n)break; if(initialLevel > grezPower[ans]){ initialLevel = initialLevel + grezPower[ans] / 2; ans++; }else{ break; } } return ans; }
3
public void mouseClicked(MouseEvent e) { if(e.getClickCount()==2) { //if it was the left mouse button if(e.getButton() == MouseEvent.BUTTON1) { int row = table.getSelectedRow(); int column = table.getSelectedColumn(); //only open the dialog, if a row is selected if (row > -...
4
@Override public void move(int direction) { super.move(direction); rest++; if (rest > 20) { rest = 0; if (getHealth() < getMaxHealth()) { setHealth(getHealth() + 1); } } if (!isRunning() || rest % 3 == 0) { Game...
8
@Test public void OccupiedName() throws Exception { LoginCheck logCh = new LoginCheck(); name = "sunny3548"; if (kesh.containsKey(name)) { assertTrue(kesh.get(name)); } else { boolean result = logCh.validate(name); kesh.put(name, result); ...
1
public void actionPerformed(ActionEvent ae) { try { if (ae.getSource() == this.tmrInterrupt) { if (!this.continueInterrupt) { String kill = "Orbiter Kill command received.... killing this thread softly..."; sendToController(kill); try { ...
8
public void saveLevel() throws IOException { if(level != null) { if(level.worldType != WorldType.CLIENT) { File f = level.getChunkFolder(); if(f == null) { f = new File(new File(getFolder(), "saves"), level.g...
5
@Override public Student getCourses(int userId) throws SQLException { List mainCourses = new ArrayList(); List<Course> addCourses = new ArrayList<>(); Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDr...
5
public String toString() { if (this == BOGUS) return "BOGUS"; if (this == UNINIT) return "UNINIT"; if (this == RETURN_ADDRESS) return "RETURN ADDRESS"; if (this == TOP) return "TOP"; return clazz == null ? "null" : clazz.getName();...
5
public boolean initializeFolders() { switch (OsTypes.getOperatingSystemType()) { case Windows: appStore = new File(System.getenv("APPDATA") + File.separator + "PermissionsChecker"); break; case MacOS: appStore = new File(System.getProperty("user.home") + File.separator + "Library/Application Support...
6
public void punktverschieben(JPanel punkt, Point neuePosition) { Point pv = punkt.getLocation(); if (parentClass.parentFrame != null) { punkt.setLocation(parentClass.parentFrame.getMousePosition()); } else { punkt.setLocation(parentClass.parentApplet.getMousePosition()); ...
8
public void update(int delta) { if(elapsedTime < this.sprite.getAnimationSpeed()) { elapsedTime += delta; } else { if(this.sprite.getCurrentFrame() < this.sprite.getFrames().size() - 1) this.sprite.incrementFrame(); else this.sprite.setCurrentFrame(0); elapsedTime = 0; } }
2
public void setjPanelTitre(JPanel jPanelTitre) { this.jPanelTitre = jPanelTitre; }
0
final boolean method347(int i, boolean flag) { if (!flag) { method341(true); } if (anIntArray574 != null) { for (int j = 0; ~j > ~anIntArray574.length; j++) { if (~anIntArray574[j] == ~i) { return Class82.aClass73_1265.method796(anIntAr...
7
public void access() throws IOException { try { BufferedReader in = new BufferedReader(new InputStreamReader( socket.getInputStream())); String inputLine; addOnline(); while (socket.isConnected()) { inputLine = in.readLine(); if (inputLine != null) { if (inputLine.equalsIgnoreCase("Exi...
4
public void run() { try ( // Create objects to handle client input/output BufferedReader clientIn = new BufferedReader( new InputStreamReader(socket.getInputStream())); PrintWriter clientOut = new PrintWriter( socket.getOutput...
9
public static void main(String[] args) { Resource resource = new ClassPathResource("applicationContext.xml"); BeanFactory factory = new XmlBeanFactory(resource); HelloBean helloBean = (HelloBean) factory.getBean("helloBean"); log.debug(helloBean.toString()); HelloBean2 helloBean2 = (HelloBean2) factory.getBe...
0
public static void main(String[] args) throws Exception { // game parameters String output = null; int d = 0; if (args.length > 0) d = Integer.parseInt(args[0]); if (args.length > 1) group0 = args[1]; if (args.length > 2) gro...
6
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FieldFilter)) return false; FieldFilter that = (FieldFilter) o; if (!field.equals(that.field)) return false; if (operator != that.operator) return false; if (value != null...
6
@Override public String describeNode() { String description="Frame:"+this.frameIdentifier; if(this.name!=null) { description+="/"+this.name; } /* if(this.nativeValue!=null) { description+="="+String.format("%.15s", this.nativeValue.toString()) +(t...
1
public void unregisterNode(String key) { Iterator<Entry<String, GenericNode>> it = nodes.entrySet().iterator(); Iterator<GenericEdge> it2; GenericNode tmp; while( it.hasNext() ) { tmp = it.next().getValue(); it2 = tmp.getEdges().iterator(); while(it2.hasNext()) { if(it2.next()...
3
private void btnFinishRoundMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnFinishRoundMouseClicked String courseName = currentCourse.getName(); HashMap<String, ArrayList<Integer>> theScores = new HashMap<String, ArrayList<Integer>>(); ArrayList<Integer>...
8
public static void main(String[] args) throws Exception { for (String file : args) { try { accumulateXrefs(file, VERBOSE_RUN); } catch (Exception e) { System.out.println(e + " in file " + file); } } for (String s : refs.keySet()) { if (!decls.contains(s)) { System.out.println(refs.get(s) +...
4
public void update() { final double MS_TO_S = 0.001; long newMilliseconds = System.currentTimeMillis(); double elapsedSeconds = (newMilliseconds - _lastMilliseconds) * MS_TO_S; // DEBUG // System.out.println(elapsedSeconds); _lastMilliseconds = newMilliseconds; ...
1
public boolean checkFields(){ boolean allGood = true; boolean noEnzymes = true; String name = this.nameTextField.getText(); String prefix = this.prefixTextField.getText(); String suffix = this.suffixTextField.getText(); // check name if(name.compareTo("") == 0){ ErrorMessage.giveErrorMessage("Ple...
8
public static LuaValue longBitsToLuaNumber(long bits) { if ((bits & ((1L << 63) - 1)) == 0L) { return LuaValue.ZERO; } int e = (int) ((bits >> 52) & 0x7ffL) - 1023; if (e >= 0 && e < 31) { long f = bits & 0xFFFFFFFFFFFFFL; int shift = 52 - e; long intPrecMask = (1L << shift) - 1; if ((f & intPr...
5
private boolean checkWithin(int x, int y) { if (x < 0 || x >= width || y < 0 || y >= height) return false; return true; }
4
public void GetMultiIDInRelation(String ids) { multiMap=new HashMap<>(); String query = "select * from inauthor where paperid in(" + ids+")"; ResultSet rs = sqLconnection.Query(query); try { while(rs.next()) { String paperid=rs.getString("paperid"); String name=rs.getString("name"); String...
2
public EDGeneral() { setOpaque(false); setLayout(new MigLayout("", "[150px:150px:150px][50px:70px:80px][50px:100px:100px][200px:200px:500px,grow][230px:230px:230px]", "[20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20px:20px:20px][20p...
9
public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) { if (item instanceof ToolItem) { ToolItem tool = (ToolItem) item; if (tool.type == ToolType.axe) { if (player.payStamina(4 - tool.level)) { hurt(level, xt, yt, random.nextInt(10) + (tool.level) * 5 + 10); ...
3
protected int setDocPath (int docSelector, String docPathName) { // make sure we're in bounds if ((docSelector < 0) || (docSelector > docPaths.length)) { return ARRAY_SELECTOR_OUT_OF_BOUNDS ; } // end if // we're in bounds. // TBD ASAP // if the supplied path is relative rather than absolute ....
2
public void render() { // Get the loaded materials and initialise necessary variables Material[] materials = trackMesh.materials; Material material; Triangle drawTriangle; int currentMaterial = -1; int triangle = 0; // For each triangle in the object for (triangle = 0; triangle < trackMesh.triangles.l...
8
@Override public boolean newUser(String userName, String password, int sentBy) { boolean retVal = false; System.out.println("register: " + userName + ", " + password); retVal = db.register(userName, password); if((sentBy == ServerInterface.CLIENT) && (backupServer != null)) { try { backupServer.ping(); ...
3
public static int osd_set_display(int width, int height, int attributes) { /*TODO*/// struct mode_adjust *adjust_array; /*TODO*/// int i; /* moved 'found' to here (req. for 15.75KHz Arcade Monitor Modes) */ int found; if (gfx_height == 0 || gfx_width == 0) { ...
8
public static TreeMap<Integer,Integer> pitchRangeTrunkate(TreeMap<Integer,Integer> pitchTreeIn){ TreeMap<Integer,Integer> pitchTreeOut = new TreeMap<Integer,Integer>(); Iterator<Integer> pitchIterator = pitchTreeIn.keySet().iterator(); while(pitchIterator.hasNext()){ int key = pitchIterator.next();...
3
private void allocateElements(int numElements) { int initialCapacity = MIN_INITIAL_CAPACITY; // Find the best power of two to hold elements. // Tests "<=" because arrays aren't kept full. if (numElements >= initialCapacity) { initialCapacity = numElements; initial...
2
@Action(name = "hcomponent.handler.onkeydown.param", args = {"event.keyCode"}) public void onKeyDownAction(Updates updates, String[] args, String param) { HComponent<?> html = (HComponent<?>) Session.getCurrent().get( "_hcomponent.object." + param); Session.getCurrent().store("_hcomponent.object." + param + "....
3
void decodeGrbit( byte[] grbytes ) { if( (byte) (grbytes[0] & 0x1) > 0x0 ) { isLink = true; } if( (byte) (grbytes[0] & 0x2) > 0x0 ) { isAbsoluteLink = true; } // 20060406 KSC: need both bits 2 & 4 to be set for hasDescription // if ((byte)(grbytes[0] & 0x14) > 0x0)hasDescription = true; if( (byt...
6
static void printList(final PrintWriter pw, final List l) { for (int i = 0; i < l.size(); ++i) { Object o = l.get(i); if (o instanceof List) { printList(pw, (List) o); } else { pw.print(o.toString()); } } }
2
public static void removeCols(JTable paymentTable) { TableColumnModel tcm = paymentTable.getColumnModel(); System.out.println("getColumnCount:" + tcm.getColumnCount()); if (tcm.getColumnCount() == 13) { paymentTable.removeColumn(tcm.getColumn(12)); } if (tcm....
4
public void useSkillEx(SkillBarSkillSlot skillSlot, int targetId, int delay) throws IOException { LOG.debug("Using skill in slot {} on target {}", skillSlot, targetId); //FIXME: why isn't the delay used???? if (this.isDead(-2)) { LOG.debug("The player is dead"); return; ...
8
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 server with glorious data task = plugin.getServer().getScheduler().runTaskTimerAsynchronous...
7
public void setupAttribLists() { String [] tempAttribNames = new String[m_data.numAttributes()]; String type; m_classAttrib.removeAllItems(); for(int i=0; i<tempAttribNames.length; i++) { switch (m_data.attribute(i).type()) { case Attribute.NOMINAL: type = " (Nom)"; break; case Attr...
7
public StackManipStmt(final StackExpr[] target, final StackExpr[] source, final int kind) { this.kind = kind; this.target = target; for (int i = 0; i < target.length; i++) { this.target[i].setParent(this); } this.source = source; for (int i = 0; i < source.length; i++) { this.source[i].setParen...
2
public boolean isIntersectingEnemy(EnemyObject enemy){ Rectangle2D.Double r = new Rectangle2D.Double(me.getX(), me.getY(), 20, 20); Ellipse2D.Double e = new Ellipse2D.Double(enemy.getX(), enemy.getY(), 20, 20); return e.intersects(r); }
0
public void testCircleEquation() { CircleEquation equation = CircleEquation.newInstance(0, 0, 5); assertEquals(Math.acos(3.0f / 5.0f), equation.getT(3), 0.01f); }
0
public void setAllLedStatesToRepresentInputValue() { for (LED led : ledArray) { led.setState(LED.OFF); } // if input value is less than lowest step, no leds are lit if (highestLitLedIndex == -1) { return; } for (int i = 0; i < ledArray.length; i++) { ...
4
private static float getFloatValueForByteBinaryString(String bits) { if (bits.matches("[01]{8}")) { int sign = 1; if (bits.charAt(0) == '1') { sign = -1; } float result = 0f; int exponent = getExcessThreeValue(bits.substring(1, 4)); ...
7
protected String getClientInput(){ String input = ""; //Try to read input from client. try{ if(clientInput.ready()){ input = clientInput.readLine(); } } catch (IOException e) { System.out.println("Error reading from client " + user.getName() + "(" + user.getIP() + ")."); e.printSta...
2
public String getName() { return name; }
0
public void printGrid() { for(int i = 0; i < width + 2; i++) System.out.print("_"); System.out.println(); for(int y = 0; y < height; y++) { System.out.print("|"); for(int x = 0; x < width; x++) { if(grid[x][y] instanceof EmptyTile) System.out.print(" "); else if(grid[x][y] instance...
6
@Override public void run() { while(Running) { for(Room mRoom : Grizzly.GrabHabboHotel().GrabRoomHandler().GrabPopulatedRooms().values()) { mRoom.Tick(); } try { Thread.sleep(500); } catch (InterruptedException e) {} } }
3
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
9
@Override public void characters(char[] ch, int start, int length) throws SAXException { if (tag == null || Tags.MESSAGE == tag) { return; } valueTag = new String(ch, start, length).trim(); }
2
private static void logToDetailsHTMLFile(UniProtEntry uniProtEntry) { StringBuffer sb = new StringBuffer(); sb.append("<html>"); sb.append("<body>"); sb.append("<table border=\"1\">"); sb.append("<tr><td>\r\n"); //String imageTag = ncbiDownloadManager.getProteinImage(uniProtE...
8
public static int runToNextInputFrameLimit(int move, int limit) { if ((move & 0b00001111) == 0) { return runToNextInputFrameHiLimit(limit) ? 1 : 0; } else if ((move & 0b11110000) == 0) { return runToNextInputFrameLoLimit(limit) ? 1 : 0; } else { return runToNextInputFrameHiLoLimit(limit); ...
4
public int getArmorClass() { Integer armorClass = 10; Slot armor_slot = slots.get("armor"); Slot shield_slot = slots.get("weapon1"); Item item_a = null; Item item_s = null; if( armor_slot != null ) item_a = armor_slot.getItem(); if( shield_slot != null ) item_s = shield_slot.getItem(); Shi...
9
public static int[][] generateSudoku(int size, int numbers) { final int S = size * size; final int[][] array = new int[S][S]; final Random r = new Random(); // int x = r.nextInt(S); final int x = 0; for (int i = 0; i < S; i++) { for (int j = 0...
9
void selectStatement() { ArrayList<Condition> conditions = new ArrayList<Condition>(); ArrayList<String> columnNames = new ArrayList<String>(); Table table2 = new Table(new String[]{}); Table result; _input.next("select"); String column = columnName(); columnName...
7
public T peek() throws NoSuchElementException { T returnValue; try { return heap.get(0).item; } catch (IndexOutOfBoundsException npe) { throw new NoSuchElementException(); } }
1
public UriParseResult(final Uri uri) { //uri formats: //content://[authority] for general queries //content://[authority]/[tables] for table specific queries //content://[authority]/[table]/[id] for entity specific queries //check if authority matches if (!authority.equals(uri.getEncodedAuthority())...
5
public String[][] retrieveRows(String table, double limit, String regExp, String[][] tags, String[][] attributes, String[] columns, String[][] values, String[] doubleColumns, Double[][] doubleValues, double[][] range, String cursorName) throws MobbedException { validateTableName(table); validateColumns(col...
7
@Override public boolean equals(Object obj) { if (obj != null && obj.getClass().equals(Card.class)) { if (this.ID == null || ((Card) obj).ID == null) { Debug.p("Comparing cards with null ID!", Debug.W); return false; } else { return thi...
4
public void bombbrick(int c, int r) { int remove = 1; for (int i = c - remove; i <= c + remove; i++) { for (int j = r - remove; j <= r + remove; j++) { if (i >= 0 && i < bricks.length && j >= 0 && j < bricks[0].length) { bricks[i][j].state = false; } } } }
6
public void drawOutput(Graphics2D g, OutputConnector op) { int[] xs = null, ys = null; if (op.pos == Position.right) { xs = new int[] { x + width - connectorSize / 2, x + width + connectorSize / 2, x + width - connectorSize / 2 }; ys = new int[] { y + height / 2 - connectorSize / 2, y + height ...
5
public void sort(Map map){ for(int i = 0; i < map.getIDList().length; i++){ for(int j = i+1; j < map.getIDList().length; j++){ if(map.getIDList()[i] > map.getIDList()[j]){ swap(i, j); } } } }
3
protected void toXMLImpl(XMLStreamWriter out) throws XMLStreamException { out.writeStartElement(getXMLElementTagName()); out.writeAttribute(ID_ATTRIBUTE, getId()); if (transport != null) { if (transport.getUnit() == null) { logger.warning("transport.getUnit() == nul...
8
@Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("|"); for (T i: filter) { sb.append(i.toString()).append("|"); } return sb.toString(); }
1
public void inboundTrainInfoOutput(){ try { jxl.Workbook readWorkBook = jxl.Workbook.getWorkbook(new File("outputFile.xls")); //唯讀的Excel工作薄物件 jxl.write.WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File("outputFile.xls"), readWorkBook); //要寫入的路徑以及檔名 jxl.write.WritableSheet writeSheet = wri...
7
public static final String vfsifyFilename(String filename) { filename=filename.trim(); if(filename.startsWith("::")) filename=filename.substring(2); if(filename.startsWith("//")) filename=filename.substring(2); if((filename.length()>3) &&(Character.isLetter(filename.charAt(0)) &&(filename.charAt(1)==...
9
public int numDecodings(String s) { if (s == null || s.length() == 0) return 0; if (s.charAt(0) == '0') return 0; if (s.length() == 1) return 1; if (s.length() == 2) { if (s.charAt(1) == 0) return 1; else if (Integer.parseInt(s.substring(0, 2)) > 26) return 1; else return 2; } ...
9
public returnTypes deleteAllChunks(byte[] fileID) { String recID = Packet.bytesToHex(fileID); boolean found = false; for(BackupChunk chunk : backedUpChunks) { String comID = Packet.bytesToHex(chunk.getFileID()); if(comID.equals(recID)) { String filepath = "storage/"; filepath += chunk.getFilename();...
5
public int[] getRange(){ if (mRange != null){ return mRange; } mRange = new int[2]; boolean isFirst = true; for (Map.Entry<Integer, Integer> entry : mHistorgram.entrySet()) { if (isFirst) { isFirst = false; mRange[0] = mRang...
5
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed int row = jTable2.getSelectedRow(); int opc = select1.getSelectedIndex(); jLabel3.setText(""); if (avaliacoes_vendas.size() > 0 && opc == 1 && row != -1) { AvVenda av = (AvVenda) avaliacoes_vendas....
9
public static void drawMainMenu() { // Clear the last screen GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Turn off lighting GL11.glDisable(GL11.GL_LIGHTING); // Enable alpha testing (transparent backgrounds) GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11....
6
public void runControlServer() { try { controlServerSocket= new ServerSocket(controlDataSocketNumber); this.changeServerType(); while(true) { controlSocket = controlServerSocket.accept(); controlInput = new ObjectInputStream(controlSocket.getInputStream()); ClientMessage c = (ClientMessage...
7
private long updateRewrite(Master master, File f, Location accessLoc, int rewriteCount) { MasterMeta fm = null; if (master.map.containsKey(f.getId())) { fm = master.map.get(f.getId()); } else { fm = new MasterMeta(f); master.map.put(f.getId(), fm); } int cCount = master.clusters.s...
8
@Override public void run() { for(int i=0; i<25; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("name->" + info.getName() + " age->" + info.getAge()); } }
4
public Long getId() { return id; }
0
public RuleAdaptor(RuleMatcher<T> matcher) { if (matcher == null) { throw new IllegalArgumentException( "The given filter must not be null."); } this.matcher = matcher; }
1
public void displayQuestions(String urls) throws IOException { URL url = getClass().getResource(urls); BufferedReader reader = new BufferedReader(new InputStreamReader( url.openStream())); contentPane.removeAll(); for (int i = 0; i < 4; i++) { label[i] = new JLabel(reader.readLine()); //display fi...
9
private void rdepth(Graph<VLabel, ELabel> G, Stack<Graph<VLabel, ELabel>.Vertex> fringe) { if (fringe.isEmpty()) { return; } Graph<VLabel, ELabel>.Vertex curr = fringe.pop(); try { if (marked.contains(curr)) { return; } ...
6
@Test public void testConnection() { Connection con = null; Statement st = null; ResultSet rs = null; try { con = DriverManager.getConnection(DatabaseSetup.HOST, DatabaseSetup.USER, DatabaseSetup.PASSWORD); st = con.createStatement(); rs = st.exec...
6
public static void main(String[] args) throws NumberFormatException, UnknownHostException { if (args.length > 1) { usage(); return; } // null server address means bind to everything local InetAddress serverAddress = null; int port = NGConstants.DEFAULT_PORT; // parse the sole command line paramet...
9
synchronized Object getPkgProperty(String name, Scriptable start, boolean createPkg) { Object cached = super.get(name, start); if (cached != NOT_FOUND) return cached; String className = (packageName.length() == 0) ...
9
public void readFromFile(String file) { try { BufferedReader fin = new BufferedReader( new FileReader((file))); String line; while ((line = fin.readLine()) != null) { line = line.replace("\t", ""); String side[] = line.split("->"); List<String> rhp = null,lhp = null; if( side.length...
9
public static void main(String[] args) { System.out.println("Lancement du test de la Tablier"); // verification de l'initialisation du tablier Tablier tab1 = new Tablier(); System.out.println("TABLIER : "); for(int i=0;i<tab1.getListeCase().size();i++) System.out.println(tab1.getListeCase().get(i).get...
5
@BeforeClass public static void setUpBeforeClass() throws Exception { defaultPhone = new AndroidPhone(); phoneDescription = new HashMap<String, Object>(); phoneDescription.put("name", "Cink Five"); phoneDescription.put("brandName", "Wiko"); phoneDescription.put("screenSize", 5); phoneDescription.put("scr...
8
public static final boolean isAllowedEverywhere(final MOB mob, final SecFlag flag) { if(mob==null) return false; if(isASysOp(mob)) return true; if((mob.playerStats()==null) ||((mob.soulMate()!=null)&&(!mob.soulMate().isAttributeSet(MOB.Attrib.SYSOPMSGS)))) return false; if(mob.playerStats().getSecur...
7
public Shape next() { switch (rand.nextInt(4)) { default: case 0: return new Circle(); case 1: return new Square(); case 2: return new Triangle(); //for ex4 case 3: return new Rectangle(); } }
4
* @param maskImage image mask to be applied to base image. */ private static void applyExplicitMask(BufferedImage baseImage, BufferedImage maskImage) { // check to see if we need to scale the mask to match the size of the // base image. int baseWidth = baseImage.getWidth(); int ...
6
public void dropRoster(Integer rosterID, javax.swing.TransferHandler.DropLocation dropLocation) { TripComponent tc = tripList.getSelectedValue(); if (tc == null) { tc = new TripComponent (MainWindow.tripDB.add ( targetDay.getTime() )); tripListModel.addElement (tc); } tc.getTrip().addRoster(MainWindow.ros...
1
public int buildDistribution(int[] bowl, int bowlId, int round) { std_dev = 0; int bowlScore=0; for (int i = 0; i < 12; i++) { fruits[i] += (double)(bowl[i])/2; bowlScore = bowlScore + (bowl[i]*preferences[i]); dist[i]+=bowl[i]/2.0; } double mean = 0; for(int i=0;i<scoresSeen.siz...
3
public static String printStream(HttpURLConnection conn){ BufferedReader responseBuffer; String output, response = null; try { responseBuffer = new BufferedReader(new InputStreamReader((conn.getInputStream()))); while ((output = responseBuffer.readLine()) != null) { response=output; System.out.p...
2
public int numDistinct(String S, String T) { int a = S.length(); int b = T.length(); if (a <b) { return 0; } int[][] tem = new int [a][b]; for (int i = 0;i<a;i++) for (int j=0;j<b;j++) tem[i][j] = 0; if (S.charAt(0) == T.cha...
9