method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f39a7547-3ead-47e2-81b2-220eacb7144d
6
private void log(final LogLevel logLevel, final String message, final Throwable throwable) { if (isLevelEnabled(logLevel)) { switch (logLevel.getAndroidLogLevel()) { case Log.VERBOSE: logAndroidVerbose(message, throwable); break; ...
dc417e8c-0a3e-41a6-aa16-41c63dd42959
6
private Expression_Boolean exp4(boolean throwError) { boolean correct = false; Token tok = token_act; if (!existError) { System.out.println("***exp4***"); Expression_Boolean result1 = exp5(throwError); boolean correct1 = result1.isCorrect(); if (correct1) { Expression e1 = e.deepCopy(); correc...
c78421cd-35e5-42cd-a10d-b16b367d5590
5
public boolean isMultiSheet() { return ((first_sheet != null) && (last_sheet != null) && (!first_sheet.equals( last_sheet ))) || ((first_sheet_name != null) && (last_sheet_name != null) && (first_sheet_name != last_sheet_name)); }
ca8a4796-b69d-4192-8e90-aa11d905e429
0
public static void main(String[] args) { launch(args); }
ee008bac-3964-47dc-9784-4875ca15ec50
5
private double surfacePotential4(double sigma){ double surPot = 0.0D; // temporary values of the surface potential // bisection method double psiLow = 0.0D; double pFuncLow = this.psiFunction4(psiLow, sigma); double asinhDenom = Math.sqrt(this.eightTerm*this.electrolyteConcn);...
fbc2e67a-881e-4b81-9ea9-dcfb3aca4634
0
private void initTrainNumber() { this._trainNumbers = new TrainNumber[2]; this._trainNumbers[0] = this.CreateG101(); this._trainNumbers[1] = this.CreateK600K597(); }
de6269d9-ed7f-4c21-a726-6d2df333bbfb
9
public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[42]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 18; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { i...
8b9e6984-6a82-40cb-aae3-efbbe86fe45c
7
public double[][] seedsToZL(int N, int T) { double[][] retval = new double[N][]; // default to null for(LogicRule lr : rules) { if(lr instanceof IndependentRule) { // Need to 'sparse-add' these double[][] double[][] ruleweights = ((IndependentRule) lr).toZLabel(N, T); for(int i = 0; i < N...
bd59eae6-6dff-4ba9-ae41-ab3885593faa
8
public boolean onCommand(CommandSender s, Command cmd, String l, String[] args){ if (cmd.getName().equalsIgnoreCase("eden")){ if (args.length==0){ s.sendMessage(head+"#======#"+ChatColor.BLUE+" Old Eden Core v"+version+ChatColor.RESET+" #======#"); s.sendMessage(head+"Loooking for help? Try '/eden help'.")...
03cccad0-3cc3-4ada-af1f-c9d7f22a7003
2
public Document HttpRequest(String httpRequestType, URL url) throws IOException { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod(httpRequestType); con.setDoOutput(true); con.setDoInput(true); con.connect(); Document responseDocument = null; ...
1b890b3b-a481-4c92-97d6-8d9e6c162671
2
@Override public void keyReleased(KeyEvent e) { if(playing){ if(Character.toUpperCase(e.getKeyChar()) == keytoPress){ GameObject player = gameObjects.get("PLAYER" + userID); player.changeSpeedBy(0.15); player.changeAnimationCounterMaxbyPercent(0.04); player.setCurrentAnimationType(animationMove); ...
3cfe5465-255a-4d1f-b492-432f26d32f6e
5
private TargetAndParents parseTargetLine(String line) { String[] targetAndParents = line.trim().split(":", 2); String target = targetAndParents[0].trim(); String parentLine = targetAndParents.length > 1 ? targetAndParents[1].trim() : ""; String[] parents; if (parentLine.isEmpty...
c65071eb-4afe-403e-9a36-6d0bf94c4d6a
7
public void sampleNumbers(List<String> sampleNames) { int i = 0; for (String sn : sampleNames) { if (sn.equals(father)) fatherNum = i; if (sn.equals(child)) childNum = i; if ((mother != null) && sn.equals(mother)) motherNum = i; i++; } if (fatherNum < 0) throw new RuntimeException("Cannot find pedi...
f7d8f4e4-7d6b-40b6-a2d6-e9a22e591408
2
public EditionCarte(Carte carte) { this.carte = carte; // Pour récupérer à quel utilisateur appartient la carte for (Utilisateur u : ConfigGlobale.utilisateurs) { if(u.getFk_id_carte()==this.carte.getId_carte()){ this.user = u; break; } ...
26e6477a-279f-45a6-bd9b-2f81f07b821d
7
public static byte[] receiveFile(final DatagramSocket socket, final InetAddress clientAddress) throws IOException { final ArrayList<byte[]> chunks = new ArrayList<>(); final Set<Integer> receivedBlocks = new HashSet<>(); final TransferStatus transferStatus = new TransferStatus(); socket.setSoTimeout(GlobalCo...
fe1712a9-6d60-4605-ac70-cc98aafc3a24
4
private static boolean isBlank(int c) { return c == ' ' || c == '\t' || c == '\f' || c == '\r' || c == '\n'; }
979f9d32-52cc-40b5-8c3b-4bdc3cdff7c3
2
public void applyTreeFontSize() { FontData[] fontData = tree.getFont().getFontData(); fontData[0].setHeight(VCNTreeItem.getFontSize()); if (isOwnFont) tree.getFont().dispose(); tree.setFont(new Font(tree.getDisplay(), fontData[0])); isOwnFont = true; if (getEditor().getTreeItem() != null) { ...
e98be08e-7e5e-4d10-9e98-349a3bb33b6f
6
@Override public double membership(double x) { if (Double.isNaN(x)) { return Double.NaN; } if (Op.isLE(x, a) || Op.isGE(x, d)) { return 0.0; } else if (Op.isLt(x, b)) { return Math.min(1.0, (x - a) / (b - a)); } else if (Op.isLE(x, c)) { ...
a99cefb0-99df-4eae-8fe7-4f6763f28d50
2
public static String getExtension(File f) { String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { ext = s.substring(i+1).toLowerCase(); } return ext; }
60f1187d-e227-4fa6-ad47-5fd8b38ba5f7
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Auction other = (Auction) obj; if (this.auctionId != other.auctionId) return false; if (Double.doubleToLongBits(this.price) != Do...
43ad087a-3d8d-45c3-af19-856d12fe95e2
0
public static int getPort(PortList portlist){ return portlist.port; }
910ec257-ab9c-4662-a104-92213a09faa7
1
public Lift[] getLifts(){ Lift[] liftArray = new Lift[lifts.size()]; for(int i=0;i<lifts.size();i++){ liftArray[i] = lifts.get(i); // System.out.println(lifts.get(i).getLiftID()); } return liftArray; }
35dd7031-8285-49b0-9e95-b557686828af
1
protected String getOptionRangeDesc(String arg) { Record rec = getRecord(arg, null); return (rec != null) ? rec.rangeDesc : null; }
7437d903-d863-4193-9ba2-e2be66e52d4f
8
public boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) { if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()) { return false; } if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2...
cd716187-becb-4246-ab21-e9e85481efc9
1
private boolean jj_3R_61() { if (jj_3R_89()) return true; return false; }
ad98e93d-041e-498a-b5bb-92668873fcdf
4
public void drawBubbles(Graphics g) { for(Bubble bubble : bubbles) { for(Arrow arrow : bubble.getArrows()) { if(arrow.getStart() == bubble) g.drawLine(arrow.getStart().getLocation().x+bubble.getRadius()/2,arrow.getStart().getLocation().y+bubble.getRadius()/2,arrow.getEnd().getLocation().x+bubble.get...
2677590a-2002-4ec7-93b2-0a5f5e217fcf
0
@Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); }
a0f6f2f3-736c-4427-92ba-9024c32e16a1
9
public void craft(){ if((Screen.inventory.queue.type.equals("nothing"))||(Screen.inventory.queue.type.equals(result)&&Screen.inventory.queue.count<Screen.inventory.queue.maxCount)){ if(type1!=null){ Screen.inventory.removeItemAmount(type1,count1); } if(type2!=...
e23bfec1-250b-4162-a5d0-e4f57506e009
2
public boolean update(int id,String name) { Connection con=getcon(); boolean bs=false; try{ String sql="update testtable set name=? where id=?"; PreparedStatement stmt=null; stmt=con.prepareStatement(sql); stmt.setInt(2,id); stmt.s...
601b08b9-59ee-44a7-b1a6-104a3ee3bcac
0
public boolean isEnabled() { return getPIDController().isEnable(); }
db2281e8-48ea-4239-9c1d-0937b3211a4c
7
public static LinkedList<String> getLinks(String data, String url) { LinkedList<String> links = new LinkedList<String>(); URI u; String l; try { u = new URI(url.toLowerCase()); } catch (Exception e) { u = null; } int pos = 0, posEnd; while (true) { pos = data.indexOf("<a", pos); if (pos ==...
cc14e33d-3ef4-4ef4-81f9-2f99e0ac32a8
5
static Type resolveTypeVariable(Type context, Class<?> contextRawType, TypeVariable<?> unknown) { Class<?> declaredByRaw = declaringClassOf(unknown); // we can't reduce this further if (declaredByRaw == null) { return unknown; } Type declaredBy = getGenericSupertype(context, contextRawType, ...
eedcc614-2feb-47f2-876c-0bb80a266820
8
public static void handle(final Event e) { if(!e.isValid()) return; switch(e.getType()) { case JOIN: handleJoin(e); break; case QUIT: handleQuit(e); break; case GAMECMD: handleGameCommand(e); break; case CHATCMD: handleChatCommand(e); break; case OP: handleOp(e); break; case DEOP: handl...
bf41c1bc-ae39-4ca2-8935-317c03d7ad30
8
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...
60c53ba7-d834-4061-ac6f-9375630badc2
7
final boolean isGroup3Match(String strWildcard) { int cchWildcard = strWildcard.length(); int ichWildcard = 0; String group3 = group3Names[groupID]; int cchGroup3 = group3.length(); if (cchWildcard < cchGroup3) return false; while (cchWildcard > cchGroup3) { // wildcard is too long // so strip '?' ...
18011c6c-ca5f-4b3a-be69-d6a74b1dccaa
6
public void layoutContainer(Container target) { synchronized (target.getTreeLock()) { Insets insets = target.getInsets(); int maxwidth = target.getWidth() - (insets.left + insets.right + hgap*2); int maxheight = target.getHeight() - (insets.top + insets.bottom + vgap*2); ...
8eacf022-5101-42a8-b700-aa027ac0f9e3
1
public void paint(Graphics g) { g.setColor(Color.WHITE); g.fillRect(miniMapOrigX, miniMapOrigY, miniMapWidth, miniMapHeight); for(Unit unit : main.getUnits()) { g.setColor(Color.RED); int xInMinimap = unit.getIntX() * miniMapWidth / main.getMap().getWidth() + miniMapOrigX; int yInMinimap = unit.getIntY(...
327bf5b7-bbf3-4f00-81f1-2d7f98380dd4
6
boolean checkIfNearWarmthSource(LivingEntity entity) { boolean entityIsNearWarmthSource = false; if(null != entity) { Player player = null; if(entity instanceof Player) { player = (Player)entity; } Location playerLoc = entity.getLocatio...
3466ac8f-1648-4727-a9c6-795bd9e6f5f0
8
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { // Lots of error checking and exception throwing if( source == null ){ throw new NullPointerException( "Source array was null." ); } // end if ...
a9d62194-691f-4ef0-b700-e14d0cc9a9d3
8
public void run() { BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(Net.socket.getInputStream())); } catch (IOException e1) { e1.printStackTrace(); } while (true) { try { String msg = in.readLine(); if (msg != null) { PacketPosition p = new PacketPosition(ms...
95ae3bf3-7b8c-478e-b7e4-66fdd51d4320
4
public int compareTo(Object other) { Location otherLoc = (Location) other; if (getRow() < otherLoc.getRow()) return -1; if (getRow() > otherLoc.getRow()) return 1; if (getCol() < otherLoc.getCol()) return -1; if (getCol() > otherLoc.getCol(...
5c1a4c5a-054d-453d-bf6b-caa0edc6e091
9
public WumpusPerception getPerception(WorldNode node) { WumpusPerception perception = new WumpusPerception(); if (node.hasPit()) perception.setBreeze(); if (node.hasWumpus()) perception.setStench(); if (node.hasGold()) perception.setGlitter(); List<WorldNode> neighbours = getNeighbours(node); ...
9bbc97d1-4065-4c36-8b1f-dc84da54b964
4
public static DownloadTask create(String url, String savePath, int downloaderCount) throws IOException, CloneNotSupportedException { //从记录文件中读取url,如果url为null的话 if (CommonUtils.isStringNullOrWhiteSpace(url) && !CommonUtils.isStringNullOrWhiteSpace(FileUtil.getBaseNameByPath(savePath))) { url = DownloadRecord....
025a996c-ceb5-451b-9614-87c5e7971413
3
@Override protected boolean xsend (Msg msg_, int flags_) { // If we are in the middle of receiving a request, we cannot send reply. if (!sending_reply) { throw new IllegalStateException("Cannot send another reply"); } boolean more = msg_.has_more(); // Pus...
2c43ca05-6e5b-4690-a22c-6a9d34ebcff2
9
public static void main(String[] args) { //Output the help message if the amount of arguments is less that one. if (args.length == 1 && args[0].equals("-help")) { outputHelp(); System.exit(0); } String outputLocation = null; int commitDigits = 5; ...
2b141095-84ba-4d5e-acb4-d23d059d69f3
8
protected int clock_resample_fast(CycleCount delta_t, short buf[], int n, int interleave) { int s = 0; for (;;) { int /* cycle_count */next_sample_offset = sample_offset + cycles_per_sample; int /* cycle_count */delta_t_sample = next_sample_offset >> FIXP_SHIFT; if (delta_t_sample > delta_t.delta_...
60e98705-0554-4c82-8bdb-3ced98a00eb5
3
public void setTableHeader(JTableHeader tableHeader) { if (this.tableHeader != null) { this.tableHeader.removeMouseListener(mouseListener); TableCellRenderer defaultRenderer = this.tableHeader .getDefaultRenderer(); if (defaultRenderer instanceof SortableHeaderRenderer) { this.tableHeader ...
cf70a00a-4fcd-42ba-bf00-727989e337d5
8
public static void main(String[] args) throws FileNotFoundException { long start = System.currentTimeMillis(); Scanner sc = new Scanner(new BufferedReader(new FileReader("C://matrix.txt"))); int [][] mat = new int[80][80]; int [] sol = new int[80]; String[] tmp; ...
e407ce83-62ff-4d33-b985-9f0df19a3e5e
1
public boolean isBoiling() { if(temp > getBPTemp()) return true; return false; }
0a5ef525-0612-43e5-9f94-65699be6e399
3
public void onOther(Line line) { if (line.contains("users:{ ")) { Line[] lines = line.split(Pattern.compile("[0-9]\\:\\{"), line.substring(line.indexOf("users:{ "))); for (Line l : lines) { if (l.startsWith(" name:")) { Users.addUser(new User(l)); } } } }
3585c869-15b1-49ce-881e-3bc48645c290
8
public boolean isUndefined() { if (getType() == TYPE_UNDEFINED) { return true; } if ((getType() == TYPE_SET) || (getType() == TYPE_SEQUENCE) || (getType() == TYPE_BAG)) { if (getSetType() == null) ...
c89d2552-9e38-44e1-a114-d1cd2e8a2f8f
4
public void createProductionInCityAt(Position p) { final ArrayList<Position> aroundTheCity = p.getNeighbours(); //Archer costs 10 production //Legions costs 15 production //Settler costs 30 production if(mapCity.get(p) != null) { CityImpl c = mapCity.get(p); if(c.getProductionSum() >= GameConstants.c...
023965b0-f96f-40b0-9abe-28268cf53dd1
8
public List<SchemaError> execute(SchemaTypes schemaType, List<SchemaElement> nodes, Change change) { Set<Rules> ruless = ruleDefn.getRulesOn(schemaType, change); List<SchemaError> errors = new ArrayList<SchemaError>(); if (nodes != null) { for (Rules rules : ruless) { for (SchemaElement item : nodes) {...
dbdb73fa-f5b5-4250-a8c7-625be3068a1b
3
public void writeBits(int howManyBits, int value) { value &= bmask[howManyBits]; // only right most bits valid while (howManyBits >= myBitsToGo){ myBuffer = (myBuffer << myBitsToGo) | (value >>> (howManyBits - myBitsToGo)); try{ write(...
f1a42c3b-465a-4f67-a0c9-e59fe4366e18
7
public String GetKickMessage(String player, int reason) { if (reason == 0) return prekick.config.GetString("Whitelist.KickMessage"); else if (reason == 2) return prekick.config.GetString("IP.KickMessage"); else if (reason == 3) return prekick.config.GetString("Blacklist.Players." + player); else if (re...
77da2988-fb09-4842-aa39-43e297cf6b82
5
public void addLiteralVariable(final LiteralVariable varName, final LiteralVariable value) throws TheoryException { if (varName.getName().charAt(0) != DomConst.Literal.LITERAL_VARIABLE_PREFIX) throw new TheoryException(ErrorMessage.LITERAL_VARIABLE_PREFIX_ERROR, new String[] { varName.toString() }); if (literal...
4725dd98-da5e-4bee-955f-ca3dd25ac647
4
@Override public boolean activate() { entrance = SceneEntities.getNearest(entranceId); ditch = SceneEntities.getNearest(ditchId); exit = SceneEntities.getNearest(exitId); if (entrance != null && Inventory.contains(RSC.FOOD_IDS)) { return true; } else if (exit != null && !Inventory.contains(RSC.F...
ac214fe5-c124-47cf-819c-2931e1aab442
8
private void whenMousePressed(MouseEvent e) { if (!isEnabled()) return; if (levelViewList == null) return; requestFocusInWindow(); int x = e.getX(); int y = e.getY(); selectedElectronView = null; synchronized (levelViewList) { for (EnergyLevelView levelView : levelViewList) { if ((selectedEle...
147d2e43-be91-48c8-a781-a8309b21e517
2
public Grille (EnvironnementAbs env){ super(env); Border blackline = BorderFactory.createLineBorder(Color.black,1); for(int i= 0 ; i < env.taille_envi;i++){ for(int j= 0 ; j < env.taille_envi;j++){ agent[i][j].setBorder(blackline); } } pan.setBorder(blackline); }
717876ec-6994-464a-a4cd-ed089d0845a8
0
public void setNationality(String nationality) { Nationality = nationality; }
4489d6fb-62b4-4add-8001-cc51227abeb9
3
public void setNotConstant() { if (notConstant) return; notConstant = true; if (fieldListeners == null) return; for (Iterator i = fieldListeners.iterator(); i.hasNext();) Main.getClassBundle().analyzeIdentifier((Identifier) i.next()); fieldListeners = null; }
bcf825b5-ce2a-47f5-b14f-83e848842192
7
private static boolean isValidScheme(final String scheme) { final int length = scheme.length(); if (length < 1) { return false; } char c = scheme.charAt(0); if (!Character.isLetter(c)) { return false; } for (int i = 1; i < length; i++) { c = scheme.charAt(i); if (!Character.isLetterOrDigit(c) ...
bc5b1a59-f1c0-40f4-8079-c9bf4ad446b0
1
public Iterable<Character> parsed() { return(new Iterable<Character>() { public Iterator<Character> iterator() { return(new Iterator<Character>() { private int i = 0; public boolean hasNext() { return(i < parsed.size()); } public Character next() { if(i >= pa...
ebc09ace-bc0a-4dd0-bf86-d406c8855065
7
private int detectHashIndex(char HashLabel) { if((int)HashLabel < 65) { return 0; } else if(HashLabel >= 'A' && HashLabel <= 'z') { int index = HashLabel, val = 27; if(index > 64 && index < 92) { val = index - 64; } else...
73b339b4-4947-4bd8-9873-8d49bd709151
3
public boolean loginMember(String passport, String password) { Query q = em.createQuery("SELECT t from SHSMember t"); for (Object o : q.getResultList()) { SHSMemberEntity p = (SHSMemberEntity) o; if (p.getPersonId().equals(passport)) { if (p.getPassword().equals...
60629675-0c2d-4751-8804-8838738c6867
0
public FSAToREController(FiniteStateAutomaton automaton, SelectionDrawer drawer, JLabel mainStep, JLabel detailStep, JFrame frame) { this.automaton = automaton; this.drawer = drawer; this.mainStep = mainStep; this.detailStep = detailStep; this.frame = frame; nextStep(); }
73f5b120-6103-421d-b1fa-6d4a314d5185
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Diff other = (Diff) obj; if (operation != other.operation) { return f...
f3b8a085-1197-48e9-ad81-fdeb8d552f5f
9
public static boolean isSameDigest( String digest1, String digest2) { return (sha1.contains(digest1) && sha1.contains(digest2)) // BEGIN android-removed // || (sha224.contains(digest1) && sha224.contains(digest2)) // END android-removed || (sha...
34c119b9-a06a-46d6-bd1b-435e965ce741
2
@Override protected <T> T execute(String sql, int fetchSize, boolean returnKeys, PreparedStatementCallback<T> action, Object... args) { if ((action instanceof QueryCallback<?>) == false) { return dataAccessor.execute(sql, fetchSize, returnKeys, action, args); } TaskParameters parameters = new JdbcQueryT...
78121ea7-55b5-472a-95f0-0cbc506eb9da
8
@Test public void testGetEdge() { // Initialization ROVector3f topLeftVertices = vb.get(Edge.TOP_LEFT); ROVector3f bottomLeftVertices = vb.get(Edge.BOTTOM_LEFT); ROVector3f bottomRightVertices = vb.get(Edge.BOTTOM_RIGHT); ROVector3f topRightVertices = vb.get(Edge.TOP_RIGHT); ROVector3f topLeftFloating =...
aee200f6-15de-4c57-9a26-4e26073b5b93
7
public void ballMovement(Graphics g) { for(int k = 0; k <ballarray.size(); k++){ Ball temp = ballarray.get(k); temp.force = new Force(); for(int j = 0; j <ballarray.size(); j++){ if(k!=j){ Ball temp2 = ballarray.get(j); temp.force.add(CalculateForce(ballarray.get(j), ballarray.get(k))); ...
d5918c6a-8614-483a-89c6-106d1cfdafe2
5
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) void onEntityDamageEvent(EntityDamageByEntityEvent event){ if(event.getEntity() instanceof Player == false) return; NexusPlayer np = this.getNPlayer((Player)event.getEntity()); if(np == null) return; Entity damager = event.getDamager(); ...
6bfe0c5f-620c-4edd-a5dd-6dd6077589ed
8
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testCasesCount = Integer.parseInt(scanner.nextLine()); for (int inx = 0; inx < testCasesCount; inx++) { long inputNumber = Long.parseLong(scanner.nextLine()); long curNum = inputNumber; long startNum = 2; while ...
0270a4b4-d28a-4176-b8a0-825d6dd26d5f
2
public void setPassengersCount(int passengersCount) throws OutOfRangeException { if ((passengersCount < 0)|| (passengersCount > MAX_PASSENGER_SCOUNT)){ logger.error("wrong passengers count argument: " + passengersCount ); throw new OutOfRangeException(); } this.passengersCount = passengersCount; }
cf1f67d3-823a-4355-a8a5-db4b64910948
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub System.out.println("UserAddServlet.doPost()"); String type=request.getParameter("type"); String id=request.getParameter("account"); String name = request.ge...
983d1a70-a2c0-44e6-bf7b-1662e2c74016
8
private void addPreferences() { selection = new ArrayList<ProjectMember>(); for (Node n : display) { if (n.box.isSelected()) { selection.add(n.mem); } } int groupSize = Controller.project.getSizeOfTeams(); if ((selection.size() > groupSize) && radioReq.isSelected()) { JOptionPane.showMessageD...
f40e5945-0e99-4fb5-8d9a-a3df4a7129d5
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Group other = (Group) obj; if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) { ...
764dba5a-be12-4664-a261-468882829faa
6
protected void shutDown() { //close everything - the order of closing may be important try{ if (byteOut != null) {byteOut.close();} if (byteIn != null) {byteIn.close();} if (out != null) {out.close();} if (in != null) {in.close();} if (socket != null) {socket.close();}...
5ca79100-eadd-4a48-a83f-45f8b60e4a47
0
public Object getParams() { return params; }
173449ac-8f3d-48d0-8a97-28070de476e8
6
private static void setDefaultLookAndFeel(){ try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException...
ec624aa0-2168-4432-8101-30ab6c0b170b
5
public void guardarCompraTexto(String nombreFichero, LinkedHashMap<Integer, Compra> compras) { FileOutputStream fos = null; try { fos = new FileOutputStream(nombreFichero); ObjectOutputStream object = new ObjectOutputStream(fos); //recorro el key set del HM y grabo a ...
f7d8e69e-a7b9-46cf-bfd3-471552096b0e
5
public static void main (String[] args) { String username = System.getProperty("user.name"); String filepath = "/Users/" + username + "/Music/_Serato_/History Export/13-02-24.csv"; BufferedReader br = null; String line = ""; String separator = ","; try { br = new BufferedReader(new FileReader(filep...
11fdff7e-3dfe-4ec7-8615-a0f14acad097
0
public boolean containsID(int id){ return cityMap.containsKey(id); }
f283c6e4-9388-40ce-870a-fff5cfc6f40f
6
private boolean helper(TreeNode a, TreeNode b) { if (a == null && b == null) return true; if (a == null || b == null) return false; // only one has node in a tree and b tree if (a.val != b.val) return false; return helper(a.left, b.right) && helper(a....
1459b339-72c3-4ad4-960e-83f1c798cbf9
1
private void eraseLine(int lineNumber) { for (int i = 0; i < fieldSize; i++) { field[i][lineNumber] = DEFAULT_CELL_VALUE; } }
3c5ae999-4d7e-414d-9d10-58dd4aabb83d
6
public void save(String savePath) throws IOException, JPEGParser.InvalidJpegFormatException { DataOutputStream fsave = null; try { fsave = new DataOutputStream(new FileOutputStream(savePath)); // 写入SOI fsave.writeShort(JPEGImage.SOI); // 写入APPn ...
b730ad69-1cf3-4f0f-95a2-00de6019c188
6
public String getBlock(int x, int y) { if(chunkID < 0) { x = 15-x; } if(x < 0 || x >= blocks.length || y < 0 || y >= blocks[0].length) return "out"; String b = blocks[x][y]; if(b == null) { blocks[x][y] = "air"; return "air"; } return b; }
fea4a107-1176-4af2-aada-7c57722adc99
8
public void setRestaurant(int restaurantID) { this.mRestaurantID = restaurantID; switch (mRestaurantID) { case 0: // andre subRole = new AndreCustomerRole(super.mPerson); // if(AndreRestaurant.customers % 2 == 0) { AndreRestaurant.addCustomer((AndreCustomerRole) subRole); // } else { // subRole = An...
1e039619-cd97-455c-bb04-33f914095d79
3
public void setSelectedTile(File selectedTile) throws IOException { if(selectedTile.getParent().endsWith("autotiles")) { MapAutotile auto = new MapAutotile(ImageLoader.get().getSprite(selectedTile.getAbsolutePath())); tileName = selectedTile.getName(); int frames = MapGridArray.isAnimatedTile(tileName.replac...
7d7e31a5-4047-4ed5-b9a9-a39836be7d94
8
@Override public Success<MemberDef> parse(String s, int p) { // Parse any qualifiers. List<String> quals = new ArrayList<String>(); for (;;) { Success<String> resQual = parseFieldQualifier(s, p); if (resQual == null) break; quals.add(resQua...
922052fd-20bb-4f3c-b221-855aa4ab4313
7
private PFResult findNextOptimalRoad(AID sourceNodeAID, AID finalNodeAID) { PFNode currentNode = endNodeNameToNodeMap.get(sourceNodeAID).get(0); close(currentNode); while (!(currentNode.nodeAID).equals(finalNodeAID)) { ArrayList<PFNode> children = childNodeMap.get(currentNode); for (PFNode child : chil...
8b8e8bf4-17d3-4860-9c63-d0b9d38a5322
9
private void menuRenameColsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuRenameColsActionPerformed // get selected columns and check for empty selection int[] selected_cols = getSelectedColumns(); if (selected_cols.length == 0) throw new IllegalArgumentException("Empty column ...
21b78d72-d26d-4862-bf41-1ede77bf8f3a
5
private int sumSharingFunc(Organism organism, int speciesI, int organismJ) { int sum = 0; for (int i = 0; i < getSpecies().size(); i++) { for (int j = 0; j < getSpecies().get(i).getNumberOrganisms(); j++) { if (i != speciesI || j != organismJ) { if (organi...
f940691d-fd05-4aa7-837e-8ac53f88028d
0
public static void main(String[] args) { new SmallWorld(); }
32251a64-eb06-4b02-b682-016bb98623f6
2
public boolean equals(Edge o) { if (o.start == this.start && o.end == this.end) { return true; } return false; }
10916317-d50b-4ca5-a5a9-6a7e9e5a1e87
5
public void guess() { int number;//the generated number int guess;//the number pressed by the player System.out.println("I have a number between 1 and 100. Can you guess my number?"); System.out.println("By choosing 0, you can quit the play"); number = choose(); //The player can try to guess the number 3...
e5b041a4-34f8-4691-9518-59a050a3f9de
2
@Override public Action getAction(String aId) throws InvalidJSONException, BadResponseException { Action a = null; JsonRepresentation representation = null; Representation repr = serv.getResource("intervention/" + interId + "/action", aId); try { representation = new JsonRepresentation(repr); } catc...
4ad72e72-8c6b-48dd-afe1-d937bd76a61d
8
private boolean isComplexContentValidlyDerived(ComplexTypeComplexContent ct1, ComplexTypeComplexContent ct2) { ComplexTypeComplexContentExtension ex = complexTypeSelector.transformComplexContent(ct2); String base = ex.getBase(); if (base == null || ex.getParticle() != null || !ex.getAttributeUses().equals(A...
d5ece1ba-4879-4e00-b2b0-55f84c1fbfcd
9
* responsible for reporting the error to the user through * ValidationEventHandler. */ private IMetadataType convert(Number v) throws Exception { /** * Validate the max/min values. */ if (minInclusive != null && v.doubleValue() < minInclusive) { throw ...
e1904df6-7b4e-4da0-af6c-d85d679ff071
6
final void HA(int i, int i_200_, int i_201_, int i_202_, int[] is) { float f = ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5681) + ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492) .aFloat5662) * (float) i + (((Class101_Sub1) ((SoftwareToolkit) thi...