text
stringlengths
14
410k
label
int32
0
9
protected double objectiveFunction(double[] x){ double nll = 0; // -LogLikelihood int dim = m_NumPredictors+1; // Number of variables per class for(int i=0; i<cls.length; i++){ // ith instance double[] exp = new double[m_NumClasses-1]; int index; for(int offset=0; offset<m_NumClasses-1; offs...
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { try { HttpSession session = request.getSession(true); AlumnoBean alumno = ((AlumnoBean) (session.getAttribute("currentSessionUser"))); System.out.println("RUT SESION: "+alumno....
9
public void insertCommentDependencies(BasicDBList comments) { Map<String, List<DBObject>> map = new HashMap<String, List<DBObject>>(); BasicDBList photoIds = new BasicDBList(); for (Object objectComment : comments) { DBObject comment = (DBObject) objectComment; String ph...
4
public void setLeft(PExp node) { if(this._left_ != null) { this._left_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
3
public void setPos(ChessPosition pos) { if (state != GameState.PLAYING) { System.out.println("finish game: " + state); return; } if (isChooseForMove(pos)) { // chon quan de di chuyen // loai bo pos khong hop le if (board.getPiece(pos) == 0) return; oldPos = pos; // neu hop le thi danh dau oldP...
8
public synchronized Promotion removePromotion(Promotion promotion) { if (promotion != null) { for (Promotion promotionAux : listPromotion) { if (promotionAux.getPromotionCode() == promotion .getPromotionCode()) { listPromotion.remove(promotionAux); logger.info("Promotion successfully Removed! P...
3
private void initInput() { moveLeft = new GameAction("moveLeft"); moveRight = new GameAction("moveRight"); jump = new GameAction("jump", GameAction.DETECT_INITAL_PRESS_ONLY); exit = new GameAction("exit", GameAction.DETECT_INITAL_PRESS_ONLY); fire = new Ga...
0
public boolean compleixRes(Clausula c, ClausulaNom cn) { Aula aulaa = cn.getAula(); int horaa = cn.getHora(); String diaa = cn.getDia(); int dur = c.getDuracio(); boolean compleix = true; if (this.aula.equals(aulaa)) { //Si hablan de la aula que esta restringida ...
6
public void getSignature(SourceWriter writer) { writer.printIndent(); // process visibility if (this._visibility != null && this._visibility.length() > 0) { writer.print(this._visibility).print(" "); } if (this.getSuperClass() != Type.OBJECT_CLASS) { writer.print("type ").print(this.getName()...
9
@Override public int compare(double[] b1, double[] b2) { if (b1[col] < b2[col]) { return -1 * order; } else if (b1[col] == b2[col]) { return 0 * order; } else { return 1 * order; } }
2
public void reset() { history.clear(); for (Cell cell : all()) { if (cell.isEditable()) { cell.clear(); if (!initialPoss) { cell.poss().clear(); } } } if (initialPoss) { for (Cell cell...
7
public static void setFontForComponent(Component Comp, Font font) { if (font == null) { try { if (Locale.getDefault().toString().toLowerCase().contains("zh")) { font = new Font("Microsoft YaHei", Font.PLAIN, 12); } } catch (Throwable e)...
9
private boolean menuHasAddFriend(int arg0) { if (arg0 < 0) { return false; } int k = menuActionOpcode[arg0]; if (k >= 2000) { k -= 2000; } return k == 337; }
2
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == load) try { loadFile(); } catch (FileNotFoundException ex) { System.out.println("File not found: " + ex.getMessage()); } catch (IOException ex) { System.out.printl...
4
public void setClientName(String clientName) { this.clientName = clientName; }
0
@Override public Carte modifier_carte(HashMap<String, Object> map) { String nom = this.nom,actions = this.actions; int type = this.type_dresseur; if(map.get("nom") instanceof String && !map.get("nom").equals("")) nom = map.get("nom").toString(); if(map.get("actions") instanceof String && !map.get("actions")...
7
private void RegenerateFurniCollisionMap() { for(int x = 0; x < this.GrabModel().MapSizeX; x++) //Loopception courtesy of Cobe & Cecer { for(int y = 0; y < this.GrabModel().MapSizeY; y++) { FurniCollisionMap[x][y] = 1; } } for(FloorItem Item : FloorItems.values()) { for(AffectedTile Tile :...
9
public VariableStack mapStackToLocal(VariableStack stack) { if (!stack.isEmpty()) throw new IllegalArgumentException("stack is not empty at RET"); return null; }
1
@Override public void execute() throws BuildException { PageUnit.init(); try { if (theFile != null) { PageUnit.processFile(theFile); } else if (theDir != null) { PageUnit.processFile(theDir); } else if (theTest != null) { if (thePath == null) { PageUnit.processFile(new File(theTest)); ...
6
@Override public boolean isEmailInDatabase(String email) { String sql = "SELECT * FROM customer WHERE email='" + email + "';"; Connection con = null; try { con = getConnection(); PreparedStatement statement = con.prepareStatement(sql); ResultSet resultSet = statement.executeQuery(); return resultS...
2
public static int countNeighbours(boolean[][] world, int col, int row) { int c = 0; if (getCell(world, col - 1, row - 1) == true) { c += 1; } if (getCell(world, col, row - 1) == true) { c += 1; } if (getCell(world, col + 1, row - 1) == true) { ...
8
public void setVariable(String var, Object val){ for(String p : localVars.keySet()){ if(p.equals(var)){ String type = localVars.get(p).getClass().getSimpleName(); if(!var.getClass().getSimpleName().equals(type)){ try{ if(type.toLowerCase().equals("float")) localVars.put(p, (float) val); ...
8
public static Random getRandom() { // construct the singleton random object if it does not yet exist if(randomGenerator == null) { if(Configuration.useSameSeedAsInPreviousRun) { randomSeed = AppConfig.getAppConfig().seedFromLastRun; } else { if(Configuration.useFixedSeed){ randomSeed = Configurat...
3
public void done() { int remain = remainingTransitions.size(); if (remain != 0) { Transition t = (Transition) remainingTransitions.iterator().next(); drawer.addSelected(t.getFromState()); JOptionPane.showMessageDialog(view, remain + " transition" + (remain == 1 ? "" : "s") + " remain " + "to be placed...
2
@Override public void undo() { if(prevSpeed==CeiligFan.HIGH){ ceilingFan.high(); }else if(prevSpeed==CeiligFan.MEDIUM){ ceilingFan.medium(); } else if(prevSpeed==CeiligFan.LOW){ ceilingFan.low(); } else if(prevSpeed==CeiligFan.OFF){...
4
static public Class getWrapperClass (Class type) { if (type == int.class) return Integer.class; else if (type == float.class) return Float.class; else if (type == boolean.class) return Boolean.class; else if (type == long.class) return Long.class; else if (type == byte.class) return Byte.class;...
7
public static Orientation valueOf(boolean flipAroundHorizontal, Rotation rotation) { Orientation result = null; if (!flipAroundHorizontal) { switch (rotation) { case NOTHING: result = TOP_LEFT ; break; case LEFT : result = LEFT_BOTTOM ; break; case OVER : result = BOTTOM_RIGHT; b...
9
public AchaMazeWindow() throws AchaMazeException { setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(640, 480); setTitle("AchaMaze"); MyPanel panel = new MyPanel(); add(panel); setVisible(true); say("Welcome."); maze = MazeExamples.ExampleMaze1(); drawMaze = new DrawMaze(maze); panel.repaint...
6
private boolean runChecks(){ // Check 1: Is it time to go home? if(office.getTime() >= dayEndTime){ // End the thread return false; } // Lunch time? if(office.getTime() >= lunchTime && !hadLunch){ try { long startCheck = System.currentTimeMillis(); System.out.println(office.getStringT...
7
@Override public Object getValueAt(int rowIndex, int columnIndex) { Change ch = changes.get(rowIndex); switch (columnIndex) { case 0: return changeSelected.get(rowIndex); case 1: return ch.getType(); case 2: return ch.getDescription(); case 3: return ch.getTarget(); case 4: re...
6
public void restore() { logger.debug("enter restore method"); configService.initRestoreConfig(); List<String> restoreIndices = configService.getRestoreIndices(); if(restoreIndices == null || restoreIndices.size()==0){ restoreIndices = findAllIndexesFromDir(); } if(restoreIndices!=null && restoreIndices.s...
8
@Override public <T extends Comparable<? super T>> int search(T[] array, T key) { if (array == null) throw new NullPointerException("argument array is null"); if (key == null) throw new NullPointerException("argument key is null"); // Make sure every element is not n...
9
public static synchronized Date stringToDate(String dateString) throws ParseException { if (dateString.length() == 4) { return YEAR_FORMAT.parse(dateString); } else if (dateString.length() == 6) { return MONTH_FORMAT.parse(dateString); } else if (dateString.length() == 8) { return DAY_FORM...
7
public static String getRequestChatName(String inString) throws JDOMException, IOException, TagFormatException { String result = ""; SAXBuilder mSAXBuilder = new SAXBuilder(); Document mDocument = mSAXBuilder.build(new StringReader(inString)); Element rootNode = mDocument.getRootElement(); String protTyp...
1
public Task getTaskByIdName(String id, String name) throws FileNotFoundException, JAXBException{ //Check this line //FileInputStream stream = new FileInputStream("/WEB-INF/task-manager-xml.xml"); FileInputStream stream = new FileInputStream("C:/Users/Efrin Gonzalez/Documents/task-manager-xml.xml"); // create ...
3
public boolean recordParamNames(CodeAttribute ca, int numOfLocalVars) throws CompileError { LocalVariableAttribute va = (LocalVariableAttribute) ca.getAttribute(LocalVariableAttribute.tag); if (va == null) return false; int n = va.tableLength();...
3
public int extraerUltimoRegistro(String nombretabla, String[] campos) { int resultado = 0; try { this.bd.open(); this.bd.beginTransaction(SqlJetTransactionMode.READ_ONLY); this.table = this.bd.getTable(nombretabla); // Con esta función buscamos en la t...
3
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Picking)) return false; Picking other = (Picking) obj; if (id.equals(other.id)) return false; return true; }
4
public Point findPointIntersection (Point P1, Point P2, Point P3, Point P4){ a1=P1.getY()-P2.getY(); a2=P3.getY()-P4.getY(); b1=P2.getX()-P1.getX(); b2=P4.getX()-P3.getX(); c1=P1.getX()*P2.getY()-P2.getX()*P1.getY(); c2=P3.getX()*P4.getY()-P4.getX()*P3.getY(); xDe...
9
private String shrtTip() { String tt = shorttip(); if (tt != null) { tt = RichText.Parser.quote(tt); if (meter > 0) { tt = tt + " (" + meter + "%)"; } if (FEP != null) { tt += FEP; } if (curio_stat !=...
7
public void setUpdateExisting(boolean updateExisting) { this.updateExisting = updateExisting; }
0
public long playGame(final Board start, List<Integer> nextPiece) { System.out.println(start); System.out.println("avail moves: " + nextPiece.size()); Board curBoard = new Board(start); int moves = 0; long startTime = System.nanoTime(); List<Board.Direction> moveList; do { moveList = this.nextMove...
4
MethodConstructorStringConverter(Class<T> cls, Method toString, Constructor<T> fromString) { super(cls, toString); if (cls.isInterface() || Modifier.isAbstract(cls.getModifiers()) || cls.isLocalClass() || cls.isMemberClass()) { throw new IllegalArgumentException("FromString constructor must ...
5
public void parseInput(String state) { char type = state.charAt(0); if (type != ':') { return; } type = state.charAt(1); String value = state.substring(3); if (type == 'l') { this.light = Integer.decode(value); } if (type == 'r') { this.relayA = Integer.decode(value) == 1; } if (type == '...
5
public static String stringOfCollection(Collection<?> collection, String sep, String prefix, String suffix) { StringBuilder res = new StringBuilder(prefix == null ? "" : prefix); if (collection != null) { boolean first_element = true; for (Object elem : collection) { if (elem != null) { res.append((f...
7
private String stackString() { Object[] o = STACK.toArray(); StringBuffer sb = new StringBuffer(); for (int i = o.length - 1; i >= 0; i--) sb.append(o[i]); return sb.toString(); }
1
public static Map<String, String> simpleUPnPcommand(String url, String service, String action, Map<String, String> args) throws IOException, SAXException { String soapAction = "\"" + service + "#" + action + "\""; StringBuilder soapBody...
5
public void save() throws SQLException { if (groopNumber == -1) groopNumber = GetGroops.build().addGroop(this); else if (updated) GetGroops.build().save(this); }
2
public SqlErrorFrame() { initComponents(); }
0
public void draw(Graphics2D g) { g.setColor(Color.WHITE); if(onFire) g.drawImage(fireImage, xPos, yPos, null); else if(SimCityGui.GRADINGVIEW) { g.drawString("W"+mNum, xPos+10, yPos-5); } else { g.drawImage(image, xPos, yPos, null); } switch(state) { ...
7
public boolean checkBook() { boolean hasBook = false; ArrayList<Card> list = getList(); HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); for (int i = 0; i < list.size(); i++) { int numb = list.get(i).getCardNum(); if (!map.containsKey(numb)) { map.put(numb, 1); } else { int qty ...
3
@Override public void run() { // loop to receive broadcasted UDP packets active = true; DatagramPacket packet = new DatagramPacket( new byte[NetInterface.UDP_PACKET_SIZE], NetInterface.UDP_PACKET_SIZE); while (active) { try { // blocks thread until reception of a packet if (verbose) { S...
7
public void insert(LinkedListRange node, LinkedListRange root) { if (root == null) { root = node; return; } while (root.getNext() != null) root = root.getNext(); root.setNext(node); }
2
private IShelf setPosition(IItem item) throws TaskFailureException { for (int i = 1; i < 4; i++) { try { Aisle aisle = (Aisle) manager.get("A" + i); List<Rack> racks = aisle.getRacks(); for (int j = 0; j < racks.size(); j++) { Rack ...
5
@Override public String[] getTableRenameStatements(String oldTableName, Class<?> oldClass, String newTableName, Class<?> newClass) { StringBuilder sb = new StringBuilder("RENAME TABLE "); sb.append(oldTableName); sb.append(" TO "); sb.append(newTableName); return new String[] { sb.toString() }; }
2
public void doMission() { final Unit unit = getUnit(); String reason = invalidReason(); if (reason != null) { logger.finest(tag + " broken(" + reason + "): " + this); return; } // Make random moves in a reasonably consistent direction, // checking...
6
@SuppressWarnings("fallthrough") private void beforeValue(boolean root) throws IOException { switch (peek()) { case NONEMPTY_DOCUMENT: if (!lenient) { throw new IllegalStateException( "JSON must have only one top-level value."); } // fall-through case EMPTY_DOCUMENT: ...
8
public void checkPawn() { if (color == 'W') { for (int i = 0; i < 8; i++) { if (aiarr[i][0].toString().charAt(1) == 'P') { aiarr[i][0] = new Queen(true); } } } if (color == 'B') { for (int i = 0; i < 8; i++) { if (aiarr[i][7].toString().charAt(1) == 'P') { aiarr[i][7] = new Queen(fa...
6
public static byte[] decodeFromFile( String filename ) throws java.io.IOException { byte[] decodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables java.io.File file = new java.io.File( filename ); byte[] bu...
4
private void searchByLivreEmprunt(String toSearch) throws Exception { try { StringTokenizer st = new StringTokenizer(toSearch, " "); if (st.countTokens() != 0) { List<String> list = new ArrayList<>(); for (int i = 0; i < st.countTokens() + 1; i++) { ...
7
public synchronized void run() { try { while (true) { Thread.sleep(time - 14); secound += 1; if (secound >= 60) { minute += 1; secound = 0; } if (minute >= 60) { hour += 1; minute = 0; } if (hour >= 1) { hour = 0; minute = 0; secound = 0; } } } catch(Exception e) { e.printStack...
5
public File wavCombiner(File synthFile, File inputFile){ Synthesizer synth = JSyn.createSynthesizer(); LineOut lineOut; synth.add(lineOut = new LineOut()); synth.start(); FloatSample sample; FloatSample sample2; try { // AddUnit mixer = new AddUnit(); sample = SampleLoader.loadFloatS...
4
void paintImage(PaintEvent event) { GC gc = event.gc; Image paintImage = image; /* If the user wants to see the transparent pixel in its actual color, * then temporarily turn off transparency. */ int transparentPixel = imageData.transparentPixel; if (transparentPixel != -1 && !transparent) { image...
9
public Transporte recebeuPSH(int n_seq, InetAddress adress){ Transporte t1=new Transporte(initTransportePSH); this.Recebidos.lock(); ArrayList<DatagramPacket> lista = (ArrayList<DatagramPacket>) this.Recebidos.lista.clone(); this.Recebidos.unlock(); for(DatagramPacket ...
4
private static Icon getIconForValue ( BencodeTreeModel model, BencodeTreeNode node ) { if ( node.getParent() == null ) { return ICON_ROOT; } Value<?> value = node.getValue(); if ( value instanceof IntegerValue ) { return ICON_INTEGER; } else if ( value instanceof StringValue ) { if ( ( (Str...
7
private void fillMaxTotalScores() { int numEntries = entryList.size(); Vector cellList = new Vector(16); rootPane.getAttributeCells(cellList); double[] accumulatedRatios = new double[numEntries * noOfUsers]; int j = 0; for (int i = 0; i < numEntries; i++) {//for each alternative ...
8
public static void main(String[] args) { // Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { // // @Override // public void uncaughtException(Thread t, Throwable e) { // System.out.println("e: " + e.getMessage()); // } // // }); Thread.currentThread().setUncaughtExceptio...
0
private double noise2D(double xin, double yin) { double n0, n1, n2; // Noise contributions from the three corners // Skew the input space to determine which simplex cell we're in double s = (xin+yin)*F2; // Hairy factor for 2D int i = fastfloor(xin+s); int j = fastfloor(yin+s); double t = (i+j)*...
4
public Ants(int loadTime, int turnTime, int rows, int cols, int turns, int viewRadius2, int attackRadius2, int spawnRadius2) { this.loadTime = loadTime; this.turnTime = turnTime; this.rows = rows; this.cols = cols; this.turns = turns; this.viewRadius2 = viewRa...
5
public static Set getUselessStates(Automaton a) { if (a.getInitialState() == null) { throw new IllegalArgumentException( "Automata does not have an initial state!"); } Set finalized = findFinal(a); Set initialized = findInitial(a); Set useless = new HashSet(Arrays.asList(a.getStates())); finalized.r...
1
public MenuPanel(){ players = new ArrayList<Player>(); nameLabel = new JLabel("Name: "); nameField = new JTextField("",20); addButton = new JButton("Add Player"); startButton = new JButton("Start Game"); nameLabel.setLabelFor(nameField); updateAddButton(); updateStartButton(); nameField.g...
3
private boolean calulateHueSaturation(ij.process.ImageProcessor ip) { boolean huesaturation = false; int w = ip.getWidth(); int h = ip.getHeight(); int [] h_hist = new int [360]; for (int i=0; i<360; i++) { h_hist[i] = 0; } //set image as current window ImagePlus hs_imp; hs_imp = Win...
9
public AlphaImageDemo() { MinuetoWindow window; // The Minueto window MinuetoImage imageTank; // MinuetoImage used to store // the image we will load. MinuetoImage imageBackGround; // Background image double x; // Position to draw the image. if (MinuetoTool.isWindows()) ...
4
private Object getIdString() { try { Field idField = this.getClass().getDeclaredField("id"); return idField.get(this); } catch (SecurityException e) { return ""; } catch (NoSuchFieldException e) { return ""; } catch (IllegalArgumentException e) { return ""; } catch (IllegalAccessException e) { ...
4
public synchronized User detachUser(String nickname) { for (User user : model) { if ( user.getNickname().equals(nickname) ) { model.remove(user); contentChanged(); return user; } } return null; }
2
private String get_alphabet_morse(int cnt) { StringBuilder sb=new StringBuilder(); int first_line=cnt/9; switch(first_line) { case 0: sb.append("."); break; case 1: sb.append("-"); break; case 2: sb.append("x"); break; } int second_line=cnt%9; if(second_line>=0 && second_line<=2) ...
9
public void setConfiguration (int index) throws USBException { int status; if (index < 0 || index > descriptor.getNumConfigurations ()) throw new IllegalArgumentException (); throw new USBException ("can't set configuration (unimplemented)", 0); /* synchronized (lock) { if ((status = setConfig...
2
private void createEntry(String pFileWildcardPath, Map<String, String> pInstructionMap) throws ExParser { //Get and validate the loader name String lLoader = pInstructionMap.remove(CONFIG_INSTRUCTION_LOADER); if(XFUtil.isNull(lLoader)){ throw new ExParser("Invalid config file definition - 'Loa...
4
void doItCompareDomains() { for (String name : _a1.keySet()) { Chromosome c1 = _a1.get(name); Chromosome c2 = _a2.get(name); if (c2 != null) { StatisticResultComparisonDomains r1 = c1.analyze(); r1.setComparisonResult(c1.comparisonOfDomain...
4
@Override public void run() { System.out.println("Hello, The Host is started"); while(nm.comp.isRunning()){ try { Socket socket = serverSocket.accept(); Logger.println("Connection from IP: " + socket.getInetAddress()); DataOutputStream out = new DataOutputStream(socket.getOutputStream()); DataIn...
7
@SuppressWarnings("rawtypes") public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { JList list = (JList) e.getSource(); String selectedValue = (String) list.getSelectedValue(); String oldValue = textCom...
2
private void initializeResultsFile() { if (trace_flag == false) { return; } // Initialize the results file FileWriter fwriter = null; FileWriter fwriterFin = null; try { fwriter = new FileWriter(super.get_name(), true); fwr...
4
@Override public void run() { /* Todos los resultados posibles de X*10^r sin repetir * Ejemplo: 1 dado, 2 caras, 2 bandejas: * [0, 1, 2, 20, 21] */ if(trays == 1){ resultado = diceNumber * faces + 1; }else{ Set<Integer> lcombinaciones = new HashSet<Integer>(); for(int tray = 0; tray<tr...
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AcompanhamentoFisico other = (AcompanhamentoFisico) obj; if (idAcompanhamentoFisico == null) { if (other.idAcompanhamentoFisico != null) r...
6
public static long ncr(int n, int k) { return factorial(n).divide(factorial(n-k).multiply(factorial(k))).longValue(); }
0
public static String getValidDnaCharsOrN( String inString ) { StringBuffer buff = new StringBuffer(); for ( int x=0; x < inString.length(); x++ ) { char c = inString.charAt(x); if ( c == 'A' || c == 'C' || c == 'G' || c == 'T' || c == 'N' ) buff.append(c); } return buff.toStrin...
6
@Override public double[] evaluate(double[] parameters) { if(this.numberOfEvaluation <= 0){ return null; } this.numberOfEvaluation -= 1; controllers.singlePlayer.ucbOptimizerAgent.Agent.parameters = parameters; double[] results = new double[this.getNumberOfObjectives()]; for(int i=0; i<this.gamePa...
4
@Test public void testPropertiesConfiguredInstanceName() throws Exception { assertEquals( scheduler.getSchedulerName(), INSTANCE_NAME ); }
0
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof Handle)) { return false; } Handle h = (Handle) obj; return tag == h.tag && owner.equals(h.owner) && name.equals(h.name) && desc...
5
static final boolean method3455(String string, int i) { anInt4324++; if (string == null) return false; for (int i_0_ = 0; ((Class348_Sub42_Sub12.ignoreListLength ^ 0xffffffff) < (i_0_ ^ 0xffffffff)); i_0_++) { if (string.equalsIgnoreCase(Class122.aStringArray1808[i_0_])) return true; if (stri...
5
public static void save(HashMap<String, ArrayList<String>> map, String path) { try { ObjectOutputStream oos = new ObjectOutputStream( new FileOutputStream(path)); oos.writeObject(map); oos.flush(); oos.close(); // Handle I/O excepti...
1
void findBeginningAndFinishLocations() { char character; beginning = null; finish = null; for (int column = 0; column < dimension; column++) { for (int row = 0; row < dimension; row++) { character = getValueAtLocation(column, row); if (characte...
6
public void tick(){ if(y + ny >= 0 && y + ny <= maxY - height){ y += ny; }else{ ny *= -1; y += ny; } if(x + nx >= 0 && x + nx <= maxX -width){ x += nx; }else{ nx *=-1; x += nx; } if(x <= 0){ x = 0; } if(x >= maxX -width){ x = maxX -width; } if(y >= maxY -height){ y = max...
9
public PrecisionLab getPrecisionLab() { precisionLabLock.readLock().lock(); if (precisionLabInstance == null) { precisionLabLock.readLock().unlock(); precisionLabLock.writeLock().lock(); try { if (precisionLabInstance == null) { precisionLabInstance = createPrecisionLab(); } } finally ...
2
public JLabel getjLabelMotifVisite() { return jLabelMotifVisite; }
0
public static void setUpEntities(){ bat = new Bat(WIDTH / 2, HEIGHT -30 , 80, 20); ball = new Ball(bat.getX() + 20, bat.getY() - 30, 10, 10); ball.setDY(.1); int xPos = 20, yPos = 20; for (int i = 0; i < 15; i++) { bricks.add(new Brick(xPos, yPos, true)); ...
2
private boolean worldChanged() { //Wenn sich die Original-Linienanzahl veraendert hat if(numlines != Reflines.size()) { //Originallinien kopieren Lines.clear(); for(int i=0; i<Reflines.size(); i++) { int[] x = new int[4]; x[0] = Reflines.elementAt(i)[0]; x[1] = Reflines.elementAt(i)[1]; ...
8
@POST @Path("/v2.0/subnets") @Produces(MediaType.APPLICATION_JSON) public Response createSubnet(final String request) throws MalformedURLException, IOException{ //Convert input object NetworkData into a String like a Json text Object sub; sub = JsonUtility.fromResponseStringToObject(request,Subnet.class); St...
2
static void handleUDP(DatagramSocket udpSocket) throws IOException { while (true) { //will represent the received data as bytes byte[] receiveData = new byte[1024]; //sent data as bytes byte[] sendData = new byte[1024]; //represent received packet ...
1
@Override public void deserialize(Buffer buf) { msgId = buf.readShort(); if (msgId < 0) throw new RuntimeException("Forbidden value on msgId = " + msgId + ", it doesn't respect the following condition : msgId < 0"); timeStamp = buf.readUInt(); if (timeStamp < 0 || timeSta...
5