text
stringlengths
14
410k
label
int32
0
9
public void mend() { }
0
public SplashPicture(String pathToFile) { BufferedImage bimg = null; try { bimg = ImageIO.read(new File(pathToFile)); img = new ImageIcon(bimg).getImage(); } catch (Exception e) { } if (img == null || bimg == null) { try { bimg = ImageIO.read(new File("/splash.png")); img = new ImageIcon(bi...
7
public ResultSet checkDoctor(String doctor_info) { try { // checking whether the user enters employee no or doctor name if (Helper.isInteger(doctor_info)) { String selectDoctorByNoQuery = "SELECT * FROM DOCTOR WHERE employee_no = " + Integer.parseInt(doctor_info); rs = stmt.executeQuery(selectDoct...
2
private boolean _uacExists(String target) { Connection conn = null; int count = 0; try { //Class.forName("com.mysql.jdbc.Driver").newInstance(); String usern = "ultracam"; String passw = "nogales"; String url = "jdbc:mysql://" + UAC_DATABASE_HOST + "/uac"; conn = DriverManager.getConnection(url,use...
5
private void processHeaders(HttpURLConnection conn) throws Exception{ headers = new HashMap<String, String>(); cookies = new HashMap<String, String>(); //================================= //get headers, cookies, etc. for (int i=0; ; i++) { //get headers from header field String headerName = conn....
5
public void plusBonusScore(PinCount knockOverCount) { Integer knockOverPinCount = knockOverCount.intValue(); if (getScoreStatus() == ScoreStatus.NEXT_BALL) { score += knockOverPinCount; } if (scoreStatus == ScoreStatus.NEXT_TWO_BALL) { scoreStatus = ScoreStatus.NEXT_BALL; } else if (scoreStatus == Sco...
3
public boolean isWithinCastlePixelPos(Enemy currentEnemy) { if ( isWithinCastle(getPosOnGrid(currentEnemy.getCenterOfObject()))) { return true; } return false; }
1
public static Codec[] makeFilters() { // Set up the file filters. Universe.CHOOSER.resetChoosableFileFilters(); List decoders = Universe.CODEC_REGISTRY.getDecoders(); Iterator it = decoders.iterator(); while (it.hasNext()) Universe.CHOOSER.addChoosableFileFilter((FileFilter) it.next()); Universe.CHOOSER....
2
public void scrub() { append(" Detergent.scrub()"); super.scrub(); // Call base-class version }
0
public String convert(String s, int nRows) { if(nRows<=1){ return s; } int len = s.length(); String[] temp = new String[nRows]; for (int i =0;i<nRows;i++) temp[i] = ""; int size = 2*(nRows-1); for(int i=0;i<nRows;i++){ for (int ...
9
private void setCodeAndMessage( int code, String m ) throws InvalidDataException { if( m == null ) { m = ""; } // CloseFrame.TLS_ERROR is not allowed to be transfered over the wire if( code == CloseFrame.TLS_ERROR ) { code = CloseFrame.NOCODE; m = ""; } if( code == CloseFrame.NOCODE ) { if( 0 < ...
4
private boolean checkForErrors(DatagramPacket packet, int expectedtype, DatagramSocket socket){ DatagramPacket err = null; boolean goodPacket = true; if(packet.getData()[1] == 5){ System.out.println(ExtractErrorMsg(packet)); return false; } if(packet.getData()[0] != 0){ ...
9
public void update() { if (timer > 10000) { Random rand = new Random(); boolean ok = false; while(!ok) { int randomInt = rand.nextInt(100); if (randomInt <= pbedroom1) { room = map.getRooms().get(0); if(room.getHumans() == 0) ok = true; } else if (randomInt <= pbedroom2...
9
public boolean check(int dir, int cnt) { cnt++; if((dir<0)) dir=7; if((dir>7)) dir=0; Coordinate Coo = ausDirzuCoo(dir); // Diese Methode �berpr�ft anhand der Richtung, die �bergeben wird, die n�chste Koordinate und schaut, if(checkFreePosition(Coo.getXCoordinate(),Coo.getYCoordinate())){ // ob di...
8
public static Timing fromLineIndexAndMeasureSize(int lineIndex, int numberLinesInMeasure) { int length; if (lineIndex != 0) { int gcd = getGCD(numberLinesInMeasure, lineIndex); length = numberLinesInMeasure / gcd; } else { return Timing.L1ST; } switch(length) { case 8: return Timing.L8TH; cas...
8
@SuppressWarnings("deprecation") public void testIsContiguous_RP() { YearMonthDay ymd = new YearMonthDay(2005, 6, 9); assertEquals(true, DateTimeUtils.isContiguous(ymd)); TimeOfDay tod = new TimeOfDay(12, 20, 30, 0); assertEquals(true, DateTimeUtils.isContiguous(tod)); Partia...
1
private static String getFullMachineID() throws Exception { String MachineID = null; String localIP=null; String timestamp=null; try{ Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()){ NetworkInterface current = interfaces.next...
8
@Override public boolean find(E d) { if(list == null) return false; if (list.data.compareTo(d) == 0) { return true; } else if (list.data.compareTo(d) < 0) { while (list.next != null) { list = list.next; if (list.data.compareTo(d) == 0) { return true; } } } else { while (li...
7
public About(){ // anti-aliasing on System.setProperty("awt.useSystemAAFontSettings", "on"); editorPane = new JEditorPane(); editorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); editorPane.setFont(new Font("Arial", Font.BOLD, 13)); editorPane.setPreferredSize...
7
public DarkSnakeLord(int room) { super(new FrostDiver(), new DarkBreath(), 83.00*room, 164.00*room, 80.00*room, 2.0*room, 70.0*room, 62.0*room, "Dark Snake Lord"); } // End DVC
0
static final byte[] method850(boolean flag, Object obj, int i) { if (obj == null) { return null; } if (obj instanceof byte[]) { byte abyte0[] = (byte[]) obj; if (!flag) { return abyte0; } else { return Class52.method...
5
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)) &&((msg.sourceMinor()==CMMsg.TYP_DEATH) ||(msg.sourceMinor()==CMMsg.TYP_QUIT) ||(msg.sourceMinor()==CMMsg.TYP_RECALL) ||(msg.sourceMinor()...
9
public void setSuccessors() { for(String key1: this.getActiveKeys()) { long min = 10000007L; long max = 0L; long temp = 10000007L; String result = ""; for(String key: this.getActiveKeys()) { if(!this.getMember(key).isDeletable()) { if(getHashValue(key) < min) { min = getHashValue(key); ...
8
public void save() { switches = "@Switch:"; if(rdbtnA.isSelected()) { switches += "a:"; } else if(rdbtnB.isSelected()) { switches += "b:"; } else if(rdbtnC.isSelected()) { switches += "c:"; } else if(rdbtnD.isSelected()) { switches += "d:"; } if(rdbtnEnable.isSelected()) { switches += "t...
6
public static JavaScriptObject getJsObj(NameValuePair[] nameValuePairs) { JavaScriptObject paramObj = JsoHelper.createObject(); if (nameValuePairs == null) return paramObj; for (int i = 0; i < nameValuePairs.length; i++) { NameValuePair param = nameValuePairs[i]; switch (param.getType()) { case STRIN...
7
@Override public void render(GameContainer container, Graphics g) { switch (side) { case TOP: g.setColor(Color.red); break; case LEFT: g.setColor(Color.green); break; case BOTTOM: g.setColor(Color.blue); break; case RIGHT: g.setColor(Color.yellow); break; } g.fill(new Rectangle...
4
@Test public void TestImage() { MarketSession session = new MarketSession(); session.login("antoine.souchet@gmail.com", "coucou2031"); //v2:com.sg.js.Doubles:1:3 //-7934792861962808905 GetImageRequest imgReq = GetImageRequest.newBuilder().setAppId("8885807488756673114") ...
1
private void Slowdown(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Slowdown if (currSpeed > 1) { --currSpeed; world.setSpeed(currSpeed); speedCounter.setText("Speed: " + currSpeed); } }//GEN-LAST:event_Slowdown
1
private Word checkConnector(int begin, int end) { if (end == -1) { // check connector on the left if (!currSen.connector.isEmpty()) { for (Word w : currSen.connector) { int pos = WPos2Chunk(w.pos); if (pos == begin || pos - 1 == begin) { ...
7
private static void readProperties(NodeList children, Properties props) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if ("property".equalsIgnoreCase(child.getNodeName())) { final String key = getAttributeValue(child, "name"); ...
7
public void stop() { stop = true; sock.close(); }
0
public Facelet getFace(Face face) { switch(face) { case FRONT: return getFrontFace(); case LEFT: return getLeftFace(); case RIGHT: return getRightFace(); case BOTTOM: return getBottomFace(); case TOP: return getTopFace(); case BACK: return getBackFace(); } return Facelet....
6
public int[] maxSlidingWindow(int[] nums, int k) { if (nums == null || nums.length == 0 || nums.length < k) { return new int[0]; } int[] result = new int[nums.length - k + 1]; ArrayDeque<Integer> deque = new ArrayDeque<Integer>(); for (int i = 0; i < nums.length; i++) { while (!deque.isEmpty() ...
8
public ListNode partition(ListNode head, int x) { ListNode smallerHead = null, smallerTail = null, biggerHead = null, biggerTail = null; while (head != null) { int val = head.val; if (val < x) { if (smallerHead == null) { smallerHead = head; ...
7
public int reverse(int x) { if (x == Integer.MIN_VALUE) throw new NumberFormatException("Can not revese" + x); boolean negative = x < 0; if (negative) x = -x; StringBuffer it = new StringBuffer(); it.append(x); it.reverse(); return negative...
3
private boolean remove(int target) { // Student will replace this return statement with their own code: return false; }
0
public void setNewValue(String newValue){ this.newValue.setText(newValue); }
0
public int getUpperLeftY() { if (y1 > y2) { return y1; } else { return y2; } }
1
public void guiForSavingTheOutputFileWithXmlOrSpecialChars() { frmSavingTheOutputFileWithXmlOrSpecialChars.setSize(400, 300); frmSavingTheOutputFileWithXmlOrSpecialChars .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmSavingTheOutputFileWithXmlOrSpecialChars.setVisible(true); frmSavingTheOutputFileWith...
4
private LocalVarEntry find(int addr) { LocalVarEntry li = list; while (li != null && li.endAddr < addr) li = li.next; if (li == null || li.startAddr > addr) { return null; } return li; }
4
private static List<int[]> startFolkRankCreationForResources(BookmarkReader reader, int sampleSize) { int size = reader.getBookmarks().size(); int trainSize = size - sampleSize; List<Map<Integer, Integer>> userMaps = Utilities.getUserMaps(reader.getBookmarks()); System.out.println("\nStart FolkRank Calculat...
4
public String toString() { String sql = "REPLACE "+table; if(expressions != null && columns != null ) { //the SET col1=exp1, col2=exp2 case sql += " SET "; //each element from expressions match up with a column from columns. for (int i = 0, s = columns.size(); i < s; i++) { sql += ""+columns.get(...
7
public int get(int x, int y) { if (x < 0 || y < 0 || x > 3 || y > 3) throw new IllegalArgumentException("The position must be on range"); return this.board[x][y]; }
4
public boolean equals (Object o) { if (!(o instanceof Argument)) return false; Argument a = (Argument)o; return ((a.arg_label == arg_label) || (a.arg_label != null && a.arg_label.equals(arg_label))) && ((a.mod_label == mod_label) || ...
9
public boolean isPreselectionValid(final SettingsData settingsData) { if(settingsData.getObjects().size() != 1){ _tooltipText = "Genau ein Objekt muss ausgewählt sein."; return false; } if(settingsData.getObjects().get(0) instanceof ClientApplication && (settingsData.getAttributeGroup() == null || sett...
7
public void visitIntInsn(final int opcode, final int operand) { if (opcode == SIPUSH) { minSize += 3; maxSize += 3; } else { minSize += 2; maxSize += 2; } if (mv != null) { mv.visitIntInsn(opcode, operand); } }
2
public boolean isAccepted() { Iterator it = myConfigurations.iterator(); while(it.hasNext()) { MealyConfiguration config = (MealyConfiguration) it.next(); if(config.isAccept()) return true; } return false; }
2
private void field_sit_frente_ivaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_sit_frente_ivaFocusLost if((field_sit_frente_iva.isEditable())&&(validar.isInt(field_calle.getText()))){ boolean es_componente=false; //voy a preguntar si la componente que me saco el foco ...
9
private byte[] fetchClassFromFS(String path) throws FileNotFoundException, IOException { InputStream is = new FileInputStream(new File(path)); // Get the size of the file long length = new File(path).length(); if (length > Integer.MAX_VALUE) { // File is too large }...
4
public static <T, S> void selectGroupedFields(CriteriaBuilder cb, CriteriaQuery<S> criteria, Root<T> root, List<String> group) { List<Selection<?>> listSelection = new ArrayList<Selection<?>>(); if (group != null) { for (String currentVal : group) { /** * separate field and function */ Strin...
8
public static List<Measurement> loadMeasurements(Mouse mouse) { ArrayList<Measurement> measurements = new ArrayList<>(); try (BufferedReader measurementReader = new BufferedReader( new FileReader(mouse.getFileName()))) { String measurementString; while ((measurementString = measurementReader.readLine()...
5
@Override public void itemStateChanged(ItemEvent e) { //To change body of implemented methods use File | Settings | File Templates. if (e.getStateChange() == ItemEvent.SELECTED) { Object item = e.getItem(); // do something with object if(item instanceof Persoon) {...
3
public com.novativa.www.ws.streamsterapi.Trade[] getTrades() throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.setOperation(_operations[3]); ...
4
@SuppressWarnings("deprecation") public static void createPet(LivingEntity e, UUID toFollow) { try { Object nms_entity = ((CraftLivingEntity) e).getHandle(); if (nms_entity instanceof EntityInsentient) { PathfinderGoalSelector goal = (PathfinderGoalSelector) goalSelector.get(nms_entity); PathfinderGo...
2
public static Type getObjectType(final String internalName) { char[] buf = internalName.toCharArray(); return new Type(buf[0] == '[' ? ARRAY : OBJECT, buf, 0, buf.length); }
1
public CommandLineMode(String propertyFileName, Controller controller){ this.controller = this.controller; try { controller.loadPropertiesFromFile(new File(propertyFileName)); int width = controller.getPanelWidth(); int height = controller.getPanelHeight(); ...
2
public void Loading(){ ServerUp=true; isPainted=false; while(ServerUp){ repaint(); try{Thread.sleep(OPTIMAL_TIME/1000000);}catch (Exception e) {} if(isServer&&sendMap){ server.sendData(("2 "+Main.mapaS+" ").getBytes()); } if(!isServer) client.sendData("1 ".getBytes()); if...
6
private JPanel buildButtons() { JPanel panel = new JPanel(new BorderLayout()); panel.setMaximumSize(new Dimension(2000,50)); JButton deleteButton = new JButton("Delete"); deleteButton.setFocusable(false); deleteButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEv...
8
@Override void handleInput(Input input, boolean isMousePressed) { if (input.isKeyPressed(Input.KEY_ENTER) && !hasMadeChoice()) { makeChoice(selectedChoice); } int numberOfButtons = choiceButtons.getNumberOfButtons(); if (input.isKeyPressed(Input.KEY_RIGHT)) { selectedChoice = (selectedChoice + 1) % numb...
4
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 fe...
6
public ArrayList<Tayte> haeFantasiaTaytteet(int tayteId1, int tayteId2, int tayteId3, int tayteId4) throws DAOPoikkeus { ArrayList<Tayte> fantasiataytteet = new ArrayList<Tayte>(); // Avataan yhteys Connection yhteys = avaaYhteys(); try { // Haetaan tietokannasta täytteet Fantasiapizzaa varten ...
3
public void validateForFile(ScriptRunner pScriptRunner, PromotionFile pPromotionFile) throws ExPromote { List<Closeable> lStreamsToClose = new ArrayList<Closeable>(); try { for(ScriptExecutable lExecutable : mExecutableList){ if(lExecutable instanceof ScriptSQL){ //If this fails an...
4
public void hit(Entity e, Level level) { if (e instanceof CoinEntity) { CoinEntity ce = ((CoinEntity) e); if (!ce.collected) { score++; Sound.coin.play(); ce.collected = true; } } if (e instanceof SoildEntity) { health--; System.out.println(health); System.out.println(MAX_HEA...
4
private static void doFind() throws MVDToolException { try { char[] pattern = new char[findString.length()]; findString.getChars(0,pattern.length,pattern,0); if ( pattern.length > 0 ) { MVD mvd = loadMVD(); BitSet bs = new BitSet(); if ( version == 0 ) { for ( int...
5
private int getfittestParticle(Vector<Integer> particles) { if(maximum){ double fitness = solutionFitness.get(particles.get(0)); int result = particles.get(0); for(int i = 1; i < particles.size(); i++){ double temp = solutionFitness.get(particles.get(i)); if(temp > fitness){ fitness = temp; ...
5
public static void main(String[] args) { TalkToMe ttm; if (args.length != 0 && args[0].equalsIgnoreCase("g")) { ttm = new TalkToMe(args); try { ttm.readFile(ttm.filename); } catch (Exception ex) { ttm.guiMode.setMsgToChat(ERROR_READ_FIL...
4
public void initialize() { setLayout(new MigLayout("wrap 1", "", "")); add(question, "wrap 20"); int recruitPrice = 0; Player player = getMyPlayer(); if ((getGame() != null) && (player != null)) { int production = 0; for (Colony colony : player.getColo...
6
public void actionPerformed(ActionEvent e) { beginQuit(); }
0
public void print(Byte[] jeu){ for (int i=0; i < 37; i++){ if (i==4 || i==9 || i==15 || i==22 || i==28 || i==33) System.out.println(); System.out.print(jeu[i]); } System.out.println(); }
7
public boolean promoteUser(String name){ //op a user by name UserAccount user = users.get(name.toLowerCase()); if (user==null) return false; user.setIsAdmin(true); if (user.getThread()!=null) user.getThread().send("You are now op!"); return true; }
2
@Override protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException { _Fields setField = _Fields.findByThriftId(field.id); if (setField != null) { switch (setField) { case TITAN_ID: ...
5
@Override public void main() { cleanOutput(); List<String> list = new ArrayList<String>(); list.add("1"); list.add("2"); list.add("3"); list.add("4"); list.add("5"); Iterator<String> it = list.iterator(); String s; while(it.hasNext()) { s = it.next(); if (s.equals("4")) { it.remove...
2
public void stop() { if (isMovingRight() == false && isMovingLeft() == false) { playerSpeedX = 0; } if (isMovingRight() == false && isMovingLeft() == true) { moveLeft(); } if (isMovingRight() == true && isMovingLeft() == false) { moveRight(); ...
6
private static void createAndShowGUI() { //Check the SystemTray support if (!SystemTray.isSupported()) { System.out.println("SystemTray is not supported"); return; } final PopupMenu popup = new PopupMenu(); // Create a popup menu components Men...
6
public String getCode() { return code; }
0
public static String computeCommonLispFileExtension(Keyword type) { if (!(Stella.runningAsLispP())) { throw ((StellaException)(StellaException.newStellaException("Shouldn't call COMPUTE-COMMON-LISP-FILE-EXTENSION unless running in Lisp").fillInStackTrace())); } { String suffix = null; if (type ...
7
public static BufferedImage rotate(BufferedImage src, Rotation rotation) throws IllegalArgumentException, ImagingOpException { long t = System.currentTimeMillis(); if (src == null) throw new IllegalArgumentException("src cannot be null"); if (rotation == null) throw new IllegalArgumentException("rotatio...
9
public static String readFile2(String file) throws IOException{ //System.out.println("path : " + path + " reading..."); Watch t = new Watch();t.start(); System.out.println("read......"); String sJSON = ""; Path path = Paths.get(file); List<String> text =Files.readAllLines(path,StandardCharsets.UTF_8); ...
5
public void broadcastPQ(final BigInteger p, final BigInteger q, final int numUsers) throws InterruptedException, IOException { final Subscription pqSub = elvin.subscribe(NOT_TYPE + " == '" + BROADCAST_PQ_REPLY + "' && " + GAME_ID + " == '" + gameHost.getID() + "'"); Notification pqnot = new Notification...
1
public float median() { Collections.sort(data); if (data.size() % 2 == 0) { return (data.get(data.size() / 2 - 1) + data.get(data.size())) / 2; } return data.get(data.size() / 2); }
1
public KiesOnderwerp(Spel spel) { setBounds(0, 0, 773, 318); setLayout(new MigLayout("", "[100px:100px:100px,grow][700px,grow][100px:100px:100px]", "[173.00px][150.00][150px][173.00px,grow]")); /** * De titel "Kies een onderwerp" */ JLabel lblNewLabel = new JLabel("Kies een onderwerp"); lblNewLabel...
2
/* */ public static String excutePost(String targetURL, String urlParameters) /* */ { /* 54 */ HttpURLConnection connection = null; /* */ try /* */ { /* 57 */ URL url = new URL(targetURL); /* 58 */ connection = (HttpURLConnection)url.openConnection(); /* 59 */ connection.se...
3
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Timing that = (Timing) o; if (Double.compare(that.ioResponseTime, ioResponseTime) != 0) return false; if (Double.compare(that.worstReadeTime, w...
8
public Plateau() { this.plateau = new EtatDesCases[LONGUEUR_DE_LA_MAP][LARGEUR_DE_LA_MAP]; for (int indiceParcoursLongueurMap=0; indiceParcoursLongueurMap<LONGUEUR_DE_LA_MAP; indiceParcoursLongueurMap++) for (int indiceParcoursLargeurMap=0; indiceParcoursLargeurMap<LARGEUR_DE_LA_MAP; indiceParcoursLargeurMap++...
2
private static List<? extends Tuple> toList(Object[][] table) { List<Tuple> list = new ArrayList<>(table.length); for (Object[] aTable : table) { List<Value> row = new ArrayList<>(aTable.length); for (Object val : aTable) { if (val instanceof DataType) { ...
9
public void writeResultFile() { try { FileWriter fstream = new FileWriter(resultFile); StringBuilder sb = new StringBuilder(); BufferedWriter out = new BufferedWriter(fstream); sb.append("StartNr; Namn; "); if(!(driverAttributes == null) && !driverAttributes.isEmpty()){ for(int i = 0; i < driverAtt...
9
public void addValue(double dist, Object value) { // If there is still room in the heap if (values < size) { // Insert new value at the end data[values] = value; distance[values] = dist; upHeapify(values); values++; } // If there is no room left in the heap, and the new entry is lower ...
2
public int getForce() { return force; }
0
@BeforeClass public static void initServices() throws Exception { ServiceManager.getServices().initializeServices( new Object[] { new TestRailwayRepository()}); }
0
public static final float atan2(float y, float x) { float add, mul; if (x < 0) { if (y < 0) { y = -y; mul = 1; } else mul = -1; x = -x; add = -3.141592653f; } else { if (y < 0) { y = -y; mul = -1; } else mul = 1; add = 0; } float invDiv = 1 / (((x < y) ? y : x) * I...
4
@Override protected List<Chromosome> filter(List<Chromosome> children) { List<Chromosome> newChildren = new ArrayList<Chromosome>(); int repeats = 0; // Remove children which are too similar for (Chromosome c : children) { boolean unique = true; for (Chromosome c2 : children) { if (c == c2) continue;...
9
public void setMaxCapacity(int maxCapacity) throws CarriageException { if (maxCapacity >= 0) { this.maxCapacity = maxCapacity; } else { throw new CarriageException("Maximum capacity is under zero"); } }
1
public Problem11(){ loadData(); for(int x1 = 0; x1<20;x1++){ for(int y1=0;y1 < 20;y1++){ if(grid[x1][y1] > 0){ long dow = down(x1,y1); long acc = across(x1,y1); long dia1 = diagP(x1,y1); long diaN = diagN(x1,y1); long highest1 = (dow > acc)?dow:acc; long highest2 = (dia1 > ...
7
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Article)) { return false; } Article other = (Article) object; if ((this.articleID == null && other.articleID !=...
5
public static void preE(Topic root) { // Fetching the edge set for the topic ArrayList<SparseMatrix> getset = root.Get_edgeset(); //System.out.println("Edge size" + getset.size()); // Fetching the Max word it of the topic Integer MaxWordId = root.Get_Maxwordid(); // Fetching the edge weight acros...
7
public Instance convertInstance(Instance instance) throws Exception { if (m_s == null) { throw new Exception("convertInstance: Latent Semantic Analysis not " + "performed yet."); } // array to hold new attribute values double [] newValues = new double[m_outputNumAtt...
7
public void printMatrix() { // Column attributes stuff System.out.println(columnAttributes); System.out.println(); // Column names for (int i = 0; i < getNumCols(); i++) { System.out.printf("%15s", columnAttributes.get(i).getName()); } System.out.pri...
3
@SuppressWarnings("unchecked") private void readFile() { FileInputStream gfis = null, gcfis = null; ObjectInputStream gois = null, gcois = null; try { gfis = new FileInputStream(goodsURL); gcfis = new FileInputStream(goodsClassURL); if(gfis.available() > 0) gois = new ObjectInpu...
5
public Match requestNextMatch(int userID) { alstNewMatchRequests.add(userID); int userCount = 0; for (Team team : playmode.getTeams()) { userCount += team.getUser().length; } Match nextMatch = upcomingMatches.peek(); if((alstNewMatchRequests.size() - alstLeftUser.size()) == userCount){ nextMatch(userI...
2
public static String coverttoText(String rtfText) { byte[] rtfBytes = rtfText.getBytes(); RTFEditorKit rtfParser = new RTFEditorKit(); Document document = rtfParser.createDefaultDocument(); try { rtfParser.read(new ByteArrayInputStream(rtfBytes), document, 0); } catch (IOException e) { // TODO Auto-gene...
3