text
stringlengths
14
410k
label
int32
0
9
static long Evclid(long a, long b) { long mult = a * b; while (a != 0 && b != 0) { if (a >= b) { a = a % b; } else { b = b % a; } } long NOK = (mult / (a + b)); return NOK; // Одно - ноль }
3
public void add() throws IOException, JSONException, NullPointerException { try{ long StartTime = System.currentTimeMillis(); String keyvalue = null; if(Table == null) { System.err.println("Table name not set"); } else if(ColumnFamily == null) { System.err.println("Column family not set"); } ...
6
private static void readUnifiedNums(String str, int off, int[] values) throws NumberFormatException { while (str.charAt(off) == ' ' || str.charAt(off) == '-') off++; int end = str.indexOf(CONTEXT_MARK_DELIMETER, off); if (end > 0) { values[0] = Integer.parseInt(str.substring(off, end...
8
@BeforeClass public static void setUpClass() { }
0
double residualCapacityTo(int vertex) { if (vertex == v) return flow; // backward edge else if (vertex == w) return capacity - flow; // forward edge else throw new IllegalArgumentException(); }
2
public String genKeywords(){ if(keywords.size() > 0){ StringBuffer impKeywords = new StringBuffer(); Iterator<String> i = this.keywords.iterator(); while(i.hasNext()) { impKeywords.append(i.next()); if(i.hasNext()) impKeywords.append(","); } return impKeywords.toString(); } return null; }
3
public static Iterator allDirectSupercollections(LogicObject self, boolean performfilteringP) { if (Stella_Object.isaP(self, Logic.SGT_LOGIC_DESCRIPTION)) { Description.deriveDeferredSatelliteRules(((Description)(self))); } { Iterator directlylinkedobjects = Logic.allDirectlyLinkedObjects(self, Logic....
7
public static void main(String args[]) { Servidor servidor = new Servidor(PUERTO); Cliente cliente = null; String ip = ""; try { servidor.conectar(); System.out.println("Conectado"); while (servidor.estaConectado()) { cliente = new Cliente(servidor.escuchar(),servidor); cliente.se...
2
public SkiPass getFirstHalfDaySkiPass(Date currentDate) { if (currentDate == null) { throw new IllegalArgumentException("Current date is null"); } Calendar calendar = new GregorianCalendar(); calendar.setTime(currentDate); calendar.set(Calendar.HOUR_OF_DAY, 9); ...
2
public void newArray(final Type type){ int typ; switch(type.getSort()) { case Type.BOOLEAN: typ = Opcodes.T_BOOLEAN; break; case Type.CHAR: typ = Opcodes.T_CHAR; break; case Type.BYTE: typ = Opcodes.T_BYTE; break; case Type.SHORT: typ = Opcodes.T_SHORT; break; case Type.INT: typ...
8
public void shoot() { if (readyToFire) { Projectile p = new Projectile(centerX + 50, centerY - 25); projectiles.add(p); } }
1
public void paint(Graphics2D g) { if(animated) g.drawImage(game.bitmapFact.getEntityImage(name + animFrame), drawX, drawY, null); else g.drawImage(game.bitmapFact.getEntityImage(name), drawX, drawY, null); if(game.getDevMode()) g.drawRect(drawX, drawX, getBounds().width, getBounds().hei...
2
public static LinkedList<String> computeDifference(LinkedList<String> A, LinkedList<String> B) { LinkedList<String> diff = new LinkedList<String>(); for(int i =0; i<A.size(); i++) { String item = A.get(i); if(!B.contains(item)) { diff.add(i...
2
public static void main(String[] args) throws Exception { HashMap<String, Integer> barcodeMap = getBarcodeToSampleMap(); HashMap<String, Integer> expectedMap = getExpectedSubjectID(); System.out.println("got " + expectedMap.size()); BufferedReader reader = new BufferedReader(new FileReader(new File( Conf...
9
private JTable initTable() { JTable table = null; if (numberOfUsers == 3) { titels = new Object[4]; titels[0] = ""; inhalt = new Object[20][4]; } if (numberOfUsers == 4) { titels = new Object[5]; titels[0] = ""; inhalt = new Object[15][5]; } if (numberOfUsers == 5) { titels = new Object...
8
public static File getLauncherDir() { File dir = null; File root = new File(System.getProperty("user.home", ".") + "/"); final String appName = "mclauncher"; switch (SystemUtils.getSystemOS()) { case linux: case solaris: ...
8
public Account getNewAccount() { return new HumanAccount(); }
0
private void parsejButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_parsejButtonMouseClicked // long startTime = System.currentTimeMillis(); if (selectedCheckboxCount == 0) { JOptionPane.showMessageDialog(null, "至少要选择一个语言", "信息提示", JOptionPane.ERROR_MESSAGE); r...
8
public void paintShape(Graphics2D g2) { Dimension dim = label.getPreferredSize(); // System.out.println(dim); if (dim.width > 0 && dim.height > 0) { label.setBounds(0, 0, dim.width, dim.height); g2.translate(getX(), getY()); g2.scale((image....
2
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public String KonversiKwitansi (double doubleAngka){ String [] bil ={"","satu","dua","tiga","empat","lima","enam","tujuh","delapan","sembilan","sepuluh","sebelas"}; String x=" "; int intAngka = (int) doubleAngka; if (doubleAngka<12){ x = " " + bil[intAngka]; } else i...
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target==null) return false; if(target.fetchEffect(ID())!=null) { mob.tell(targ...
9
void setSelectionForeground () { if (!instance.startup) { tabFolder1.setSelectionForeground(selectionForegroundColor); } // Set the selection foreground item's image to match the foreground color of the selection. Color color = selectionForegroundColor; if (color == null) color = tabFolder1.getSelectionFor...
3
protected <R> R openStatement(final Connection db, JdbcCallback<R> callback, Sql sql) { PreparedStatement stmt = null; try { stmt = db.prepareStatement(sql.toSql()); return callback.connected(stmt); } catch (SQLException e) { throw new Runt...
3
public void renderMiniMapResources(Graphics g, int mx, int my, int cx, int cy, int w, int h, int x, int y, String resourceName) { HashMap<String, Resource> rs = new HashMap<String, Resource>(resources); Resource resource = null; int[] xy = null; try { for (String key : rs.ke...
8
public static void main (String args[]) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(reader.readLine()); int currentOperation; int currentNumber; boolean isQueue; StringTokenizer st; for (int i=0; i<t; i++) { isQueue = true; ...
5
protected void detect() { monitor.println("\nDerivation length: " + length); AbstractWorker workerPool[] = new AbstractWorker[workers]; startTime = System.currentTimeMillis(); Job j = new Job(length, newStackFrame(dfa.startState)); // have one worker hand out a predefined number of jobs AbstractWorker ...
9
@Override public boolean isFull() { for (int i = 0; i < buffer.length; ++i) { if (buffer[i] == null) { return false; } } return true; }
2
static public Direction getDirectionFromString(String str) { if (str.equals("UP")) { return UP; } else if (str.equals("DOWN")) { return DOWN; } else if (str.equals("LEFT")) { return LEFT; } else if (str.equals("RIGHT")) { ...
5
public boolean searchMatrix(int[][] matrix, int target) { // Note: The Solution object is instantiated only once and is reused by each test case. if(matrix==null || matrix.length==0) return false; int low = 0, high = matrix.length-1; while(low<high){ int mid = (lo...
9
private void applyGamma(Delta currentDelta, ASTNode node, Environment currentEnv, Stack<ASTNode> currentControlStack){ ASTNode rator = valueStack.pop(); ASTNode rand = valueStack.pop(); if(rator.getType()==ASTNodeType.DELTA){ Delta nextDelta = (Delta) rator; //Delta has a link to the env...
9
@Override public void run() { if (Updater.this.url != null && (Updater.this.read() && Updater.this.versionCheck(Updater.this.versionName))) { // Obtain the results of the project's file feed if ((Updater.this.versionLink != null) && (Updater.this.t...
6
public void addPoly(List<Position> coords, String tooltip) { Polygon shape = new Polygon(coords); shape.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND); shape.setAttributes(attrPoly); if (tooltip != null) { shape.setValue(AVKey.HOVER_TEXT, "hover: " + tooltip); shap...
1
private Object openInputGUI(final Component component, String title, final int tapes) { // TODO Auto-generated method stub JPanel panel; JTextField[] fields; //for FA, PDA if (tapes==0) { panel = new JPanel(new GridLayout(3, 1)); fields = new JTextField[1]; for (int i = 0; i < 1; i++) { pane...
7
private List<Repository> getRepositories(final String organizationName) throws IOException { try { return repoListCache.get(organizationName, new Callable<List<Repository>>() { @Override public List<Repository> call() throws IOException { logger.l...
3
private void initComponents() { JMenuBar menuBar1 = new JMenuBar(); JMenu menu1 = new JMenu(); JMenuItem menuItem1 = new JMenuItem(); pauseButton = new JButton(); JButton stopButton = new JButton(); JButton screenshotButton = new JButton(); JButton resetButton = n...
3
public void addZombieAtCanvasLocation(int canvasX, int canvasY) { // FIRST MAKE SURE THE ENTIRE INTERSECTION IS INSIDE THE LEVEL if ((canvasX - 17.5) < 0) return; if ((canvasY - 17.5) < 0) return; if ((canvasX + 17.5) > viewport.levelWidth) return; if ((canvasY + 17.5) > view...
6
public double getMeasure(String measureName) { if (measureName.equals("measureExtraArcs")) { return measureExtraArcs(); } if (measureName.equals("measureMissingArcs")) { return measureMissingArcs(); } if (measureName.equals("measureReversedArcs")) { return measureReversedArcs(); ...
9
static public Object getLowestDegreeVertex(mxAnalysisGraph aGraph, Object[] omitVertex) { Object[] vertices = aGraph.getChildVertices(aGraph.getGraph().getDefaultParent()); int vertexCount = vertices.length; int lowestEdgeCount = Integer.MAX_VALUE; Object bestVertex = null; List<Object> omitList = null; ...
6
public void swap(String name, String name2) { int one; String oneTemp = ""; for(one = 1; one< getCount(); one++){ if(get(one).endsWith(name)){ oneTemp = get(one); list.remove(one); break; } } int two; String twoTemp = ""; for(two = 0; two< getCount(); two++){ if(get(two).endsWith(name...
4
private void newPassword() { JPasswordField cPass = new JPasswordField(); JPasswordField nPass = new JPasswordField(); JPasswordField qPass = new JPasswordField(); JOptionPane.showConfirmDialog(null, cPass, "Enter current password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); JOptionPane.show...
3
public ArrayList<Actor> getObjectsInRect(Rectangle rect, Class<? extends Actor> actorClass) { ArrayList<Actor> objectsAtPosition = new ArrayList<>(); for (Actor actor : actorList) { if(actor.getClass().isAssignableFrom(actorClass)) continue; if(acto...
4
public int longestValidParentheses_4(String s) { // DP solution, take advantage of the computed DP value, it is the distance to the index we want to look at int [] DP = new int[s.length()]; int res = 0; for(int i = 0; i < DP.length; ++i){ if(s.charAt(i) == ')' && i > 0){ int j = i - 1 - DP[i-1]; if(j >...
6
public boolean generate(World world, Random random, int x, int y, int z){ for (int l = 0; l < 64; ++l){ int i1 = x + random.nextInt(8) - random.nextInt(8); int j1 = y + random.nextInt(4) - random.nextInt(4); int k1 = z + random.nextInt(8) - random.nextInt(8); if (world.isAirBlock(i1, j1, k1) && this.bloc...
3
public static void main (String[] args) throws IOException { File file = new File("C:/1.txt"); BufferedReader in = new BufferedReader(new FileReader(file)); String line; int sum = 0; while ((line = in.readLine()) != null) { String[] lineArray = line.split("\n"); if (lineArray.le...
2
String anonymizeString(String input,String nameToBeAnonymized) { //extract name terms String nameTerms[] = nameToBeAnonymized.split(" "); String textTerms[] = input.split(" "); String output = null; //go through input, replace name term sequences with substitute boolean lastTermWasName = false; for(int ...
8
private Map<String, int[]> generateRewardTable(GemEventReward rewards) { ArrayList<Integer> levels = new ArrayList<Integer>(rewards.getLevels()); Collections.sort(levels); Map<String, int[]> table = new HashMap<String, int[]>(); boolean hasBonusGem = false; Iterator<Integer> levelIter = levels.iterator(); // sca...
8
public void writeLine(String s) throws IOException { for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); switch (c) { case '\\': super.write("\\\\"); break; case '\t': ...
8
static final public Map<String, Object> asNestedMap(Map<? extends Object, ? extends Object> flattenMap){ Map<String, Object> nestedPropMap = new HashMap<>(); Map<String, Map<String,Object>> mapByPath = new HashMap<>(); for (Map.Entry entry : flattenMap.entrySet()){ Object keyObj = entry.getKey(); String k...
9
public void refreshImg(RefreshEvent event) { WorldModel wm = (WorldModel)event.getSource(); int win = wm.getWin(); switch (win) { case -1: this.imgButton.setImg(GraphicalGameView.loseImg); break; case 0: this.imgButton.setIm...
3
@Test(expected = ImpossibleSolutionException.class) public void test_singular_matrix_solve() throws ImpossibleSolutionException,UnsquaredMatrixException, ElementOutOfRangeException{ int height=2; int width=2; System.out.print("Testing singular matrix solve m...
3
public static void main(String[] args) { for(char c = 0; c < 128; c++) if(Character.isLowerCase(c)) System.out.println("value: " + (int)c + " character: " + c); }
2
private ArrayList<Worker> jobWorkers(String job, Day day, ArrayList<String> workersWorking) { ArrayList<Worker> workersForJob = new ArrayList<Worker>(); for (Worker worker : this.workerIndices.get(this .numForName(day.getNameOfDay()))) { Day workerDay = worker....
3
public static final int StateUpdateShortRep(int index) { return index < 7 ? 9 : 11; }
1
@SuppressWarnings("unchecked") protected T findOneResult(String namedQuery, Map<String, Object> parameters) { T result = null; try { Query query = manager.createNamedQuery(namedQuery); // Method that will populate parameters if they are passed not null and empty if (parameters != null && !parameters.isE...
4
public String toString() { return "waiting for user to start the game"; }
0
public boolean leaveMessage(Info info) { String message = info.getMessage(); String sender = info.getSender(); String channel = info.getChannel(); String stripped = message.substring( message.indexOf(" ") ).trim( ); int breakpt = stripped.indexOf( ' ' ); String who ...
9
public int getMossaMinAvvicinando(){ int minAvv = 16; if(desmosse!=null) //Trovo il minimo tra i vmax for(DescrittoreMossa dm : desmosse) if(dm!=null && dm.getAvvicinando()<minAvv && dm.getAvvicinando()!= -1) minAvv = dm.getAvvicinando(); //Restituisco il vmin se è valido return minAvv!=16?m...
6
public BTXEvent next() throws IOException { ParseEventData cur = eventStack; if (cur == null) { // If there's nothing left in the stack, we're at the end of the file! return BTXEvent.EOF; } if (cur.attrsLeft > 0) { cur.attrsLeft--; cur.curAttr = BTXHelp_0.readAttribute(f); return BTXEvent.ATTR...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; EdgeMarker other = (EdgeMarker) obj; if (_source == null) { if (other._source != null) return false; } else if (!_source.equals(other._s...
9
private boolean canHaveAsTeleporter(Position pos) { return pos != null && grid.getElementsOnPosition(pos).isEmpty(); }
1
public TileColor getLeft(TileColor top){ TileColor[] whiteL = {red,blue,orange,green}; TileColor[] blueL = {red,yellow,orange,white}; TileColor[] redL = {blue,white,green,yellow}; TileColor[] L = {}; if(top.equals(white)){ L = whiteL; } else if(top.equals(blue)){ L = blueL; } else if(top.equals(red)...
8
private void delete(File file) throws Exception { File[] inners = file.listFiles(); if (null != inners && inners.length > 0) { for (File inner : inners) { delete(inner); } } if (!file.delete()) { throw newIOException(file); } }
4
public void begin() { started = System.currentTimeMillis(); }
0
private void order(int start, int end) { if(start >= end) return; int separatorPos = divide(start, end); order(start, separatorPos - 1); order(separatorPos + 1, end); }
1
private static String LoadShader(String fileName) { StringBuilder shaderSource = new StringBuilder(); BufferedReader shaderReader = null; final String INCLUDE_DIRECTIVE = "#include"; try { shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName)); String line; while((line = sh...
3
private void setParameterValue(final PreparedStatement ps, final List<Object[]> argsList, int idx) throws SQLException { Object[] args = argsList.get(idx); if (args != null) { for (int index = 0; index < args.length; index++) { Object arg = args[index]; JdbcUtils.setParameterValue(ps, index + 1, arg);...
2
public ItemEditor(int ID) { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); System.setProperty("resources", System.getProperty("user.dir") + "/resources"); this.ID = ID; setTitle("Item Editor"); setBounds(100, 100, 600, 500); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new E...
6
* * @throws UnknownHostException if cyc server host not found on the network * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public CycConstant makeCycConstant(String name) throws UnknownHostException, IOExc...
3
@Override public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) throws HTTPServerException { if(!CMProps.getBoolVar(CMProps.Bool.MUDSTARTED)) return "false;"; if(!initialized) { initialize(); } if((httpReq.getHeader("upgrade")!=null) &&("websocket".equalsIgnoreCase(httpR...
9
public String toString() { String listArray = ""; for(int index = 0; index < manyItems; index++) { listArray += String.valueOf(data[index])+ ","; } /* WONG VERSION for(int index = 0; index < data.length; index++) { listArray += String.valueOf(data[index]) + "\n"; } */ return "{"+ listArr...
1
public void siteUnreachable(String site) { lock.lock(); try { for(Map.Entry<Address,Rsp<T>> entry : rsps.entrySet()) { Address member=entry.getKey(); if(!(member instanceof SiteAddress)) continue; SiteAddress addr=(SiteAddre...
8
@Override public void executeTask() { try { sendingSocket = new DatagramSocket(SENDING_PORT); sendingSocket.setBroadcast(true); client = new Client(); client.setCurrentIP(InetAddress.getLocalHost().getHostAddress()); client.setHostname(InetAddress.getLocalHost().getHostName()); client.setReceiving...
5
@Override protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); container.setLayout(null); txtBalance = formToolkit.createText(container, "New Text", SWT.NONE); txtBalance.setBounds(8...
7
public void redo() { revising = true; if (!TEXT_FUTURE.isEmpty()) { String restoreText = TEXT_FUTURE.pop(); TEXT_HISTORY.push(restoreText); textLower.setText(restoreText); // gui.TEXT_HISTORY.tailMap(fromKey) } }
1
public static List<Player> getNearbyPlayers(Location l, int range) { List<Player> players = new ArrayList<Player>(); for (Entity e : getNearbyEntities(l, range)) { if (e instanceof Player) { players.add((Player) e); } } return players; }
2
protected void initialize() {}
0
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Article other = (Article) obj; if (!Objects.equals(this.id, other.id)) { return false; ...
7
public int getDestinationEnd() { return this._destinationEnd; }
0
public void purgeOperation() { try { Iterator iterator = mapTtl.keySet().iterator(); String key = null; Date expTime; Date currentTime = new Date(); while (iterator.hasNext()) { key = (String) iterator.next(); expTime = (Date) mapTtl.get(key); if(expTime==null) { continue; } i...
6
public static TreeNode lowestCommonAncestor(TreeNode root, TreeNode a, TreeNode b) { TreeNode left = null; TreeNode right = null; if (root == null || root == a || root == b) { return root; } left = lowestCommonAncestor(root.left, a, b); right = lowestCommonAncestor(root.right, a, b); if (left != nul...
7
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public static float getFovX() { return fovX; }
0
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { calculateEnabledState(e.getDocument()); }
0
public Rank getFourthRank() { return (ranks.size() < 4 ? Rank.Null : ranks.get(3)); }
1
public boolean isChar(int token) { return (token == 0x09 || token == 0x0A || token == 0x0D || token >= 0x20 && token <= 0xFF); }
4
@Test public void testGetHig() { System.out.println("getHig"); assertEquals(3.0, new Cylinder(3,1,2.8).getHig(), 0.00001); }
0
public void exitRoutine() { boolean exit = true ; TGlobal.config.setDirectInt( "mainWidth", this.getWidth() ) ; TGlobal.config.setDirectInt( "mainHeight", this.getHeight() ) ; // ask - save data ? if ( TGlobal.projects.isProjectChanged() ) { int result = JOptionPane.showConfirmDialog( ...
4
@Override public BMPImage apply(BMPImage image) { Filter grey = new Grey(); image = grey.apply(image); BMPImage filteredImage = new BMPImage(image); BMPImage.BMPColor[][] bitmap = image.getBitMap(); BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap(); for...
4
public boolean handleRightClick(Point clickPoint) { HUD hud = null; boolean doUpdate = !gameController.getIsMasterPaused(); //start from the top and work our way down to "layer" the huds for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); if (doUpd...
6
@Override public boolean containsValue(Object value) { String key = (String) value; boolean res = false; for (Map.Entry<String, String> e : entries) { if (key == null) { if (e.getValue() == null) { res = true; break; } } else if (key.equalsIgnoreCase(e.getValue())) { r...
4
public void print() { // check if read in if(!treeHeader.isHeaderOK()){ int badMagic = treeHeader.getMagic(); log.error("Error reading B+ tree header: bad magic = " + badMagic); return; } // print B+ tree header treeHeader.print(); // pr...
2
public void signAndSaveMessage(String message) { // die Nachricht als Byte-Array byte[] msg = message.getBytes(); Signature rsaSig = null; byte[] signature = null; try { // als Erstes erzeugen wir das Signatur-Objekt rsaSig = Signature.getInstance("SHA1wi...
5
private boolean versionCheck(String title) { if (type != UpdateType.NO_VERSION_CHECK) { String version = plugin.getDescription().getVersion(); if (title.split(" v").length == 2) { String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get // the // newest // file's // version // n...
6
* * @throws UnknownHostException if cyc server host not found on the network * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public CycObject converseCycObject(Object command) throws UnknownHostException, IO...
2
public void actionPerformed(ActionEvent ae) { double x = 0.0, y = 0.0; Double d; try { d = new Double(eastings.getText()); x = d.doubleValue(); } catch (NumberFormatException nfe) { eastings.setText("0"); x = 0.0; } try { d = new Double(northings.getText()); y = d.doubleValue(); } catc...
6
public static URI loadResourceAsUri(String resourcePath) { URI resourceAsURI = null; if(resourcePath.startsWith("/")){ try { resourceAsURI = loadResourceAsURL(resourcePath).toURI(); } catch (URISyntaxException e) { e.printStackTrace(); } return resourceAsURI; }else{ System.err.println("A re...
2
public void test_09() { // Create pvalues ScoreList pvlist = new ScoreList(); int max = 1000; for (int i = 0; i < max; i++) { double quantile = ((double) i) / max; pvlist.add(quantile); } // Test for (int i = 0; i < max; i++) { double quantile = ((double) i) / max; double pval = pvlist.cdf(q...
2
public Projectile(float x, float y, boolean goingUp, boolean friendly) { super(TextureManager.loadTexture(friendly ? PROJECTILE_TEX : PROJECTILE_TEX_ENEMY), "none", x, y, PROJECTILE_WIDTH, PROJECTILE_HEIGHT); if(goingUp) { this.velocity.y = PROJECTILE_VEL; } e...
4
@Override public boolean equals(Object other) { if (other == this) return true; if (other == null || other.getClass() != this.getClass()) return false; final Position pos = (Position) other; return this.xCoordinate == pos.xCoordinate && this.yCoordinate == pos.yCoordinate; }
4