text
stringlengths
14
410k
label
int32
0
9
public static void cp(String srcPath, String dstPath) { FileChannel in = null; FileChannel out = null; FileInputStream inStream = null; FileOutputStream outStream = null; try { inStream = new FileInputStream(srcPath); outStream = new FileOutputStream(dstPath); in = inStream.getChannel(); out = out...
9
public CtMethod[] getDeclaredMethods() { CtMember.Cache memCache = getMembers(); CtMember mth = memCache.methodHead(); CtMember mthTail = memCache.lastMethod(); int num = CtMember.Cache.count(mth, mthTail); CtMethod[] cms = new CtMethod[num]; int i = 0; while (mth...
1
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); int currentY = 0; for (AccordionRootItem menu : getMenus()) { menu.setSize(this.getWidth(), this.menusSize); menu.setLocation(0, currentY); if (menu == lastSelectedMenu && !men...
6
private void writebuttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_writebuttonMouseClicked // TODO add your handling code here: String address=writeaddress.getText(); int addr=dec.NumberParser(address); int val=dec.NumberParser(writevalue.getText()); if(addr !...
2
private GameState carpenterDay(GameState state, Card card) { Color faction = card.getFaction(); if(state.getPlayer(faction).checkCPU()) { HashMap<GameState, String> choiceMap = dayActionWithPhrases(state, card); GameState choice = state.getPlayer(faction) .chooseState(choiceMap.keySet().toArray(ne...
5
private void igual() throws Exception{ op2 = pila.pop(); if (op2.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); op1 = pila.pop(); if (op1.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); Elem resultado = new Ele...
8
@Override protected void download() throws Exception { int currPage = 1; boolean hasPrev = true; while(currPage <= this.totalPages && hasPrev) { String url = String.format(Constant.VOA_AS_IT_IS_URL, currPage); Util.print("Fetching info from %s...", url); ...
9
@Override public String toString() { return "SkillRating [ skillId=" + skillId + ", ratingId=" + ratingId + ", givenBy=" + givenBy + "]"; }
0
public int getMachineIndexByName(String machineFileName){ ArrayList machines = getEnvironment().myObjects; if(machines == null) return -1; for(int k = 0; k < machines.size(); k++){ Object current = machines.get(k); if(current instanceof Grammar){ ...
4
public void setModel(String value) { this.model = value; }
0
public void WorldDone() { gameaction = gameaction_t.ga_worlddone; if (secretexit) players[consoleplayer].didsecret = true; if (isCommercial()) { switch (gamemap) { case 15: case 31: if (!secretexit) ...
9
public static QuadTree compressImage (int[][] image) { if (image == null) { throw new IllegalArgumentException(); } else if (image.length != image[0].length) { throw new IllegalArgumentException(); } else if (!((image.length & (image.length - 1)) == 0)) { //checks if power of 2 throw new IllegalArgumentE...
9
* @return continues with simulation */ @Override public boolean goOn(StochasticSimulator process) { if (process.getCurrentTime() >= maxTime) { // if exceed maxTime then stop return false; } else { // stop depending on mo...
3
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
8
public static void findCuts(String branch) { if (branch == null || branch.length() < 2) return; // structure representing each cut, which will be mapped in a hash table with the key "weight center-of-gravity" class WCG { int startIndex; int endIndex; WCG(int s, int e) { startIndex = s; ...
9
void onSpace () { if (focusItem == null) return; if (!focusItem.isSelected ()) { selectItem (focusItem, (getStyle () & SWT.MULTI) != 0); redrawItem (focusItem.index, true); } if ((getStyle () & SWT.CHECK) != 0) { focusItem.setChecked (!focusItem.checked); } showItem (focusItem); Event event = new Event ();...
4
public List<ModelFiledDesc> getFileds() { return fileds; }
0
private void erstelleXml() throws Exception { File file = new File(XMLPATH); if(file.createNewFile()) { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file)); writer.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"); writer.write("<struktur>\n"); writ...
3
public Testcase getTestcase(StringSearchAlgorithm alg, int inputNumber, int numberOfExecutions, boolean showResult) { File inputStringFile = new File(inputLocation + "source_string.i" + inputNumber); File searchStringFile = new File(inputLocation + "search_string.i" + inputNumber); BufferedReader reader = ...
4
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == d.wall) { d.mode = Mode.ADD_WALL; } if (e.getSource() == d.door) { d.mode = Mode.ADD_DOOR; } if (e.getSource() == d.enemy) { d.mode = Mode.ADD_ENEMY; } if (e.getSource() == d.trigger) { d.mode = Mode.ADD_TRI...
9
public static void saveRate(Rate r){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { conn.setAutoCommit(false); PreparedStatement ...
4
public void firstTraverse(TreeNode tr,String path){ if(tr.left==null && tr.right == null){ path+=tr.val; res.add(path); return; }else{ path= path+tr.val+"->"; } if(tr.left!=null) firstTraverse(tr.left,path); if(tr.right!=null) firstTraverse(tr.right,path); }
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 feel. * For details see http://down...
6
public boolean didTheySwear(String message) { boolean found = false; for (Map.Entry<String, String> entry : wordList.entrySet()) { String thisWord = entry.getKey(); String thisRegex = "\\b"+thisWord+"\\b"; Pattern patt = Pattern.compile(thisRegex, Pattern.CASE_INSENSITIVE); Matcher m = patt.ma...
2
@Override public void sendPackage(APacket p, IIOHandler target) { log.log(Level.FINE, "Sending Packet "+p+" to Target "+target); if(side == Side.CLIENT&&target!=LOCAL()) { if(SERVER != null) { SERVER.sendPacket(p); } else { log.log(Level.FINE,"SERVER is equivalent to null when sending Package! Packet...
4
public String getSuffixText(byte[] bytes, int offset) { try { String name= null; String pid= null; String exceptionMessage= null; StringBuffer suffix= new StringBuffer(); try { SystemObject object = getSystemObject(bytes, offset); if(object == null) return "id (null)"; name = object.getName...
8
public String retrieveValidPlateInfo(TableElement element) { String invalidEntries = "\n\n"; String invalidMessage = " contains invalid entry: "; // If everything is valid, then update the table element if (TextField.MJD.hasValidTextEntry() && TextField.PLATE.hasValidTextEntry() && TextField.FIBER.hasValidText...
9
CultureListDialog(java.awt.Frame parent) { super(parent, "Cultures", false); GenericObject cultureGroups = EUGFileIO.load(Main.filenameResolver.resolveFilename("common/cultures.txt"), ParserSettings.getNoCommentSettings()); ...
3
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
8
public static void setAboutPanel(Class<? extends JPanel> aboutPanelClass) { ABOUT_PANEL_CLASS = aboutPanelClass; }
1
private void ufotAlemmasOikeassaReunassa(Ufo ufo, int x) { if (ufo.isVisible()) { if (x >= RuudunLeveys - RuudunOikeaReuna && suunta != -1) { suunta = -1; Iterator i1 = ufot.iterator(); while (i1.hasNext()) { ufo = (Ufo) i1.next(); ...
4
public void updateDataBase() { String masterHostName = null; int masterPortNumber = 0; String masterKey = null; for (NodeState server : pool) { try { Registry registry = LocateRegistry.getRegistry(server.getHostname(), server.getPortNumber()); RemoteBullyPassiveNode stub = (RemoteBullyPassiveNod...
8
public void removeOutgoingEdge(Edge out) throws MaltChainedException { super.removeOutgoingEdge(out); if (out.getTarget() != null) { if (out.getType() == Edge.DEPENDENCY_EDGE && out.getTarget() instanceof DependencyNode) { Node dependent = out.getTarget(); if (compareTo(dependent) > 0) { leftDepende...
7
public void setList(List<Record> list) { this.list = list; }
0
private void createTrayIcon() { if(supported) { URL iconUrl = ClassLoader.getSystemResource(Constants.ICON_FILE); Image icon = new ImageIcon( iconUrl ).getImage(); PopupMenu menu = new PopupMenu(); openGuiMenuItem = new MenuItem(); settingsMenuItem = new MenuItem(); quitMenuItem...
4
private static boolean targetOverLineOnScreen( double sx, double sy, int ex, int ey, int tx, int ty ){ if( sx == ex && sy == ey ){ return true; } if( sx == ex ){ return tx > sx; } double m = (sy - ey) / (double)(sx - ex); m = limitM( m ); double q = sy - m * sx; return m * tx + q > ty; }
3
public void testConstructorEx1_TypeArray_intArray() throws Throwable { try { new Partial((DateTimeFieldType[]) null, new int[] {1}); fail(); } catch (IllegalArgumentException ex) { assertMessageContains(ex, "must not be null"); } }
1
@Override public String toString() { return "DCSTrunk {" + (extReferences != null ? " extReferences [" + extReferences + "]" : "") + (cls != null ? " cls [" + cls + "]" : "") + (recommendedValue != null ? " recommendedValue [" + recommendedValue + "]" : "") + (quality != null ? " quality [...
8
public static void UperFirstName(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStatement st...
4
public static void main(String[]args) throws Exception{ if(args.length!=1){ System.err.println("Nombre d'arguments incorrect"); return; } LinkedRBinaryTree<?> tree=null; try{ IO.openReader(args[0]); String line; // On parcourt toutes les expressions du fichier une a une while((line = IO.rea...
8
public double getX() { return x; }
0
public static void main(String args[]) { int trials = 1000; for (int i = 0; i < trials; i++) { deal(); playWar(); reset(); } System.out.println("Average Battles: " + battles/trials); System.out.println("Average Wars: " + wars/trials); }
1
final void aa(short i, short i_582_) { if (aShortArray5388 != null) { if (!aBoolean5391 && i_582_ >= 0) { TextureDefinition class12 = ((AbstractToolkit) aHa_Sub1_5353).aD4579.getTexture(i_582_ & 0xffff, -6662); if (((TextureDefinition) class12).aByte198 != 0 || ((TextureDefinition) class1...
7
public String getFriend(String IP, String name){ if(!name.toLowerCase().equals(InstantMessenger.user.toLowerCase())){ InstantMessenger.remUser = name; frndName = name; try{ sock = new Socket(); sock.connect(new InetSocketAddress(IP,6789), 1300)...
5
public void setPWFieldFonttype(Fonttype fonttype) { if (fonttype == null) { this.pWFieldFontType = UIFontInits.PWFIELD.getType(); } else { this.pWFieldFontType = fonttype; } somethingChanged(); }
1
public boolean editCounterevidence(Evidence c) { Element evidenceE; Evidence evidence; boolean flag = false; for (Iterator i = root.elementIterator("counterevidence"); i.hasNext();) { evidenceE = (Element)i.next(); if (evidenceE.element("id").getText().equals(c.getId())) { evidenceE.element("title").s...
3
protected int readData( char[] chunkData, int pos ) { int state = 0; int start = pos; StringBuilder sb = new StringBuilder(); while ( pos < chunkData.length && state != -1 ) { switch ( state ) { case 0: // reading text if ( chunkData[pos] == '\\' ) state = 1; else if ( chunkDa...
8
private void createDialog(final ArrayList<Boolean> list, final int index) { final JDialog dialog = new JDialog(); Boolean bool = list.get(index); dialog.setSize(360, 150); dialog.setResizable(false); dialog.getContentPane().setLayout(null); dialog.setLocationRelativeTo(this); dialog.setLayout(null); J...
1
@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 Privatstunde)) { return false; } Privatstunde other = (Privatstunde) object; if ((this.privatstundeid == null &...
5
public boolean overTwoTimes(int[] counts) { for (int i = 0; i < counts.length; i++) { if (counts[i] > 1) return false; } return true; }
2
@Override public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_UP: this.editor.getCursor().selectLineUp(); break; case KeyEvent.VK_DOWN: this.editor.getCursor().selectLineDown(); break; case KeyEvent.VK_LEFT: this.editor.getCursor().movePositionLeft(); brea...
8
public Powerup(String powerUpTyp){ switch (PowerupTyp.valueOf(powerUpTyp)) { case OWN_MOVE_FAST: break; case OWN_MOVE_SLOW: break; case ENEMY_MOVE_FAST: break; case ENEMY_MOVE_SLOW: break; case TABOO: break; case CONTROL_SWITCH: break; case RANDOM: break; case CHAINSAW: brea...
8
protected void done(){ try { startButton.setEnabled( true ); // Enable the start button in the applet. settingsButton.setEnabled( true ); // Enable the settings button in the applet. stopButton.setEnabled( false ); // Disable the stop button in the applet. if( stopButton.getText() == "Resume" ) st...
2
@Override public String toString() { return this.map.toString(); }
0
private void start_connecting (boolean wait_) { assert (connect); // Choose I/O thread to run connecter in. Given that we are already // running in an I/O thread, there must be at least one available. IOThread io_thread = choose_io_thread (options.affinity); assert (io_thr...
2
private void cargarSetAprendizaje(){ DefaultTableModel temp = (DefaultTableModel) this.tablaSetAprendizaje.getModel(); String csvFile = "dataset/iris_aprendizaje.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; try { br = new BufferedReader(new FileReader(csvFile)); ...
6
public Enumeration listOptions() { Vector result = new Vector(); Enumeration en = super.listOptions(); while (en.hasMoreElements()) result.addElement(en.nextElement()); result.addElement(new Option( "\tFull name and options of the evaluator analyzed.\n" +"\teg: weka.attri...
7
@Override public Step execute(Algebra algebra) { Fraction frac = (Fraction) algebra; //get factors of top and bottom Map<AlgebraicParticle, Integer> factorsTop = factors(frac.getTop()), factorsBottom = factors(frac.getBottom()); //find intersection of set of factors of top and bottom Set<AlgebraicP...
7
public boolean playerCanExit() { Car player = (Car) vehicles.get('A'); ArrayList<Coordinate> coords = this.getCoveredCoordinatesExcludingVehicle(player); for (int i = player.position.x; i < gridSize; i++) { if(coords.contains(new Coordinate(i, player.position.y))){ return false; } } return true; }
2
public boolean equals(Object ob) { if (super.equals(ob)) { Candy other = (Candy) ob; if (hardness != other.hardness) return false; } return true; }
2
public void update(T t) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.update(t); session.getTransaction().commit(); } catch (Exception e) { ...
3
public void setFoo(Boolean foo) { this.foo = foo; }
0
@Column(name = "sale_id") @Id public int getSaleId() { return saleId; }
0
public String toString() { if(this.b>=0) return String.format("%.3f +%.3fi", this.a, this.b); else return String.format("%.3f %.3fi", this.a, this.b); }
1
private void addClade(DrawableNode root, TreeItem cladeInfo) { //boolean add = false; //We traverse the tree and look for a node that contains this clade, but //that does not have any children that contain this clade if (containsClade(root, cladeInfo.clade)) { boolean found = false; for(Node kid : root...
7
public float[][] clone2df(float[][] orig){ int ii = orig.length; int jj = orig[0].length; float[][] temp = new float[ii][jj]; for (int i = 0; i<ii; i++){ for(int j = 0; j < jj; j++){ temp[i][j] = orig[i][j]; } } return temp; }
2
public int getPartyHealth(int i) { if (i == 1) { return bm.getHealth(); } else if (i == 2) { return n.getHealth(); } else if (i == 3) { return w.getHealth(); } else if (i == 4) { return d.getHealth(); } else if (i == 5) { return wm.getHealth(); } else { return 50; } }
5
public String getCountryCode() { return countryCode.get(); }
0
public void loadConfig () { File folder = getDataFolder(); PluginDescriptionFile pdfFile = getDescription(); File configFile = new File(getDataFolder(), "config.yml"); Properties settingsFile = new Properties(); if (! (folder.exists())) { try { folder....
8
public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { final ChatColor red = ChatColor.RED; final ChatColor yellow = ChatColor.YELLOW; final ArrayList<Player> cPearl = CrazyFeet.CrazyPearl; if(args.length < 1) { if(sender instanceof Player) { Player player...
8
public List<String> restoreIpAddresses(String s) { int length = s.length(); if(length < 4 || length > 12) return list; for(int i=1;i<length -2;i++) for (int j = i+1;j<length-1 ;j++ ) for (int k = j+1; k<=length ;k++ ) { String ip1 = s....
9
@Override public boolean queueBuffer( byte[] buffer ) { // Stream buffers can only be queued for streaming sources: if( errorCheck( channelType != SoundSystemConfig.TYPE_STREAMING, "Buffers may only be queued for streaming sources." ) ) return false; ...
5
public void setHighThreshold(float threshold) { if (threshold < 0) throw new IllegalArgumentException(); highThreshold = threshold; }
1
public void nouveauTour(){ if (!aJoue() && !estMort()){ this.guerir(); } this.aJoue = false; }
2
private ArrayList<Integer> determinePagesOfTermInSelectedChapters(ArrayList<Integer> termTotalPages, ArrayList<Integer> totalPagesInSelectedChapters){ if(totalPagesInSelectedChapters.size()!=0){ ArrayList<Integer> termTotalPagesWrapper = new ArrayList<Integer>(termTotalPages); //here to ensure no changes are made ...
6
public void Merge(Portfolio pleft, Portfolio pright, double wgt) { Collections.sort(pleft.pwlist,CINDEX); Collections.sort(pright.pwlist,CINDEX); int i = 0; int j = 0; Vector<PortWeight> newplist = new Vector<PortWeight>(); while (i < pleft.pwlist.size() && j < pright.pwlist.size()) { PortW...
7
public int getCheckStart() { return _checkStart; }
0
public static String wypiszWynik(double[] tablicaWFormieNormalnej, boolean cons) { String postacOgolna = ""; for (int i=tablicaWFormieNormalnej.length-1;i>1;i--){ if(tablicaWFormieNormalnej[i]!=1.0) { Double normalnaSkrocona=new BigDecimal(tablicaWFormieNormalnej[i]).setScale(3, BigDecimal.R...
6
private void detachFrom(Component paramComponent) { if ((paramComponent instanceof ImageComponent)) { ((ImageComponent)paramComponent).removeImageListener(this); } else if ((paramComponent instanceof ImageComposite)) { ((ImageComposite)paramComponent).removeImageListener(this); } else if (((pa...
6
public void writestack() { File f=new File(name+".stack.back"); if (f.exists()) if (!f.delete()) { printer.PrintMessage("failed to delete "+name+".stack.back"); return; } f= new File(name+".stack"); if (f.exists()) { if (!f.renameTo(new File(name+".stack.back"))) { printer.PrintMes...
9
@Override public T next() { T current = next; while (iterator.hasNext()) { next = iterator.next(); if (next != skip) { break; } } if (!iterator.hasNext()) { next = n...
3
public void notify(Object[] objects) { Integer value = (Integer)objects[0]; if (value.equals(DISPLAY_PROJECT_VARIABLES)) { displayProjectVariables(); } else if (value.equals(DISPLAY_DESTINATION_FOLDER)) { displayDestinationFolder(); } }
2
public void paint(Graphics g) { //Dibujamos la imagen de fondo for(int i=0; i <= ANCHO_VENTANA/DIAMETRO_IMAGEN; i++) for(int j=0; j <= ALTO_VENTANA/DIAMETRO_IMAGEN; j++) g.drawImage(game.getImagen(), Math.round(i)*DIAMETRO_IMAGEN,Math.round(j)*DIAMETRO_IMAGEN, DIAMETRO_IMAGEN, DIAMETRO_IMAGEN, null ); ...
7
@Override public void initialize(URL arg0, ResourceBundle arg1) { DateFormat df = new SimpleDateFormat("yyyy/MM"); Date d = new Date(); currentMonth = df.format(d); lblDate.setText(currentMonth); }
0
public void testFormat_invalid() { try { DateTimeFormat.forPattern(null); fail(); } catch (IllegalArgumentException ex) {} try { DateTimeFormat.forPattern(""); fail(); } catch (IllegalArgumentException ex) {} try { DateT...
4
@Override public boolean visit(IResourceDelta delta) { System.out.println("NEW EVENT"); System.out.println("================================"); System.out.println(delta.toString()); IResource res = delta.getResource(); switch(res.getType()) { case IResource.FILE: System.out.println("file resource"); ...
8
public static int getOnePageRows() { String maxNum = getHttpServletRequest().getParameter("onePageRows"); if (StringUtils.isNull(maxNum)) { return 20; } else { return Integer.parseInt(maxNum); } }
1
private void initDisplay() { log.info("Initializing screen subsystem..."); try { Display.setDisplayMode(new DisplayMode(x_res, y_res)); Display.create(); log.info("Screen initialized."); } catch (LWJGLException e) { log.error("Caught exception. Info: " + e.getMessage()); e.printStackTrace(); Sys...
1
public TValue get(TKey key) { if (!enabled) return null; TValue value; value = mainCache.get(key); if (value == null && useBuffer) { value = buffer.get(key); } return value; }
3
@Override public void deserialize(Buffer buf) { int limit = buf.readUShort(); finishedQuestsIds = new short[limit]; for (int i = 0; i < limit; i++) { finishedQuestsIds[i] = buf.readShort(); } limit = buf.readUShort(); finishedQuestsCounts = new short[limit...
3
final private boolean updateActiveLayer() { assert (update_list.size() == 0); //double total_change = 0; total_change = 0; num_updated = 0; final Iterator<BandElement> it = layers[ZERO_LAYER].iterator(); while (it.hasNext()) { final BandElement elem = ...
9
public void leftClicked(Location location){ if(!freezed){ if(isUnclickedState(location) || isDoubtedState(location)){ setRevealedState(location); moved++; setChanged(); notifyTimerChange.setMoved(moved); notifyObservers(notifyTimerChange); if(!freezed){ notifyReveal(location); if(...
6
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
5
public void remove() { throw new UnsupportedOperationException(); }
0
public void save(){ try { File dir = new File("stage"); if(! dir.exists() || !dir.isDirectory()){ dir.mkdir(); } File stageData = new File(dir,"stage.data"); if(stageData.exists()){ stageData.delete(); } ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(stageData));...
4
@Override public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException{ res.setContentType("text/html"); Connection con = null; String lausend = null; String lausend1 = null; PreparedStatement ps = null; PreparedStatement ps1 = null; String kandidaat=req.getPara...
7
public Card(Rank rank, Suit suit) { this.rank = rank; this.suit = suit; switch(rank) { case Ace: value = 1; break; case Two: value = 2; break; case Three: value = 3; break; case Four: value = 4; break; case Five: value = 5; break; case Six: value = 6; break; case ...
9
@Override public MovementAction testAction(Creature c) { Direction action = this.checkForDirt(c); if (action != null){ return Direction.convertDirToAct(action); } Sensor s = c.getSensor(); ArrayList<Direction> possibleDir = new ArrayList<Direction>(); for (Direction d : Direction.values()){ int value...
4
@SuppressWarnings("unchecked") @Post public Representation handlePost(Representation entity){ try{ Form responseHeaders = (Form) getResponse().getAttributes().get("org.restlet.http.headers"); if (responseHeaders == null) { responseHeaders = new Form(); getResponse().getAttributes()...
7
public void handleHttpResponse(HttpResponse httpResponse, int expectedStatusCode) throws HttpExpectationException, ContractException, IOException { int statusCode; String body; statusCode = httpResponse.getStatusLine().getStatusCode(); body = StringUtil.convertStreamToString(httpResponse.getEntity().ge...
8