text
stringlengths
14
410k
label
int32
0
9
public Header readFrame() throws BitstreamException { Header result = null; try { result = readNextFrame(); // E.B, Parse VBR (if any) first frame. if (firstframe == true) { result.parseVBR(frame_bytes); firstframe = false; } } catch (BitstreamException ex) { if ((ex.getErrorCo...
6
public void insert(Person person) { if (isAlmostFull()) { doubleArraySize(); } personArray[queueSize] = person; personArray[queueSize].setPosition(queueSize); queueSize++; }
1
public void testSubtract() { System.out.println("From Subtract Test !"); }
0
@Override public synchronized void removeFromFloor(ElevatorInterface elevatorToEnter, Direction directionToGo) { if(directionToGo != Direction.IDLE) { ArrayList<Person> peopleToRemove; if(directionToGo == Direction.UP) { peopleToRemove = this.goingUp; } else { peopleToRemove = this.goin...
8
private void setRemoteServerConnection(IRemoteServerConnection rsc) { if (rsc == null) { throw new IllegalArgumentException("aRemoteServerConnection is null"); } this.remoteServerConnection = rsc; }
1
public void readFunction(Element function) throws MaltChainedException { boolean hasSubFunctions = function.getAttribute("hasSubFunctions").equalsIgnoreCase("true"); boolean hasFactory = false; if (function.getAttribute("hasFactory").length() > 0) { hasFactory = function.getAttribute("hasFactory").equalsIgn...
9
protected void defineWorld(int worldType) { world = new HashMap<Position,Tile>(); String[] layout; if ( worldType == 1 ) { layout = new String[] { "...ooMooooo.....", "..ohhoooofffoo..", ".oooooMooo...oo.", ...
8
@Override public void render (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); countdown.update(delta); if(countdown.isDone()){ Objects.playScreen = new PlayScreen(); ld.setScreen(new MainMenu(ld)); } Objects.BATCH.begin(); Objects.FONT.draw(Objects.BATCH, score, Gdx.graphics.getWidth() / 2, ...
1
@Override public void mouseMoved(MouseEvent event) { //System.out.println(event.getX() + " " + event.getY()); int x, y; x = event.getX(); y = event.getY(); if(buttonArea.contains(x, y)) hoverButton = true; else hoverButton = false; if(boundLeft.contains(x, y) || boundRight.contains(x, y) || boundTo...
6
private void parseResponse(String rawResponse, GoogleResponse gr) { if (rawResponse == null || !rawResponse.contains("\"result\"") || rawResponse.equals("{\"result\":[]}")) { return; } if (rawResponse.contains("\"confidence\":")) { String confidence = StringUtil.substringBetween(rawResponse, "\"confidence\"...
7
public static Integer getInteger(final Context context, final int position) { if (position < 0 || context.arguments.size() <= position) return null; if (!Parser.isInteger(context.arguments.get(position))) return null; return Integer.parseInt(context.arguments.get(position)); }
3
public static String getDirectoryName(){ String relativeWdPath,workingDirectory; String inputFileName; //Folder workingDirectory; //Because userHome is a public static field, it can be used without having initialized any instance of Folder: //This because the static variables have their own memor...
5
public static ArrayList<String> selectRecursion(char[] arr, int start, int num, Stack<Character> stack, ArrayList<String> arrayList, boolean print) { if(start == arr.length) { return arrayList; } if(arrayList == null) { arrayList = new ArrayList<String>(); } for(int i=start;i<arr.length;i++) { sta...
8
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPickUpItemIntoLockedSlot(PlayerPickupItemEvent event) { Player player = event.getPlayer(); if (player.hasPermission("disable.slot.locking")) { return; } PlayerInventory inv = player.getI...
8
public Document merge(XPathExpression expression, List<String> excludedTags, Set<String> files) throws ParserConfigurationException, IOException, SAXException, XPathExpressionException { ...
7
private static String trim(String text) { String result = text; if (text != null && text.length() > 0) { int start = 0; int end = text.length(); char firstChar = text.charAt(start); char lastChar = text.charAt(end - 1); if (firstChar == lastChar) { if (firstChar == '\'' || firstChar == '"...
7
private void invokeKrisletAction(DataInstance di, SoccerAction action) { ObjectInfo object; if (action == null) { defaultAction(); } else { switch (action) { case DASH: object = di.getObject("ball"); if (object != null) ...
8
private static String lineFlow(String line, boolean insideTable, boolean isALastLine) { // TODO : documentation if (insideTable == true) { if (line.startsWith("|")) { line = line.substring(1, line.length()); } if (line.endsWith("|")) { ...
9
public void addNewPlayer(String username){ try { cs = con.prepareCall("{call addNewPlayer(?)}"); cs.setString(1, username); cs.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } }
1
public void setArrivalCity(String arrivalCity) { this.arrivalCity = arrivalCity; }
0
public void updatePosition() { if (xPos < xDestination) xPos+=2; else if (xPos > xDestination) xPos-=2; if (yPos < yDestination) yPos+=2; else if (yPos > yDestination) yPos-=2; if (xPos == xDestination && yPos == yDestination) { if (command==Command.GoToSeat) agent.msgAnimationFinishedGoToSea...
9
@Override public boolean afterEpoch(Inference inferenceImpl, Model model, int epoch, double loss, int iteration) { if (averaged) { try { // Clone the current model to average it, if necessary. LOG.info(String.format( "Cloning current model with %d parameters...", ((DPGSModel) model...
9
private void doDeleteTest() { System.out.print("\n[Performing DELETING CHOCOLAT FROM COFFEES] ... "); try { Statement st = conn.createStatement(); st.executeUpdate("DELETE FROM COFFEES WHERE COF_NAME='chocolat'"); } catch (SQLException ex) { System.err.println...
1
public long getMin() { return min; }
0
public ArrayList viewBooking() { ArrayList temp = new ArrayList(); Query q = em.createQuery("SELECT t from BookingEntity t"); for (Object o : q.getResultList()) { BookingEntity p = (BookingEntity) o; System.out.println("viewbooking: reached 1" + userId); if (...
2
private String[] showList(ArrayList<String> players, Integer pageNum) { Iterator<String> it = players.iterator(); String[] str = new String[players.size()]; Integer i = Integer.valueOf(0); while(it.hasNext()) { String play = (String)it.next(); String playJobList ...
7
@Override public boolean isWebDriverType(String type) { return StringUtils.equalsIgnoreCase("ie", type); }
0
@Override public List<String> onTabComplete(CommandSender sender, org.bukkit.command.Command cmd, String label, String[] args) { for (CommandGroup command : commands) { if (command.getName().equalsIgnoreCase(cmd.getName())) { if (args.length > 0) { int command...
6
protected void _toTerminal(String string, int l) { if (l == 0) { System.err.print(string); } else { System.out.print(string); } }
1
private void handle_start(Message msg) { System.out.println("Handle start process cmd!"); // response message prepared! Message response=new Message(msgType.RESPONSE); response.setResponseId(ResponseType.STARTRES); response.setProcessId(msg.getProcessId()); response.setProcessName(msg.getProcessName()); ...
7
public String getParam(String key) { String value = queryData.get(key); if ( value == null ) return ""; return value; }
1
public boolean isUnstyled() { if (font != null) return false; if (rise != 0) return false; if (metrics != null) return false; if (foreground != null) return false; if (background != null) return false; if (fontStyle != SWT.NORMAL) return false; if (underline) return false; if (strik...
9
public void carrega(String arq) { try { ObjectInputStream is = new ObjectInputStream(new FileInputStream(arq)); contaRaiz = (ContaComposite) is.readObject(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { ...
3
private boolean valid() { String clientname = (String) clientBox.getSelectedItem(); Contact _client = Database.driver().getClientsAlphabetically().get(clientname.toLowerCase()); if (clientBox.getSelectedIndex() == 0 || _client == null) { JOptionPane.showMessageDialog(null, "Gelieve ...
6
private void tick() { StringBuilder sb = new StringBuilder(); for (Iterator<Snake> iterator = getSnakes().iterator(); iterator.hasNext();) { Snake snake = iterator.next(); snake.update(getSnakes()); sb.append(snake.getLocationsJson()); if (...
2
public HashMap<String, String> parseXml (String fileName) { try { HashMap<String, String> hmap = new HashMap<>(); DocumentBuilder rBuilder = init(); Document rDoc = rBuilder.parse(fileName); Element root = rDoc.getDocumentElement(); iterativeParseElem...
3
public static long getBanTime(String playerName){ long bantime = 0; if(isBanned(playerName)){ try { SQL_STATEMENT = SQL_CONNECTION.createStatement(); SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM bans WHERE username='" + playerName + "'"); // This loop checks all bans on ...
4
public static String encode(byte[] input) { StringBuilder result = new StringBuilder(); int outputCharCount = 0; for (int i = 0; i < input.length; i += 3) { int remaining = Math.min(3, input.length - i); int oneBigNumber = (input[i] & 0xff) << 16 | (remaining <= 1 ? 0 : i...
6
protected List refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) { List result = new java.util.ArrayList(); result.clear(); Font tickLabelFont = getTickLabelFont(); g2.setFont(ti...
7
public boolean stillRoom() { int zeroCnt = 0; for (int i = 0; i < 6; i++) { for (int n = 0; n < 7; n++) { if (_board[i][n] == 0) { zeroCnt++; } } } if (zeroCnt == 0) { return false; } else { return true; } }
4
private static ChemistryUnit apart(ChemistryUnit unit){ if(unit.getType() == ChemistryUnit.TYPE_BASE){ return unit; } ChemistryUnit unitValue = new ChemistryUnit(); for(Map.Entry<ChemistryUnit, Integer> unitPart : unit.getUnitEntrySet()){ ChemistryUnit unitPartValue = new ChemistryUnit(); ChemistryUnit...
7
@After public void tearDown() { }
0
public static void main(String[] args) { EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation(); starter.initLanguage(new char[] { '0', '1' }, 10, "(0|101|11(01)*(1|00)1|(100|11(01)*(1|00)0)(1|0(01)*(1|00)0)*0(01)*(1|00)1)*"); int solutionFoundCounter = 0; int noSolutionF...
8
public void fusionWithDodgeFullAlpha(CPLayer fusion, CPRect rc) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(rc); for (int j = rect.top; j < rect.bottom; j++) { int off = rect.left + j * width; for (int i = rect.left; i < rect.right; i++, off++) { int color1 = data[off]; int alpha1 = ...
7
public float[] getInput(){ float[] values = new float[2]; values[0] = 0; values[1] = 0; if(Gdx.input.isKeyPressed(Keys.W)){ values[1] += 1; } if(Gdx.input.isKeyPressed(Keys.A)){ values[0] += -1; } if(Gdx.input.isKeyPressed(Keys.S)){ values[1] += -1; } if(Gdx.input.isKeyPressed(Keys.D)){ ...
4
private String getNextWord(String line) { StringBuffer buff = new StringBuffer(line); StringBuffer ret = new StringBuffer(); while ((buff.length() > 0) && Character.isWhitespace(buff.charAt(0))) { buff.deleteCharAt(0); } while ((buff.length() > 0) && !(buff.charAt(0) == ' ')){ if (isEndingPunctuation(bu...
5
static protected void AdjustBuffSize() { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = 0; available = tokenBegin; } else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available...
4
public static void calculateP1(double[] lambda, int[] MAXBUFFER, double mu, int lambdaNum,int bufferNum){ double currentTime = 0; double nextArrivTime; int queueSize = 0; //This is the 'length' in the instructions GEL eventList = new GEL(); Queue<Node> packetQueue = new LinkedList<Node>(); //Queue represents ...
8
public boolean onCommand(CommandSender sender, String[] args) { if(args.length != 1) { return false; } //go through all players to find ours OfflinePlayer[] players = plugin.getServer().getOfflinePlayers(); int total = players.length; boolean found = false; String player = ""; for(int i = 0; i < t...
7
@Override public void endElement(String uri, String localName, String qName) throws SAXException { switch (qName) { case "node": if (convertRoadTypeToInt(roadType) != -1) { edges.add(new Edge(placeNameNode, placeNameNode, conv...
7
@Override public void actionOnPChoice(int choice, int player) { if(victory){ switch(choice){ case PlayersChoices.CHOOSE_THRONE : putInFirstPlace(model.getThrone(), player); end(); break; case PlayersChoices.CHOOSE_BLADE : putInFirstPlace(model.getFiefdoms(), player); updateFiefdom(); ...
7
public boolean isFinished() { if (!canStillMoveToAPosition(getActivePlayer())) return true; for (Player p : players) { for (Player p2 : players) { if (p2 != p && p.getPosition().equals(p2.beginPosition)) return true; } } return false; }
5
public static boolean show(final BookDraggable b) { if (b == null) return false; if (!b.getTab().open()) { return false; } final WidgetChild window = Widgets.get(BookDraggable.BOOK_WIDGET, BookDraggable.CLICK_WINDOW); final WidgetChild wc = b.getChild(); final WidgetChild scrollbar = Widgets.get(BookD...
9
public void setSourceText(String sourceText) { if( !sourceText.equals(AlchemyAPI_LanguageParams.CLEANED_OR_RAW) && !sourceText.equals(AlchemyAPI_LanguageParams.CQUERY) && !sourceText.equals(AlchemyAPI_LanguageParams.XPATH)) { throw new RuntimeException("Invalid setting " + sourceText + " for parameter s...
3
public Map<String, Map<String, Boolean>> getPermissions(String world) { Map<String, Map<String, Boolean>> result = new LinkedHashMap<String, Map<String, Boolean>>(); Map<String, Boolean> groupperms = new LinkedHashMap<String, Boolean>(); //add group permissions groupperms.put("droxperms.meta.group." + name, tru...
8
public static int windowImgs(String wnd, boolean free) { int cnt = 0; Widget root = UI.instance.root; for (Widget wdg = root.child; wdg != null; wdg = wdg.next) { if (wdg instanceof Window) if (((Window) wdg).cap.text.equals(wnd)) for (Widget img =...
9
public void loadPlugins(){ String runPath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); try { List<File> files = Util.getFileList(Folders.PLUGIN.getAbsolutePath()); for(File f: files){ if(!f.getName().endsWith(".jar")) return; URL path = new URL("jar:" + f.toURI()...
9
int test4( ) throws MiniDB_Exception{ int points = 0; // IN_SOLUTION_START MiniDB db = new MiniDB( "minidb.test4" ); BufMgr bm = db.getBufMgr(); BPlusTree bpt = db.createNewBPlusTreeIndex( "table", "val", 8 ); BPlusTreeLeafNode leaf = (BPlusTreeLeafNode)bpt.getRootNode(); int slot; ...
9
public String getLabel() { return label; }
0
public static void displayHP(Graphics g, GameController gc, ImageLoader il, int x, int y, int progress) { int xPos, yPos; int progressWidth; BufferedImage bi; x = x - (CONTAINER_WIDTH / 2); y = y + CONTAINER_HEIGHT; //container bi = il.getImage("...
4
@Override public void mousePressed(MouseEvent e) { for(int i = 0; i < Rocket.getRocket().currentGui.compList.toArray().length; i++){ if(((Button) Rocket.getRocket().currentGui.compList.get(i)).isInside(e.getX(), e.getY())){ ((Button) Rocket.getRocket().currentGui.compList.get(i)).click(true); if(((Button)...
3
public void setLeft(Node<K> left) { this.left = left; }
0
public void setPosition(Point position) { int x, y; // Make sure the position is a legal position(not to far to the sides so view space is given away) if (position.x < this.viewWidth / 2) { x = (int) Math.ceil(this.viewWidth / 2.0); } else if (position.x > (this.plan.getWidth() - (int) Math.ceil(t...
4
public static void requestToTeleportToPlayer( String player, String target ) { final BSPlayer bp = PlayerManager.getPlayer( player ); final BSPlayer bt = PlayerManager.getSimilarPlayer( target ); if ( playerHasPendingTeleport( bp ) ) { bp.sendMessage( Messages.PLAYER_TELEPORT_PENDING...
8
public void fillGaps() { // Utilisation du générateur de nombres aléatoires : // x.nextInt(6) + 1 for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrix[i][j] == 0) matrix[i][j] = x.nextInt(6) + 1; } } }
3
public App(ASMController a) { this.asmController = a; try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.p...
4
private Node<K, V> lowerAll( V value ) { if( value == null ) { return null; } Node<K, V> node = mAllRoot; Node<K, V> ret = null; if( mValueComparator != null ) { Comparator<? super V> comp = mValueComparator; while( node != null ) { int c = com...
9
@Override public void addResourceLoader(Class<? extends ResourceLoader<?>> clazz) throws ResourceException { ChronosLogger.info("Register loader: " + clazz.getSimpleName()); // Check if the class is registered ResourceType annotation = clazz.getAnnotation(ResourceType.class); if (annotation != null) { ...
5
@Override public void visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) { if (signature != null) { if (localVarType == null) { localVarType = new ByteVector(); ...
7
public List<String> parse(String line) { StringBuffer sb = new StringBuffer(); list.clear(); // recycle to initial state int i = 0; if (line.length() == 0) { list.add(line); return list; } do { sb.setLength(0); if (i < line.length() && line.charAt(i) == '"') ...
4
@Override public void mouseEntered(MouseEvent e) { }
0
private void solve(int n, short[][] board) { SudokuBoard sudoku = new SudokuBoard(n, board); System.out.format("Initial %d x %d Board {\n", n, n); System.out.print(sudoku); System.out.println("}"); Solver<SudokuMove> solver = new Solver<SudokuMove>(); solver.setInitialState(sudoku); // True since th...
2
public static void main(String[] args) { if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } int port = 1099; InetAddress localhost = null; try { localhost = InetAddress.getLocalHost(); System.err.println("Host name : "+localhost.g...
8
public java.lang.Float get() { elapsed = ((double) System.currentTimeMillis() - timeStart) / timeAnim; if (elapsed > 1.0) elapsed = 1.0; switch (method) { case -METHOD_LINE://line elapsed = elapsed * 2 - 1; break; case METHOD_S...
6
private boolean diagonalIncrementingBlock(int[][] grid, LinkedList<Square> squareStore, boolean pickOne) { //Block - Diagonal Inc if ((grid[2][0] == 1 && grid[1][1] == 1) && grid[0][2] != 2) { BuildAndAddSquareZeroTwo(squareStore); pickOne = updateGridZeroTwo(grid); } els...
9
public static HashSet getRandomIndexes_HashSet( Vector aVector, int aNumberOfIndexes, Random aRandom) { HashSet tIndexesToSwap_HashSet = new HashSet(); int aIndex; int count = 0; if (aNumberOfIndexes > aVector.size() / 2) { for (aIndex = 0;...
6
@Override public TLValue evaluate() { TLValue a = lhs.evaluate(); TLValue b = rhs.evaluate(); // number + number if(a.isNumber() && b.isNumber()) { return new TLValue(a.asDouble() - b.asDouble()); } // list + any if(a.isList()) { List<TLValue> list = a.asList(); list.r...
3
private Class<?> transformInPrimitive(final Object param) { Class<?> retorno = null; if (param instanceof Byte) { retorno = byte.class; } else if (param instanceof Short) { retorno = short.class; } else if (param instanceof Integer) { retorno = int.class; } else if (param instanceof Long) { retor...
9
private ListElement progressRoboMeeting(ListElement currentRobot) { ListElement helpRobot = currentRobot; while (helpRobot != null) { if (helpRobot.getNext() != null) { if (!this.robotPlace.exist(helpRobot.getNext().getId())) { helpRobot.setNext(helpRobot....
3
public void visit_i2f(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1
private STS createSemaphore() { init(); State initState = this.createState("s0"); List<State> stateList = new ArrayList<State>(); stateList.add(initState); int index = 1; for (Correction corr : corrections) { State s = createState("s" + index); stateList.add(s); index++; } STS sem = new...
7
@Override protected NodeValue exec(Node[] nodes, FunctionEnv env, SPINModuleRegistry registry) { Model baseModel = ModelFactory.createModelForGraph(env.getActiveGraph()); Node exprNode = nodes[0]; if(exprNode == null) { throw new ExprEvalException("No expression specified"); } else if(exprNode.isLitera...
9
public static Node treeSearch2(Node root,int key){ while(root != null && root.key != key){ if(key < root.key) root = root.left; else root = root.right; } return root; }
3
public void setActive(int x, int y) { activeX = x; activeY = y; switch(actualRole) { case Leader: if (cells[activeX][activeY].valueState == committedByTesterByRows || cells[activeX][activeY].valueState == committedByTesterByColumns || cells[activeX][activeY].valueState == committedByTesterBySquar...
5
private List setCurrentConnection(int nodeId) { List list = new List(); for (int i = 0; i < this.connection.length; i++) { int upI = i + 1; if (robotPlace.existConnection(upI) && this.connection[nodeId - 1][i] == 1) { list.add(true, upI); } else { ...
4
public void func_4059_a(int var1, int var2, byte[] var3) { byte var4 = 4; byte var5 = 32; int var6 = var4 + 1; byte var7 = 17; int var8 = var4 + 1; this.field_4163_o = this.func_4057_a(this.field_4163_o, var1 * var4, 0, var2 * var4, var6, var7, var8); for(int var9 = 0; var9 < ...
8
private static boolean processOneTokenForWrapToPixelWidth(String token, Font font, StringBuilder buffer, StringBuilder lineBuffer, int width, int[] lineWidth, boolean hasBeenWrapped) { int tokenWidth = getSimpleWidth(font, token); if (lineWidth[0] + tokenWidth <= width) { lineBuffer.append(token); lineWidth[0...
5
@Override public void mouseClicked(MouseEvent arg0) { if (Player == tg.gl.getTurn()) { JButton l = (JButton) arg0.getSource(); int move = tg.getInt(l.getName()); if (tg.gl.validMove(move, this.Player)) { TiarUserMessage tum = new TiarUserMessage(move, this.Player); try { sendMessage(enc.en...
3
public void pollControls() { while (mainState != KeyState.NONE) { Set<String> keyNames = KEYS.keySet(); for (String str : keyNames) { if(mainState.getKeyCode() == KEYS.get(str)) { keyStates[KEYS.get(str)] = mainState.getState(); } ...
3
public static AnvilSlot bySlot(int slot) { for (AnvilSlot anvilSlot : values()) { if (anvilSlot.getSlot() == slot) { return anvilSlot; } } return null; }
2
public void printlnToLog(String s) { synchronized (this) { printToLog(s + System.getProperty("line.separator")); } }
0
@Override public Date read(String value) throws Exception { for (SimpleDateFormat df : KNOWN_FORMATS) { try { Date result = df.parse(value); return result; } catch (ParseException e) {} } throw new ParseException("Unparseable date: " + value, 0); }
2
public static void updateTva(int idtva,String libelle, Float taux) throws SQLException { String query; try { query = "UPDATE TVA set TVALIBELLE=?,TVATX=? WHERE ID_TVA=? "; PreparedStatement pStatement = (PreparedStatement) ConnectionBDD.getInstance().getPreparedStatement(query);...
1
public void setSumbitTime(Timestamp sumbitTime) { this.sumbitTime = sumbitTime; }
0
@Override public void onEnable() { PluginDescriptionFile pdfFile = this.getDescription(); // load configuration, this way dis&enabling the plugin will read changes in the config file this.config = new SheepFeedConfig(this); // only register event listeners once //TODO will need to unr...
1
public boolean checkHitPlatform(Object obj) { Platform other = (Platform) obj; if (getX() + getWidth() >= other.getX() && getX() <= other.getX() + other.getWidth() && getY() + getHeight() >= other.getY() && getY() + getHeight() <= other.getY() + other.getHeight()) return true; return false; }
4
public void testProperty() { TimeOfDay test = new TimeOfDay(10, 20, 30, 40); assertEquals(test.hourOfDay(), test.property(DateTimeFieldType.hourOfDay())); assertEquals(test.minuteOfHour(), test.property(DateTimeFieldType.minuteOfHour())); assertEquals(test.secondOfMinute(), test.property...
2
public void executeTask() { if (!isModifyAction()) { if (getSelectedStudent() == null) { showError("No Student Found", "Please select a student"); } else if (courseList.isEmpty()) { showError("No Courses Found", "Please select at least one Course to proc...
8
private static void testListReader(String listWithBrackets) { System.out.println("Parsing list:\n"+listWithBrackets); List<DaTextVariable> l = ListHandler.parseListString(listWithBrackets); /* boolean first = true; StringBuilder postProcessed = new StringBuilder(); postProcessed.append("["); for(DaTextVar...
7
public boolean containsSegment(Segment s) { Iterator<Point> it = this.iterator(); while (it.hasNext()) { Point p = it.next(); if (p.equals(s.getP1())) { Point q; if (it.hasNext()) { q = it.next(); } else { q = this.getFirst(); } if (q.equals(s.getP2())) { return true; ...
7