text
stringlengths
14
410k
label
int32
0
9
public ArrayList<Administrador> getByDNI(Administrador admin){ PreparedStatement ps; ArrayList<Administrador> admins = new ArrayList<>(); try { ps = mycon.prepareStatement("SELECT * FROM Administradores WHERE dni=?"); ps.setString(1, admin.getDNI()); ResultSet...
4
@Override public void actionPerformed(ActionEvent e) { if(e.getID() == ActionEvent.ACTION_PERFORMED) { GuiButton button = (GuiButton)e.getSource(); if(button == newGame) Client.instance.setGuiScreen(new GuiSelectServer(this)); else if(button == test) Client.instance.activateMap(true); else ...
6
public static void main(String[] args) { Random r = new Random(); ArrayList<Integer> ArrayA = new ArrayList<Integer>(); ArrayList<Integer> ArrayB = new ArrayList<Integer>(); ArrayList<Integer> ArrayC = new ArrayList<Integer>(); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)); ArrayA.add(r.nextInt(10)...
4
public void getSimpleRandomGraph(mxAnalysisGraph aGraph, int numNodes, int numEdges, boolean allowSelfLoops, boolean allowMultipleEdges, boolean forceConnected) { mxGraph graph = aGraph.getGraph(); Object parent = graph.getDefaultParent(); Object[] vertices = new Object[numNodes]; for (int i = 0; i < num...
8
public static void Balconey() { currentRoomName = "Balconey"; currentRoom = 7; RoomDescription = "The wafer thin doors are almost crushed in your hands as you open them and enter the balconey." + "You are immediately faced with the dark figure you saw earlier; only this time, he is slung over the " + "ba...
0
private String findCaller(int depth) { if (depth < 0) { throw new IllegalArgumentException(); } tracer.fillInStackTrace(); return tracer.getStackTrace()[depth+1].toString(); }
1
public static void main(String[] args) { // INSERT INTO `bible`.`books` // (`ID`, `TESTAMENT`, `TITLE`, `TITLE_CN`, `TITLE_CN_SHORT`) // VALUES // ('1', 'OT', 'Genesis', '創世紀', '創'); StringBuilder sb = new StringBuilder(); for (int k = 0; k < 39; k++) ...
2
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { if (computeSVUID) { if ("serialVersionUID".equals(name)) { // since the class already has SVUID, we won't be computing it. computeSVUID = false; hasSVUID = true; } ...
4
public int maxP(int[] A){ int length = A.length; if(length == 1) return A[0]; if(A== null || A.length ==0 ) return 0; int max = A[0]; int n = 0; int total = 1; int[] pre = new int[length]; int[] aft = new int[length]; for(...
8
public void chooseM() { m = LemmaMath.fetchRandInt(myRange[0], myRange[1]); }
0
private static CustomButton doIndividualTickerButtonForPanel( ArrayList<String> bundle, final String ticker, final String buttonData, final JFrame closeMe, int type) { boolean filterResults = meetsFilter(ticker); if (!filterResults) return null; final CustomButton a = new CustomButton((ticker)); a.se...
5
public boolean hasNeighbor(int piece, boolean withOpponents) { boolean condition = false; for (int dh = UP; dh <= DOWN; dh++) { for (int dv = LEFT; dv <= RIGHT; dv++) { if (dh == 0 && dv == 0) continue; int neighbor = searchNeighbor(piece, dh, dv); if (neighbor != -1) { condition = conditio...
8
public void connect(TreeLinkNode root) { if(root == null) return; if(root.left == null && root.right == null){ root.next = null; return; } TreeLinkNode tempRoot = root; tempRoot.next = null; while(tempRoot != null){ TreeLinkNode startPoint = tempRoot; while(startPoint != null){ if(startPo...
7
public void printTrees(QuadTree tree) { // Include parent tree // System.out.println(tree); // for (Point2D p : tree.getEdges()) { // System.out.println(p.getX() + ", " + p.getY()); //} // Child trees for (QuadTree t : tree) { System.out.println(t); //for (Point2D p : t.getEdges()) { //Sys...
1
private static ArrayList<String> loadFile() { ArrayList<String> texts = new ArrayList<String>(); File aFile = null; BufferedReader aBufferedReader = null; FileReader aFileReader = null; JFileChooser aFileChooser = new JFileChooser(); int selected = aFileChooser.showOpenDialog(null); if(selected == JFile...
9
public void newFrame() { int i = JOptionPane.showOptionDialog(this, "What kind of page would you like to add?", "New Page", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[]{"Blank Pa...
2
public void guardarImagen(String rutaArchivo) { FileWriter fw = null; PrintWriter pw; try { fw = new FileWriter(rutaArchivo); pw = new PrintWriter(fw); String comentario = "# Imagen guardada desde programa AxpherPicture\n"; comentario += "# Autor: ...
9
private void doubleClickedNode(Object obj) { if (obj instanceof File) { final File f = (File) obj; FileType ft = FileType.typeForFile(f); //Do first action for (final FileAction act : Actions.actions) if (act.canDoOn(ft)) ...
3
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); if(null == image) { return; } BMPImage.BMPColor[][] bitmap = image.getBitMap(); int height = image.getHeight(); int width = image.getWidth(); BufferedImage bufferedIma...
4
@Test public void containsReturnsFalseWhenElementNotInArray() { a.insert(new Vertex(493)); assertFalse(a.contains(v)); }
0
@Override public int compareTo(Object ob){ Event e = (Event) ob; if(this.time < e.getTime()){ return -1; } if(this.time > e.getTime()){ return 1; } return 0; }
2
private static void solve_nu_svc(svm_problem prob, svm_parameter param, double[] alpha, Solver.SolutionInfo si) { int i; int l = prob.l; double nu = param.nu; byte[] y = new byte[l]; for(i=0;i<l;i++) if(prob.y[i]>0) y[i] = +1; else y[i] = -1; double sum_pos = nu*l/2; double sum_neg ...
6
@Override // Draw certain pictures based on # of lives remaining public void draw(Graphics g) { if (Lives >= 3) { g.drawImage(img1, pos_x, pos_y, width, height, null); } else if (Lives == 2) { g.drawImage(img2, pos_x, pos_y, width, height, null); } else if (Lives == 1) { g.drawImage(img3, pos_x, pos_y,...
3
public void persistir() { FileOutputStream fos = null; ObjectOutputStream stream = null; try { fos = new FileOutputStream("arquivo.bin"); stream = new ObjectOutputStream(fos); stream.writeObject(persistencia); } catch (IOException e) { e.printStackTrace(); } finally { if (fos != null) { tr...
5
public int[] getItemLastModifier(int itemSlot, BagLocation bag) throws IOException { GWCAPacket receivedGwcaPacket = sendAndReceivePacket(GWCAOperation.GET_ITEM_LAST_MODIFIER, itemSlot, bag != null ? bag.getValue() : ZERO); return receivedGwcaPacket.getParamsAsIntArray(); }
1
public boolean isPropertyInherited() {return propInherited;}
0
public void addUserInterruptListener(ActionListener al){ if (listeners==null ||(listeners!=null && listeners.isEmpty()) ) listeners = new Vector<ActionListener>(); listeners.add(al); }
3
public static Object getProperty(Object obj, String propertyName) { if (obj == null) return null; try { BeanInfo info = Introspector.getBeanInfo(obj.getClass()); PropertyDescriptor[] descriptors = info.getPropertyDescriptors(); for (int i = 0; ...
6
public Object[][][] readLine() { try { //Excelのワークブックを読み込みます。 POIFSFileSystem filein = new POIFSFileSystem(new FileInputStream(targetFile)); HSSFWorkbook wb = new HSSFWorkbook(filein); Object[][][] sheetArray = new Object[wb.getNumberOfSheets()][][]; // シートごとのループ for (int i = 0; i < wb.getNumberOfS...
8
public String searchByName(final String name) throws IOException { if (searchingFile(name,"name") == null) { return null; } return searchingFile(name,"name").toString(); }
1
@Override public SQLPermissionRcon getRcon() throws DataLoadFailedException { checkCache(PermissionType.RCON, null); return (SQLPermissionRcon) cache.get(PermissionType.RCON).get(null); }
0
public void setPcaUsuario(String pcaUsuario) { this.pcaUsuario = pcaUsuario; }
0
public static Collection<? extends Bean> scanForBeansFromMethods(Class baseType) { Set<Bean> beansCollection = new HashSet<Bean>(); Method[] methods=baseType.getDeclaredMethods(); for (Method method : methods) { org.frameworkdi.poc.annotations.Bean bean = method.getAnnotation(org.f...
5
@Override public int getConnTimeout() { return connTimeout; }
0
public Controller(final JComponent c){ final GameComponent gc = (GameComponent) c; ArrayList<Player> players = GameComponent.getPlayers(); im = gc.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); am = gc.getActionMap(); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false), ...
7
public final static void encode(Image image, OutputStream os) throws IOException { CRC32 crc = new CRC32(); int width = image.width; int height = image.height; write(os, null, PNGHelper.ID); write(os, crc, PNGHelper.IHDR); write(os, crc, width); write(os, crc, height); write(os, crc, PNGHelper.HEAD);...
2
public void combineElements(int key1, int key2) { Element element1 = elements.get(key1); Element element2 = elements.get(key2); if (element1 == null) { throw new IllegalArgumentException( "Unable to find element with key: " + key1); } if (element2 == null) { throw new IllegalArgumentException( ...
6
public ArrayList <boid> getArrayNeightEdge(boid osobnik){ ArrayList <boid> temp=new ArrayList <>(); temp.ensureCapacity(400); int dX=osobnik.getBucketX()+2; int dY=osobnik.getBucketY()+2; int tx=0,ty=0; temp.addAll(bucketList.get(dX-2).get(dY-2).koszyk); for (int i=dX-3;...
8
private void showLoadDialog() { try { if (matchFileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { if (matchFileChooser.getSelectedFile().isFile()) { setMatch(MatchLoader.loadFromSave(matchFileChooser.getSelectedFile().getPath())); displayMatch(); } else { throw new FileNotFou...
3
private void runSSLTasks() { Runnable task = null; while ((task = mEngine.getDelegatedTask()) != null) { task.run(); } }
1
public void deleteTag() { if (this.myApplicationsAppMyTagsList.getSelectedValue()!=null && this.myApplicationsTree.getSelectionPath()!=null) { String appId = ((DefaultMutableTreeNode)this.myApplicationsTree.getLastSelectedPathComponent()).toString(); String tagName = ((TagListItem)this.myApplicationsAppMyTag...
7
private static PDFDecrypter createStandardDecrypter( PDFObject encryptDict, PDFObject documentId, PDFPassword password, Integer keyLength, boolean encryptMetadata, StandardDecrypter.EncryptionAlgorithm encryptionAlgorithm) throws ...
9
protected void _realSendMessage() { if(null == _m_scSocket) return ; if(!_m_scSocket.isConnected()) { ALBasicSendingClientManager.getInstance().addSendSocket(this); return ; } boolean needAddToSendList = false; _lockBuf();...
9
public static void main(String[] args) { System.out.println(HeaderType.valueOf("id").toString()); }
0
public static PairedAlignment getAlignment(String s1, List<IndividualEdit> edits) throws Exception { final StringBuffer top = new StringBuffer(); final StringBuffer bottom = new StringBuffer(); int index=0; for( IndividualEdit ie : edits) { if( ie.getPostion() > index && index < s1.length() ) {...
7
public void testDate2String() { Calendar calendar = Calendar.getInstance(); calendar.set(2012, Calendar.SEPTEMBER, 22, 9, 18, 1); String date = DateUtils.date2String(calendar.getTime()); assertEquals("2012-09-22 09:18:01", date); date = DateUtils.date2String(calendar.getTime(), "yyyy-MM-dd"); assertEquals(...
0
protected boolean shouldPaint(final int horizIteration, final int verticalIteration) { if (horizIteration < 0) { throw new IllegalArgumentException(String.format( "Passed horizIteration must be greater equal than 0! %d given.", horizIteration)); } ...
6
public static void main(String[] args) { BigInteger secwet = new BigInteger("1234"); System.out.println("in: " + secwet.toString(2)); System.out.println(); int bitlen = secwet.bitLength(); bitlen += 3; int k = 3, k2 = 3; SecretSend s = new SecretSend(secwet, k, ...
9
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 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
@Override public List<Action> cleanup() { List<Action> ret = super.cleanup(); // move arrows and kill hunters / wumpii List<Actor> toKill = new ArrayList<Actor>(); for(Actor arrow : Groups.ofType(Arrow.class, model.actors)) { MoveAction move = new MoveAction(model, ((Arrow)arrow).nextLocation(), arrow); ...
5
public static float getFloat() { float x = 0.0F; while (true) { String str = readRealString(); if (str == null) { errorMessage("Floating point number not found.", "Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE); } ...
4
static FrequencyTable readFrequencies(BitInputStream in) throws IOException { int[] freqs = new int[3]; for (int i = 0; i < 2; i++) freqs[i] = readInt(in, 32); freqs[2] = 1; // EOF symbol return new SimpleFrequencyTable(freqs); }
1
public final JPoclASTParser.expr0_return expr0() throws RecognitionException { JPoclASTParser.expr0_return retval = new JPoclASTParser.expr0_return(); retval.start = input.LT(1); TypeTree root_0 = null; Token set79=null; JPoclASTParser.expr1_return expr178 =null; JPoc...
7
@Override public boolean register(Player player) { if (_started == false && player.getName() != "" && _list.size() <= 4) { _list.add(player); new GUI(); return true; } if (_started == true || player.getName() == "") { return false; } return false; }
5
public static int addConnectionThread(Thread con) { boolean added = false; int num = 0; for(int k = 0;k<=5;k++) { if(MainThread.uploadConnectionThreads[k] == null && added == false) { MainThread.uploadConnectionThreads[k] = con; added = true; } } if(added = false) { return 99; ...
4
@Override public void processKeyEvent(KeyEvent keyEvent) { final int VK_LEFT = 0x25; final int VK_RIGHT = 0x27; final int VK_UP = 0x26; final int VK_DOWN = 0x28; final int VK_JUMP = 0x42; final int VK_W = 0x57; final int VK_S = 0x53; final int VK_A = 0x41; final int VK_D = 0x44; ...
9
private void processEvent(BaseEvent event) { // Retrieve all eventlisteners that are subscribed to this eventtype. ArrayList<IEventListener> listeners = listenerMap.get(event.getEventType().getID()); if(listeners == null) { return; } for(IEventListener ie : listeners) { // handleE...
4
public void Solve() { HashSet<Integer> numbers = new HashSet<Integer>(); for (int a = 1; a < 100; a++) { for (int b = a; b < 10000; b++) { int c = a * b; ArrayList<Integer> temp = new ArrayList<Integer>(); temp.addAll(GetDigits(a)); ...
7
public String toString() { String rep = ""; for (int i = 0; i < this.board.length; i++) { for (int j = 0; j < this.board[i].length; j++) { rep += MoveHandler.convertIntToPieceString(this.board[i][j], true) + " "; } rep += "\n"; } return rep; }
2
static final public int one_line() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case MINUS: case CONSTANT: case 12: sum(); jj_consume_token(11); {if (true) return 0;} break; case 11: jj_consume_token(11); {if (true) return 1;} break; defau...
7
public void berechneRestzeit(Date end) { Date now = new Date(); //current date long diff = end.getTime() - now.getTime(); //milliseconds long days = diff/(1000*60*60*24); long hours = (diff-days*1000*60*60*24)/(1000*60*60); long minutes = (diff-days*1000*60*60*24-hours*1000*60*60)/(1000*60); String rest = "...
5
public static boolean join(Player player, String arena, BowSpleef plugin) { if (player.hasPermission("bs.join")) { if (BowSpleef.arenaConfig.contains("arenas." + arena)) { if (BowSpleef.arenaConfig.getBoolean("arenas." + arena + ".enabled")) { if (!BowSpleef.arenaConfig.getBoolean("arenas." + ar...
9
public PartieDeRisk(int nombreDeJoueurs) { this.plateau = new Plateau(); this.nombreDeJoueurs = nombreDeJoueurs; this.joueursDeLaPartie = new Joueur[nombreDeJoueurs]; int[] total = new int[6]; switch (nombreDeJoueurs) { case 2: total[0] = 21; total[1] = 21; this.nbRenfortPremierTour = 40; ...
7
void addShapelessRecipe(ItemStack var1, Object ... var2) { ArrayList var3 = new ArrayList(); Object[] var4 = var2; int var5 = var2.length; for(int var6 = 0; var6 < var5; ++var6) { Object var7 = var4[var6]; if(var7 instanceof ItemStack) { var3.add(((ItemStack)var7)....
4
public List<Interval> merge(List<Interval> intervals) { int size = intervals.size(); if(size <= 1) return intervals; Collections.sort(intervals, new Comparator<Interval>(){ @Override public int compare(Interval A, Interval B) { if(A.start < B.start) return -1; if(A.start ...
6
static int checkStyle(Shell parent, int style) { int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL; if ((style & SWT.SHEET) != 0) { style &= ~SWT.SHEET; if ((style & mask) == 0) { style |= parent == null ? SWT.APPLICATION_MODAL : SWT.PRIMARY_MODAL; } } if ((style & mask)...
8
private static Binomialnode merge(Binomial heap1, Binomial heap2) { //Jos toisen juuri on tyhjä, palautetaan suoraan toinen if (heap1.root == null) { return heap2.root; } else if (heap2.root == null) { return heap1.root; } //Kumpikaan juurilista ei siis ol...
7
public BinaryLogicalOperator<Boolean> getOperator() { return binaryLogicalOperator; }
0
protected int byteArrayToInt(byte[] bytes) { int result = 0; int l = bytes.length - 1; for (int i = 0; i < bytes.length; i++) { if (i == l) result += bytes[i] << i * 8; else result += (bytes[i] & 0xFF) << i * 8; } return result; }
2
@Override public double[] get2DData(int px, int pz, int sx, int sz) { double[] da = a.get2DData(px, pz, sx, sz); double[] db; if(a == b) db = da; else db = b.get2DData(px, pz, sx, sz); int s = sx*sz; for(int i = 0; i < s; i++) da[i] = da[i] > db[i] ? da[i] : db[i]; ...
3
protected static Ptg calcDGet( Ptg[] operands ) { if( operands.length != 3 ) { return new PtgErr( PtgErr.ERROR_NULL ); } DB db = getDb( operands[0] ); Criteria crit = getCriteria( operands[2] ); if( (db == null) || (crit == null) ) { return new PtgErr( PtgErr.ERROR_NUM ); } int fNum = db.findC...
8
public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // LEFT_RHINO_ID return LEFT_RHINO_ID; case 2: // LEFT_TITAN_ID return LEFT_TITAN_ID; case 3: // RIGHT_RHINO_ID return RIGHT_RHINO_ID; case 4: // RIGHT_TITAN_ID ret...
6
public static void runFileDataBaseEditor(){ frames.runFileDataBaseEditor(); frames.getFileDataBaseEditor().setVisible(true); }
0
private static Move ForwardLeftForBlack(int r, int c, Board board){ Move forwardLeft = null; assert(board.cell[r][c] == CellEntry.black || board.cell[r][c] == CellEntry.blackKing); if( r>=1 && c<Board.cols-1 && board.cell[r-1][c+1] == CellEntry.empty ...
4
public Section(int sectionId, String name, Subject subject, Schedule schedule, Teacher teacher) throws ScheduleConflictException { if (sectionId < 0) { throw new IllegalArgumentException("Section id must not be negative."); } if (name == null) { throw new IllegalArgumentException("Section name must not ...
7
@EventHandler(priority=EventPriority.LOWEST, ignoreCancelled=true) public void onPlayerPortal(PlayerPortalEvent event1) { if(debug) this.getLogger().info("PlayerPortalEvent cast"); UnitedPortalEvent ev=new UnitedPortalEvent(event1); if(!chevronFinder(ev)) { if(gateHandler(ev)) { ...
7
private static int myRecursiveMethod(int aValue) { aValue--; System.out.println(aValue); if(aValue == 0) { return 0; } return myRecursiveMethod(aValue); }
1
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 void PerformIPTest() { if(!responseServer.running) { gameList.clear(); UpdateGameList(); } responseServer.startServerIPTest(); }
1
public boolean isSatisfied() { return Satisfied; }
0
public void setUp() { Scanner scanner = new Scanner(System.in); setAquarium(scanner); setVictims(scanner); setStepToVictim(scanner); setPredators(scanner); setStepToPredator(scanner); setHurdles(scanner); setLengthLifeInAquarium(scanner); }
0
public int getCityID(){ return targetCityID; }
0
public JCheckBoxMenuItem getAcceptByHaltingCheckBox() { return turingAcceptByHaltingCheckBox; }
0
private User findGameHostByID(String gameHostID) { for (int i = 0; i < availableGames.size(); i++) { if (availableGames.get(i).getID().equals(gameHostID)) { return availableGames.get(i); } } return null; }
2
public void setInterpolationMethod(int interpolationMethod) { switch(interpolationMethod) { case INTERPOLATE_REGRESSION: calculateBestFitLine(); case INTERPOLATE_LEFT: case INTERPOLATE_RIGHT: case INTERPOLATE_LINEAR: this.interpolationMethod = interpolationMethod; break; default: this.i...
4
private String startSetToString() { StringBuffer FString = new StringBuffer(); boolean didPrint; if (m_starting == null) { return getStartSet(); } for (int i = 0; i < m_starting.length; i++) { didPrint = false; if ((m_hasClass == false) || (m_hasClass == tru...
7
private void FindObjectInRow (ABObject target, List<ABObject> objects, List<ABObject> directList) { for (int i = 0; i < objects.size(); i++) { if (directList.size() <= 3) { ABObject x = objects.get(i); if (x.getCenterX() >= target.getMaxX() && x.getCenterX() <= target.getMaxX() + 10) { if (x...
6
public static boolean isValidTime(String time) { String[] times = time.split(":"); for (int i = 0; i < times.length - 1; i++) if (!isInteger(times[i])) return false; if (!isDouble(times[times.length - 1])) return false; return true; ...
3
public boolean stateEquals(Object o) { if (o == this) return true; if (o == null || !(o instanceof MersenneTwister)) return false; MersenneTwister other = (MersenneTwister) o; if (mti != other.mti) return false; for (int x = 0; x < mag01.length; x++) if (m...
8
private static void method499(char arg0[]) { boolean flag = true; for (int chars = 0; chars < arg0.length; chars++) { char c = arg0[chars]; if (Censor.isLetter(c)) { if (flag) { if (Censor.isLowerCaseLetter(c)) { flag = false; } } else if (Censor.isUpperCaseLetter(c)) { arg0[chars...
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FloatPair floatPair = (FloatPair) o; return(floatPair.first == first && floatPair.second == second); }
4
public JmeControlsDemoScreenController(final String ... mapping) { if (mapping == null || mapping.length == 0 || mapping.length % 2 != 0) { logger.warning("expecting pairs of values that map menuButton IDs to dialog IDs"); } else { for (int i=0; i<mapping.length/2; i++) { String menuButtonId...
5
public int[][] setMatrixZeros(int[][] m){ int nRow = m.length; int nColumn = m[0].length; //find all rows and columns should be set to zero boolean[] isZeroRow = new boolean[nRow]; boolean[] isZeroColumn = new boolean[nColumn]; for(int i=0;i<nRow;i++){ for(int j=0;j<nColumn;j++){ if(m[i][j]==0){ ...
7
public Object getElement(int index) { if (indexOK(index)) { return array[index]; } return null; }
1
private void getFileNameImage(String line) { StringTokenizer tokens = new StringTokenizer(line); if (tokens.countTokens() == 2) { tokens.nextToken(); // skip command label loadSingleImage(GameController.IMAGES_DIR + tokens.nextToken(), "", 1.0f, (short) -1, (short) -1, (short...
2
public void generateUsers(int nb) { String line; int end = currentLine + nb; int i = 0; InputStream is = null; BufferedReader br = null; try { is = getClass().getClassLoader().getResourceAsStream("data/data.csv"); br = new BufferedReader(new Inpu...
7
public void train(Vector labelset, Matrix dataset) throws TrainingException { if (labelset.size() != dataset.columnSize()) { throw new CardinalityException(labelset.size(), dataset.columnSize()); } boolean converged = false; int iteration = 0; while (!converged) { if (iteration > 10...
8
@Override public void apply(Graphics2D g) { g.setColor(new Color(color)); g.setStroke(new BasicStroke(strokeSize, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); int minX = Math.min(x, width); int minY = Math.min(y, height); int maxX = Math.max(x, width); int maxY = Math.max(y, height); int width = m...
4
public synchronized void run() { long lastMinute = System.currentTimeMillis(); long lastTime = System.nanoTime(); double nsPerTick = 1000000000 / 60.0; int frames = 0; long lastTimer = System.currentTimeMillis(); double delta = 0; while (running) { try { if (System.currentTimeMillis() > lastMinute...
7