method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3d193e10-296f-450e-a8c1-7d5d9a74ac07
3
public void inheritAllConstructors() throws CannotCompileException, NotFoundException { CtClass superclazz; CtConstructor[] cs; superclazz = getSuperclass(); cs = superclazz.getDeclaredConstructors(); int n = 0; for (int i = 0; i < cs.length; ++i) { ...
d127efbe-4e72-4505-8314-3fbaa7c3117b
3
public static boolean registerEvent(final IEvent event) { if(!eventMap.containsKey(event)) { //We need to set up the Map to not bitch about things HashSet<Pair<Method, EventListener>> set; TreeMap<Priority, HashSet<Pair<Method, EventListener>>> value = new TreeMap<Priority, HashSet<Pair<Method, EventLis...
3abf6aa3-fec7-4d54-8127-0b93bb3f8432
9
public void setSelectedTimezone(String timezone){ Regions selectedTimezone = Regions.valueOf(timezone); switch (selectedTimezone){ case Simplified: updateForStandard(); break; case All: updateForAll(); break; ...
8d3e99ed-4f9e-40ce-8f78-c249477bb5d9
8
public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, TikaException, SAXException { // Process the file straight through once OggFile ogg = new OggFile(stream); // To track the streams we find ...
bfa7184e-a142-4df0-837f-1d795079052d
4
public static void rename(Automaton a) { State[] s = a.getStates(); int maxId = s.length - 1; Set untaken = new HashSet(), reassign = new HashSet(Arrays.asList(s)); for (int i = 0; i <= maxId; i++) untaken.add(new Integer(i)); for (int i = 0; i < s.length; i++) if (untaken.remove(new Integer(s[i].getID(...
2c87aca8-87a0-48db-99ec-55ee367774a4
8
public static int[] getNextPixel(int orientation_index) { // RSLV: find a mathematical expression for the switch statement? int[] dp = new int[2]; // [0]=dx, [1]=dy switch(orientation_index) { case 0: dp[0] = 1; dp[1] = 0; break; case 1: dp[0] = 1; dp[1] = 1; break; case 2: ...
19378310-b63a-425a-ac60-6802422e07df
7
public boolean checkDuplicate(String checkThis, int choice) throws ClassNotFoundException, SQLException { String query = ""; if(choice == 0) query = "select suppvname from supplier where suppvname='"+checkThis+"'"; else if(choice==1)//mabelle query = "select co...
f76c6766-49c5-459b-86b5-28b74f875f91
8
@Override public void mouseDragged(MouseEvent e) { // TODO Auto-generated method stub /*System.out.println("Mouse: (" + e.getX() + ", " + e.getY() + ")"); System.out.println("MouseOnScreen: (" + e.getXOnScreen() + ", " + e.getYOnScreen() + ")"); System.out.println("Pane: (" + this.getX() + ", " + this.getY() +...
18cd6f0c-8b1a-4105-bb8f-27ed734c3eb4
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LinkedThread that = (LinkedThread) o; if (id != that.id) return false; if (headLine != null ? !headLine.equals(that.headLine) : that.headLine !...
bcf7ed61-4278-45c5-9539-f64f859db008
1
private boolean jj_3_6() { if (jj_3R_24()) return true; return false; }
6ccd4b4f-766d-41de-a214-31d16f1cd597
5
public <T> ObjectConstructor<T> get(TypeToken<T> typeToken) { final Type type = typeToken.getType(); final Class<? super T> rawType = typeToken.getRawType(); // first try an instance creator @SuppressWarnings("unchecked") // types must agree final InstanceCreator<T> typeCreator = (InstanceCreator<...
2bc2be87-1ad6-4276-84e1-f21e74c3f735
7
public static Rule_EQ parse(ParserContext context) { context.push("EQ"); boolean parsed = true; int s0 = context.index; ArrayList<Rule> e0 = new ArrayList<Rule>(); Rule rule; parsed = false; if (!parsed) { { ArrayList<Rule> e1 = new ArrayList<Rule>(); int s1 = c...
d04cd76b-c0a8-4744-a7e0-e570306ebaca
5
public void update(Observable o, Object arg1) { if (arg1 != null && arg1 instanceof String && ((String) arg1).contains("VS")) // View settings updates { m_frame.remove(m_centerPanel); m_centerPanel.removeAll(); if (ViewPreferences.getInstance().getCenterView() == CenterView.WEEK) m_centerPanel.add(m_w...
2699a4fc-0036-4fcf-b19f-e25289837e3b
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...
e14a9200-bebf-45ea-8c02-72a0c8ac3ef3
9
int insertKeyRehash(float val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look ...
87d5b392-209b-44cd-bc8c-8afc8e3ea54a
0
public void setOutlinerDocument(OutlinerDocument doc) { super.setDocument(doc); }
d7755200-523b-41f6-ba34-07fac01e1006
2
public boolean siirtoTormays(int xMuutos){ Palikka[][] pelipalikat = peli.getPalikkaTaulukko(); for (Palikka palikka : this.palikat) { if (pelipalikat[palikka.getY()][palikka.getX()+xMuutos] != null){ return true; } } return false; }
f512706c-a1da-480f-8156-c048b576a97e
3
@Override public void run (){ String line; BufferedReader fromClient; DataOutputStream toClient; boolean verbunden = true; System.out.println("Thread started: "+this); // Display Thread-ID try{ fromClient = new BufferedReader // Datastream FRO...
01c5bf19-df01-438a-a592-6322807edf66
8
@Parameters({"browser"}) @Test(groups = {"newaccount"}) @BeforeClass public void beforeClass(String browser) throws IOException, InterruptedException { if (browser.equals("firefox")) { driver=browserFirefox(); } if (browser.equals("chrome")) { driver=browserChrome(); ...
de79ea93-afd0-47e9-8f15-bd674d0dde37
2
public Bird(Vector2 position, float radius, Vector2 velocity, float maxSpeed, Vector2 heading, float mass, Vector2 scale, float turnRate, float maxForce, BirdMinigame minigame) { super(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce); behavior = new SteeringBehavior(th...
9c6b940f-3651-45df-b7c7-0fd3dcc2cb0c
2
private void checkSymbolInRange(int symbol) { if (symbol < 0 || symbol >= getSymbolLimit()) throw new IllegalArgumentException("Symbol out of range"); }
bbf2d631-6dc5-4a5c-9bab-4dff5ba79516
7
public void run() { int frames = 0; int tickCount = 0; double delta = 0; double secondsPerTick = 1 / 60.0; long lastTime = System.nanoTime(); requestFocus(); while(running) { long now = System.nanoTime(); long elapsedTime = now - lastTime; lastTime = now; if (elapsedTime < 0) e...
e4ede3ea-e39f-4bea-9645-b324b4d7bd40
1
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; if (!isTokenValid(request)) { ((HttpServletResponse) resp).sendRedirect("/error.ctrl"); } saveToken(request); ch...
2df56b6a-f650-4d5a-9c6d-b2e7c842c4a5
4
public static boolean contains( Object[] array, Object value ) { if( array == null || value == null ) return( false ); for( int i = 0; i < array.length; i++ ) { if( value.equals( array[ i ] ) ) return( true ); } return( false ); }
8f0bdcc0-7817-45a2-bd37-8adfdc4cfee1
9
private void shortLoop(Raster source, Raster dest, Rectangle destRect, int incr1, int incr2, int s_x, int s_y) { MultiPixelPackedSampleModel sourceSM = (MultiPixelPackedSampleModel)source.getSampleModel(); Data...
2261c7d4-a8b3-4379-9659-847ab19e9f07
2
public static Connection getWDMRConnetion(final String url, final String database// , final String user, final String password// ) { final String connetUrl = JDBCConnector.JDBC_URI_MYSQL + url + "/" + database; try { Class.forName(JDBCConnector.JDBC_DRIVER_MYSQL); Connection conn = DriverManager.getCon...
fc455d8c-121d-4ddb-a454-6dbea551cb91
9
final void method3505(boolean bool, int i, int i_84_, boolean bool_85_, int i_86_, boolean bool_87_, int i_88_) { if (bool_85_ != true) ((Class361) this).anInt4453 = 116; anInt4434++; int i_89_ = 256; if (bool_87_) i_89_ |= 0x20000; i_86_ -= ((Class361) this).anInt4453; i_84_ -= ((Class361) this).a...
aa6acdb5-6ab4-4b1f-808a-ce6286113ec5
4
void kill () { if (Windows.trace) System.err.println ("kill bus" + this); // notify any listeners that the bus died, and // clear backlinks that we control if (listeners.size () > 0) { synchronized (devices) { for (int i = 0; i < devices.length; i++) { if (devices [i] == null) conti...
dfbfa907-4269-4f72-8db3-2682bd0513a6
7
public static boolean[] nextPosition(boolean switches[], int numTrue){ String value = ""; boolean retSwitches[] = new boolean [switches.length]; for(int i = 0; i < switches.length; i++){ value += switches[i] == true ? 1 : 0; } value = value.replaceAll( "[^\\d]", "" ); int currentValue = Integer.pars...
df6847ef-fed5-48ab-9113-6612dbb39ddd
1
public static WriteYCbCr getInstance() { if (writeYCbCrSingleton == null) { writeYCbCrSingleton = new WriteYCbCr(); } return writeYCbCrSingleton; }
585c94ba-2d5f-41a0-9dbc-5ccdf061e594
3
public static int countStringInText(String src, String targetString) { if (isStringNullOrWhiteSpace(src) || isStringNullOrWhiteSpace(targetString)) return 0; int start = 0, index = -1, count = 0; while ((index = src.indexOf(targetString, start)) != -1) { count++; start = index + targetString.length(); } ...
02824b80-4144-460f-894e-845b64b92234
2
private void uploadAgenciesData(ArrayList<ArrayList<GenericGtfsData>> all_entities_data, String username, String password){ try{ for (int i=0; i<all_entities_data.size(); i++){ uploadAgencyData(all_entities_data.get(i), username, password); } } catch(Exception e){ _log.error(e.getMessage()); return;...
0f04b1d4-68e2-44ac-8b9c-6c01197374a0
8
public static int getContactDist(Integer pS, Integer pD, int maxDistLim) { LinkedList<Integer> q = new LinkedList<Integer>(); q.add(pS); HashSet<Integer> visited = new HashSet<Integer>(); visited.add(pS); HashSet<Integer> done = new HashSet<Integer>(); HashMap<Integer,Integer> distances = new HashMap<Intege...
79854b3e-a5f3-49e4-b510-2518a714290c
8
public String evaluate(int i, LinkedList linkedlist) { String s = ""; if(linkedlist == null) return ""; for(ListIterator listiterator = linkedlist.listIterator(0); listiterator.hasNext();) { XMLNode xmlnode = (XMLNode)listiterator.next(); if(xmlnod...
b33531fb-0a2e-4abb-b788-d7f79c437197
2
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //Get register form data String firstname = request.getParameter("firstname"); String lastname = request.getParameter("lastname"); String email = request.getParameter("email"); String passw...
41e4927d-fb16-49bc-9054-7494dba94883
7
public void generateDatasetFromBeginning(String datasetFile, HashMap<String, Integer> files, int numOperations) throws IOException { FileWriter fstream = new FileWriter(datasetFile); BufferedWriter out = new BufferedWriter(fstream); int fileNum = files.values().size() + 1; int totalFiles = fileNum - 1; Obj...
c0d9f425-a07f-4d01-877c-ca6fe463e53b
3
@Override public void render(Graphics2D graphics) { final int startPointGridXCoordinate = 150; final int startPointGridYCoordinate = 20; final Set<Position> positions = objectTron.getElements().keySet(); for (int i = 0; i < objectTron.getGridWidth(); i++) { for (int j = 0; j < objectTron.getGridHeight(); j+...
d671f298-bfc3-4382-947a-8abed7b70ce1
6
public VariableCreator() { setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); if(System.getProperty("resources") == null) System.setProperty("resources", System.getProperty("user.dir") + "/resources"); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder...
52d720c4-3d0f-44c0-801b-74bbede4e149
0
public void highlight(int row, int column) { highlight(row, column, THRG); }
1c422510-2e18-4b9c-b8f7-5be7263256c8
7
public void moveSouth() { boolean [] temp = WhenShitHits.Enemy2Setpiece(this, 5); if(temp[2] == false) { if(direction != 5) { direction = 5; anamationFrame = 0; pic = southAnamation()[anamationFrame]; animate = false; if(animationTimer.is...
bb730c5f-fee7-441f-af94-9255158ddbac
9
public static boolean initFunctions(Object obj, List<Func> dst, String funcStr) { if (StringUtils.isEmpty(funcStr) || StringUtils.isBlank(funcStr)) { return true; } int PRE_ARGS_NUM = -1; Class<?>[] PRE_ARGS_TYPE = null; try { PRE_ARGS_NUM = obj.getClass(...
559b0662-243c-4d43-a357-c3017442c432
8
private void trySearch(int k) { // loai bo cac o de bai while (k < SIZE * SIZE && matrix[k / SIZE][k % SIZE] != 0) { k++; } if (k == SIZE * SIZE) return; int row = k / SIZE, col = k % SIZE; for (int x = 1; x <= SIZE; x++) { // duyet cac TH if (isOK(row, col, x)) { matrix[row][col] = x; i...
b4bdee2b-5ea6-4e68-b5a1-d5c99f5c05ea
8
public void calcLightDepths(int var1, int var2, int var3, int var4) { for(int var5 = var1; var5 < var1 + var3; ++var5) { for(int var6 = var2; var6 < var2 + var4; ++var6) { int var7 = this.blockers[var5 + var6 * this.width]; int var8; for(var8 = this.depth - 1; var8 > ...
785d0797-62a9-47b9-9331-d9f09eb8779c
7
@Override public HashMap<String, Integer> parsePoints(String seasson, String day) throws IOException { HashMap<String, Integer> playersPoints = new HashMap<String,Integer>(); URL url = new URL(buildURL(seasson, day)); URLConnection uc = url.openConnection(); InputStreamReader input = new InputStrea...
967a2e61-31e8-4b8a-ae5c-4215df13f971
4
public void print(String ans, int leftCount, int rightCount) { if (leftCount == 0 && rightCount == 0) { System.out.println(ans); return; } if (leftCount > 0) { print(ans + "(", leftCount - 1, rightCount); } if (rightCount > leftCount) { ...
e43d09af-7d84-4c73-a865-8f806cac2be9
1
@Override public void start() throws Exception { String[] args= this.par.getArgs(); int inputNumberValues= args.length - 1; //-1 for command word if(inputNumberValues != 3) throw new Exception("Incorrect input for kmeans"); int clusterNumber= Integer.valueOf(args[1]); int maxIter= Integer.valueO...
1a33d94a-3b6a-4a22-888a-94cc35101cb5
1
@Override public List<Integer> sort(List<Integer> list) { // checking input parameter for null if (list == null) { throw new IllegalArgumentException("Disallowed value"); } int low = 0; return sortPartition(list, low, list.size() - 1); }
df1b8325-e157-404a-ae02-65a9e5522acb
7
@Override public boolean tick(Tickable ticking, int tickID) { if(!(affected instanceof MOB)) return super.tick(ticking,tickID); final MOB mob=(MOB)affected; if((CMLib.flags().isStanding(mob)) &&(mob.isInCombat()) &&((mob.fetchAbility(ID())==null)||proficiencyCheck(null,0,false)) &&(tickID==Tickable.T...
e2fcfd8d-bcef-4629-8811-6963822ee7b1
2
public static boolean validPalindrome(int n) { final String numberToString = Integer.toString(n); final int length = numberToString.length(); for (int i = 0; i <= (int) length / 2; i++) { if (!(numberToString.charAt(i) == numberToString.charAt((length - 1) - i))) { return false; ...
b23bd071-56bc-479f-b660-ca443a219616
2
public void method280(int tileZ, int z, int y, Entity entity, byte objectConfig, int uid, int x) { if (entity == null) { return; } GroundDecoration groundDecoration = new GroundDecoration(); groundDecoration.entity = entity; groundDecoration.x = x * 128 + 64; groundDecoration.y = y * 128 + 64; groundDe...
cb9253d2-4c77-4288-967f-d1ee48d66c6e
9
@Override protected void xread_activated (Pipe pipe_) { // There are some subscriptions waiting. Let's process them. Msg sub = null; while ((sub = pipe_.read()) != null) { // Apply the subscription to the trie. byte[] data = sub.data(); int size = s...
dc494f8d-b7af-4d30-9f60-2c9623d6b6a7
9
public Trace getTrace_v3(int xStart, int yStart, int sourceID, int threshold) { // Multiple query to be created based on threshold: String multiQuery = ""; for (int i=0; i < threshold; i++) { for (int j=0; j < threshold; j++) { multiQu...
a6d53d7f-d261-47a4-8cbc-32dca64a8ead
0
private Set<Card> threeSevensAndAceKing() { return convertToCardSet("3S,AS,KD,9S,TD,3C,3H"); }
43f41ba3-af98-4ea8-8b8c-563a923c447d
6
public void discard(int amount) { System.out.println("Discarding"); GeometryFactory factory = Helper.getGeometryFactory(); LinkedList<LabelGeneOverlap> overlappingGenes = new LinkedList<LabelGeneOverlap>(); for (int geneI = this.size() - 1; geneI > 0; geneI--) { LabelGene gene = this.get(geneI); double ov...
7d45717f-e400-4191-a2ad-a628975541b2
5
public void checkCustomDown(Node node) { this.down = -1; // reset value to -1 // Prevent out of bounds if((node.getX()+2) < this.size.getX()) { if(checkWall(new Node( (node.getX()+2), (node.getY()) ))) { if(this.closedNodes.size()==0) this.down = 1; else { for(int i = 0; i < this.closedNodes....
5c579570-7966-40ee-bfc9-3e7612240a9a
6
@Override public void actionPerformed(ActionEvent e) { //System.out.println("SelectAllAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c ins...
e68eb51a-1ac3-4045-863c-3630697c2702
2
public AccountTypes() { AccountType active = new AccountType(); active.setName(ASSET); // active.setName(getBundle("Balances").getString("ASSET")); AccountType passive = new AccountType(); passive.setName(LIABILITY); // passive.setName(getBundle("Balances").getString("LIAB...
12bceb5d-7ba5-4e31-8626-6f520050c244
8
@Override public MoonPhase getMoonPhase(Room room) { int moonDex = (int)Math.round(Math.floor(CMath.mul(CMath.div(getDayOfMonth(),getDaysInMonth()+1),8.0))); if(room != null) { final Area area = room.getArea(); if((room.numEffects()>0) || ((area != null)&&(area.numEffects()>0))) { final List<Abilit...
00de14d0-c3bb-4941-8d22-fee745a6518c
1
protected <T> String toJson(final T object) { if (object == null) { throw new IllegalArgumentException("object parameter is null"); } Gson gson = GsonFactory.create(); return gson.toJson(object); }
75b83725-77ef-48ba-b51d-61a5c215ddac
6
public List<String> getSortedFundCodes(String type, int top, SortMethod sortMethod){ List<String> candidates = new ArrayList<String>(); if(mapBasicInfos == null){ mapBasicInfos = new HashMap<String, List<String>>(); for(String[] basicInfo : basicInfos){ List<String> data = new ArrayList<String>(); dat...
ab184bdb-135f-470b-a353-81ba4813cfa0
0
protected Icon getIcon() { java.net.URL url = getClass().getResource("/ICON/blocks.gif"); return new javax.swing.ImageIcon(url); }
335084f8-e7a6-4b0d-a708-8654984d27a1
8
private void sortTuts() { ArrayList<Timeslot>overfilledTuts; for(Student s: students){ if(!s.getFlaggedForTuts()){ s.setAssignedTut(s.getCombinedTuts().get(0)); s.getCombinedTuts().get(0).addStudent(s); } } Student currentStudent; overfilledTuts=overFilledTuts(); while(!overfilledTuts.isEmpt...
de4a4554-dd1a-462e-ad49-d24f791e9ab9
1
public final Image loadImage(String url, int width, int height) { Image image = panel.getToolkit().createImage(ClassLoader.getSystemResource(url)); MediaTracker tracker = new MediaTracker(panel); tracker.addImage(image, 1, width, height); try { tracker.waitForAll(); } catch (InterruptedException e) { th...
1dc3274e-872f-4075-8240-b666ce469d0e
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...
2f4afbf4-fd4f-4b6f-bd26-c30f685d9111
9
public boolean addProcess(SwapProcess proc) { SwapProcess tempProc = proc; int size = tempProc.getSize(); int startIndex = 0,index = nextIndex; boolean added = false,firstLoop = false;; while(index < 100 && !added) { startIndex = nextHoleIndex(index); ...
30f789e7-ad60-40b8-95de-9de6c94bd535
0
public void setAdresse(String adresse) { this.adresse = adresse; }
5e3c56db-ade9-44f2-8137-32714c248df0
9
@Override public void initTest(boolean argDeserialized) { if(argDeserialized){ return; } Body ground = null; { BodyDef bd = new BodyDef(); ground = getWorld().createBody(bd); PolygonShape shape = new PolygonShape(); shape.setAsEdge(new Vec2(-40.0f, 0.0f), new Vec2(40.0f, 0.0f)); ground.c...
a69b51ad-97f7-4ba5-b154-f75c4f7d4ed5
0
public T1 getFoo1() { return foo1; }
1d51d901-2168-4096-9d6e-b346d3374dff
0
@Override public void init(List<String> argumentList) { offset = Integer.parseInt(argumentList.get(0)); identifier = argumentList.get(1); }
d0ea31c4-af1f-4be3-a801-5e74c41698d3
2
public Match getMatch(int noMatch){ for (Match match : liste) { if(match.getId() == noMatch) return match; } return null; }
e83ebea5-f24c-426b-85c4-c3fb08d1905e
9
public String toString() { if(isRoyalFlush()) return "a Royal Flush"; else if(isStraightFlush()) return "a Straight Flush"; else if(isFour()) return "four of a kind"; else if(isFullHouse()) return "a Full House"; else if(i...
e75e15c6-3089-417a-9940-300c4b296194
2
public void removePush() { if (stack != null) instr = stack.mergeIntoExpression(instr); if (pushedLocal != null) { Expression store = new StoreInstruction(new LocalStoreOperator( pushedLocal.getType(), pushedLocal)).addOperand(instr); instr = store; } super.removePush(); }
7ecc937f-c156-4807-8f87-787e15dc181e
0
private void controlsKitParam(){ final int X_SIDE = 235; final int Y_SIDE = 180; final int HEIGHT_KIT_PARAM_GROUP = 100; final int MIN_VALUE = 1; final int MAX_VALUE = 10; final int DEF_VALUE = 5; JPanel groupKitParam = new JPanel(); LayoutManager layout...
c2a8db27-2dcc-42bb-80ef-5834933d5f77
6
public static Object getValue(String key,Object obj) { String error = ""; if ( obj instanceof Map ) { return ((Map)obj).get(key); } try { BeanInfo binfo = Introspector.getBeanInfo(obj.getClass(), Object.class); PropertyDescriptor[] props = binfo.getPro...
c5e8b799-2f4f-478a-a923-a00c9a66a9f3
0
@ManyToOne @JsonIgnore public Car getCar() { return car; }
2039d467-6e72-47be-9467-9f618f6d01c4
4
public double rawItemRange(int index){ if(!this.dataPreprocessed)this.preprocessData(); if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive"); if(!this.variancesCalculated)thi...
42cd2b43-d956-46d5-82a4-4f661d80ba5b
5
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String user = request.getRemoteUser(); PrintWriter out = response.getWriter(); showBartenderOrdersForm(out); int p=0; // u.getAccess()==1 if (user != null) { try { p=loggedInUse...
4ed0a2d6-c9e2-4ab2-9838-a44f4d3d179f
9
public String addBinary(String a, String b) { if (a == null || a.length() == 0) return b; if (b == null || b.length() == 0) return a; int i = a.length() - 1; int j = b.length() - 1; int carry = 0; StringBuilder res = new StringBuilder(); while (i >= 0 && j >= 0) { int digit = (int) (a.charAt(...
ba8d21ff-b72b-4ffd-a2fb-6fad2d04263e
6
final public FuncName FuncName() throws ParseException { Token n; FuncName f; n = jj_consume_token(NAME); f = new FuncName(n.image); label_4: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 73: ; break; default: jj_la1[14] = jj_gen; break label_4; } jj_consume_...
8dfcf7b4-97e2-4e46-af1a-897057ae4534
7
boolean loadScriptFileInternal(String filename) { if (filename.toLowerCase().indexOf("javascript:") == 0) return loadScript(filename, viewer.eval(filename.substring(11))); Object t = viewer.getInputStreamOrErrorMessageFromName(filename); if (!(t instanceof InputStream)) return loadError((String) t); Buffe...
39070f34-8e53-4087-b09a-659b07f97e94
3
public Object getValueAt(int row, int column) { switch (column) { case 0: return variables[row]; case 1: return firstSets[row]; case 2: return followSets[row]; } return null; }
2f195742-9518-4e20-a560-304740bcce1a
5
@Override protected void read(InputBuffer b) throws IOException, ParsingException { iv = b.get(0, 16); int curve = Util.getShort(b.get(16, 2)); if (curve != 714) { throw new ParsingException("Unknown curve: " + 714); } int xLength = Util.getShort(b.get(18, 2)); if (xLength > 32 || xLength < 0) { ...
8bd094e3-8d09-4e7c-b02c-c4423168c3b8
6
private void createRoadsRelations() { // Cas des villes voisines pour les routes. for (JTown t: towns) { // Pour chaque ville. for (JRoad r: t.getRoadNeighbours()) { // Pour chaque route voisine de la ville. r.addTownNeighbour(t); // Ajouter la ville en tant que ville voisine de la route. } } // Ca...
d4fa0ca4-6ab0-4d14-9b18-82c3b7dbd50e
7
private RGBImage(final int width, final int height, final int type, final PixelSupplier supplier) { this.width = width; this.height = height; this.type = type; this.pixelValues = new int[width * height * 3]; final ErrorHandler errorHandler = new ErrorHandler(); final Ex...
14720974-43a8-46df-ae89-9868ed56a15e
7
public static List<String> getColumnList(File file, int index, String sep,boolean ignore) { List<String> ret = new ArrayList<String>(); BufferedReader br = null; try { // 构造BufferedReader对象 br = new BufferedReader(new FileReader(file)); int ln = 0; String line = null; while ((line = br.readLine()...
64a946a8-864d-47b0-9042-9b7a5976f6dc
6
private void recMinMax(Node currentNode, int player, int depth) { // depth_lpnode = depth of (l)ast (p)arent node if (currentNode.empty) { return; } // until last node with children (max_depth -1 means depth_lpnode = last parent node) // if (currentNode.nodeDepth != ...
bd6a83fa-a033-42b0-a46b-e768e03deec9
2
@Override public void propertyChange(PropertyChangeEvent pce) { if (pce.getSource() instanceof AbstractModel) { registeredViews.forEach(x -> x.modelPropertyChange(pce)); } else if (pce.getSource() instanceof AbstractView) { registeredModels.forEach(x -> x.viewPropertyChange(p...
6ccecfe8-3961-405c-b628-7ac00383f846
1
public String getWord() { //if more than 90% of the word occurrences are capital, //then use capital style if ((mFreq * 0.90) < mCapitalFreq) return Character.toUpperCase(mWord.charAt(0)) + mWord.substring(1); else return mWord; }
22272124-ac4d-48da-8ebc-1ba9bf62b85a
1
private void declareLabel(final Label l) { String name = (String) labelNames.get(l); if (name == null) { name = "l" + labelNames.size(); labelNames.put(l, name); buf.append("Label ").append(name).append(" = new Label();\n"); } }
be791321-3dc4-4c7a-8ce9-55472e760f94
1
public boolean ModificarCultivo(Cultivo p){ if (p!=null) { cx.Modificar(p); return true; }else { return false; } }
bc159606-dfcd-4d97-ad78-2ffc952ad91f
3
public Object getValueAt(int row, int col) { if(row>-1 && col>-1 && data!=null) return data[row][col]; else return null; }
5bfd878b-d541-4e7c-93e0-9b1cf4e03964
2
private boolean searchTableColumns( String keyword ) { for ( Column column : table.getColumns() ) { if ( column.getFldType().equalsIgnoreCase( keyword ) ) { return true; } } return false; }
0e8b0764-44e9-4d8e-840f-af822e169674
7
public static void postfix(String postfixInput) { int result = 0; int val = 0; int var1 = 0; int var2 = 0; char ch = ' '; Stack s = new Stack(); for (int i = 0; i < postfixInput.length(); i++) { ch = postfixInput.charAt(i); ...
efb27741-9889-4b8f-90e7-e802b0b07e41
0
public void setLevel(int level) { this.level = level; }
7cb787c2-342a-4982-b3ae-50522bc08639
4
private boolean parseStart(){ // There MUST be tokens left at the start int[] parsed = parsePrefix(); if (parsed == null){ // Error parsing return false; } NumberToken next = peek(); if (next == null){ // Units, can't ...
5d4b7d7b-6f98-4f62-bc17-db8152b659cb
0
public Primes() { super("Find Prime Numbers"); }
23e732bc-c597-4ed1-908c-992e1749cae8
7
@Override public void setData(ByteBuffer in) { size = in.getInt(); width = in.getInt(); height = in.getInt(); planes = in.getShort(); bitsPerPixel = in.getShort(); compression = in.getInt(); sizeOfBitmap = in.getInt(); horzResolution = in.getInt(); ...
a459be55-0e01-4084-b986-8c13f5156a19
8
@Override public void update() { for(Planet p : planets){ p.update(); } Set<Ship> toremove = new HashSet<Ship>(); for(Ship s : ships){ s.update(); { double x = s.getCentrePoint().getX(); double y = s.getCentrePoint().getY(); if(x < 0 || x > width || y < 0 || y > height){ toremove.add(...
0f8164bc-e5eb-4274-aa98-35045612de74
6
void initInputFrame( final ClassWriter cw, final int access, final Type[] args, final int maxLocals){ inputLocals = new int[maxLocals]; inputStack = new int[0]; int i = 0; if((access & Opcodes.ACC_STATIC) == 0) { if((access & MethodWriter.ACC_CONSTRUCTOR) == 0) { inputLocals[i++] = OBJECT | cw.add...
4cbe52ba-c3c9-46ad-9b9e-d872bcc728be
1
public int leiaInt() { int numero = 0; String linha ; BufferedReader entra = new BufferedReader(new InputStreamReader(System.in)) ; try { linha = entra.readLine() ; numero = Integer.valueOf(linha).intValue(); } catch (Excep...