method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f7b0112d-8400-43a7-beda-55770dc54d8c
3
@Override public void run() { int i = 0; int random = (int) Math.round(Math.random() * 2); setImage(images[random]); while(true) { do{ i++; xPosition -= 1; gameVue.repaint();...
4043c7a7-57bc-43b7-b446-d286d4324ddb
0
public byte[] getModulus() { return modulus; }
2acf78f3-7563-4e16-b047-608092f7afe6
6
public static String getProxyLocation() throws IOException { String str2 = null; String str1 = System.getenv("X509_USER_PROXY"); if (str1 == null) { str1 = System.getProperty("X509_USER_PROXY"); } if (str1 != null) { return str1; } try { ...
a6fca09e-be09-49bd-aa7c-4bbc57f9e78e
8
public String applyFunctianality(Text text) { ArrayList<String> firstSentenceWords = new ArrayList<String>(); boolean isFirstSentence = true; Iterator<PartOfText> parts = text.getParts(); while(parts.hasNext()){ PartOfText part = parts.next(); if(part instanceof S...
401c5471-ddc4-45f4-83f1-2ca9bedbd824
7
public WhoObject (String s, boolean sortname) { S=s; SortName=sortname; if (s.length()<=30) { V=-50; Name=""; Stat=""; return; } Stat=s.substring(0,5); StringParser p=new StringParser(s.substring(30)); String h=p.parseword(); p=new StringParser(h); if (p.isint()) { V=p.parseint(); if (p.skip("k"))...
b3bd528c-3590-4f27-a7f4-5def461c7d6d
6
public nameList addNameNoSave(String x) { if(x.equals("") || x.equals("null")) return null; nameList temp = head; while(!(temp==null)) { if(temp.getName() != null) if(temp.getName().equals(x)) return temp; temp = temp.getNext(); } tail = new nameList(x,tail); if(head == null) head =...
a5d9cd83-4649-44ff-8824-bf71b6e8a7d3
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String data = ""; response.setContentType("text/plain"); response.setCharacterEncoding("UTF-8"); PrintWriter writer = response.getWriter(); String dbDriver = "org.postgresql.Driver"; ...
1827faf9-401a-414f-baa9-551c267091eb
1
private static String getPath(File file) { try { return file.getCanonicalPath(); } catch (IOException e) { return file.getAbsolutePath(); } }
50b711d1-dcb8-4983-830b-e33324d4bdcd
9
public void actionPerformed(ActionEvent e) { //perform login function if users clicks logins if (e.getSource() == btnLogin) { String user = txtUsername.getText(); char[] pass = password.getPassword(); String p = new String(pass); int i = 0; logininfo.setInfo(user, p); username = user; try { ...
ad42e283-8d53-426a-830d-b73a2bbea163
3
public void handleModifyFile(FolderWatcherQueue s) { Connection con = DBManager.establishConnection(); DBManager db = new DBManager(); db.serverModify(con, FileFunctions.getRelativePath(s.getFullPath()), db.getTimeStamp(s.getDate())); if (FileFunctions.isDirectory(s.getFullPath())) { File[] files = new F...
5d81fe61-778f-4b45-9a00-b17698ea030b
9
public static void sort(int[] array) { printArray(array); int n = array.length; int bask[][] = new int[10][n]; int index[] = new int[10]; int max = Integer.MIN_VALUE; //array中最高位数 for (int i = 0; i < n; i++) { //求array中的最高位数 max = max > (Integer.toString(array[i]).length()) ? max : (Integer .toStrin...
b8539d75-2245-4906-a081-bc6a4f04ab42
9
public final TransmitterConnectionInfo[] getTransmitterConnectionInfo(long transmitterId) { BaseSubscriptionInfo readBaseSubscriptionInfo = new BaseSubscriptionInfo( _configurationId, AttributeGroupUsageIdentifications.CONFIGURATION_READ_REQUEST, (short)0 ); TransmitterConnectionInfoRequest telegram = new Tr...
26b9b317-62cd-4a85-b7d1-5391f4ec1225
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { __in.peekTag(); if (__typeMapper.verifyElement(__in, accountId__typeInfo)) { setAccountId(__typeMapper.readS...
7fe5223e-603f-4221-bd25-02e0103cc94f
4
public final void adventure() throws RecognitionException, TokenStreamException { try { // for error handling match(BEGIN_ADV); if(board.initGame()) mode = ADVENTURE_MODE; { _loop295: do { if ((_tokenSet_0.member(LA(1)))) { instruction(); } else { break _loop295; } ...
1f6a9df5-6b41-48c7-81a9-0795bbede74a
7
private BufferedImage getDarkenedSourceImage(BufferedImage sourceImage, float startAlpha, float endAlpha, boolean leftToRight, Color blendColor) { if (startAlpha > ZERO_PERCENT_THRESHOLD || endAlpha > ZERO_PERCENT_THRESHOLD) { final BufferedImage blendSource = new BufferedImage(1, sourceImage.getHeight(), Bu...
6db51ee8-3df7-46e9-90cf-1f3ee3df29a7
9
@Override public void modifyGenRace(MOB mob, Race me, int showFlag) throws IOException { if(mob.isMonster()) return; boolean ok=false; if((showFlag == -1) && (CMProps.getIntVar(CMProps.Int.EDITORTYPE)>0)) showFlag=-999; while((mob.session()!=null)&&(!mob.session().isStopped())&&(!ok)) { int showNum...
d6822ca5-c837-4f0f-818c-2d74473acb9e
0
public boolean doesDrawStateLabels() { return drawLabels; }
db7fb450-3cbd-416e-aeeb-3091ff0dd0b4
6
@EventHandler public void ZombieSpeed(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Zombie.Speed.Dod...
858b09b5-675c-42d6-b10d-9b23016eb18a
7
public static Integer gt(Object o1, Object o2){ if (o1 == null && o2 == null){ return 0; } else if (o1 != null && o2 == null){ return 1; } else if (o1 instanceof Number && o2 instanceof Number){ return ((Number)o1).doubleValue() > ((Number)o2).doubleValue() ? 1 : 0; } return 0; }
808c8246-ad1f-4230-8bc4-12b7a35045e9
7
@Override public void onEnable() { saveDefaultConfig(); PluginManager pm = getServer().getPluginManager(); Plugin gmi = pm.getPlugin("GameModeInventories"); if (gmi == null) { System.err.println("[GMIDatabaseConverter] This plugin requires GameModeInventories!"); ...
26191d85-f47a-417d-b0e1-a05123a64b7c
0
@Override public String getPhone() { return super.getPhone(); }
f4d1b0b8-767a-4a6c-94c0-0cd43f8c5120
5
public void saveScores() throws java.io.IOException { int size = this.size(); //sort currente arraylist in decreasing order Collections.sort(this); Collections.reverse(this); try { //check if the file exists, if not, create one File file = new File("d...
f078d863-cc1e-41a4-a2d1-bbb8587254e8
2
private void fitVectorsToSize() { m_fileContent.setSize(getRowsCount()); int fileSize = getRowsCount(); int colCount = getColsCount(); for (int i = 0; i < fileSize; i++) { Vector aRow = (Vector)m_fileContent.get(i); if (aRow == null) { m_fileContent.set(i, new Vecto...
2f2dc9a1-2f4c-4e88-8dc6-a50809b9970f
5
public void minSubArray(int[] arrA, int x) { int start = 0; int ansEnd = 0; int ansStart = 0; int currSum = 0; int minLen = arrA.length; for (int i = 0; i <= arrA.length; i++) { while (currSum > x) { currSum = currSum - arrA[start]; if (i - start < minLen) { minLen = (i - start); ansEnd...
b93a1984-933f-4be6-bdbc-ad2bf2818f27
5
public void quit() { int save = JOptionPane.showConfirmDialog(this, "Do you want to save the changes to this project?", "Close", JOptionPane.YES_NO_CANCEL_OPTION); switch(save) { case 0 : boolean exit = fileOps.saveChanges(); if(exit) break; else return; case 1 : dispose(); break; case 2 :...
a5aea007-2a26-4115-9720-9d20be1b94f9
0
public EncryptedDataType getEncryptedValue() { return encryptedValue; }
8f02bf6c-75d5-4c69-b18a-2d6cec318dbc
3
@Test public void testSnzInputStream() throws IOException, InterruptedException { File tmpDirectory = TestUtil.directoriesToFile("tmp", "SnzInputStreamTest"); TestUtil.copyRecursive(testdataDirectory, tmpDirectory); ProcessBuilder pb = new ProcessBuilder(snzipExecutable, "*"); pb.directory(tmpDirectory)...
0f5dcf96-e07a-4c52-9575-af8368ae6ba8
6
public void testPrintSerializedDataModel(ViewType type){ if(type == ViewType.FOOD_GENRE) { System.out.println("Test"); FoodGenreList testFGL = theSerializedDataModel.getFoodGenreList(); for(int i = 0; i < testFGL.getTheFoodGenreList().size(); i++) { ...
812e255d-8911-43a3-a263-5318b86b4a88
0
public UpdateHandler getUpdateHandler() { return this.update; }
ec96c78a-0bcc-459c-b071-b948d4218805
2
public ContactSorter constructSorter(SortType type) { switch (type) { case FIRST_NAME: return new FirstNameContactSorter(); case LAST_NAME: return new LastNameContactSorter(); } return null; }
8c0a949e-e61b-45e3-82be-1b835fe65fed
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Position other = (Position) obj; if (orientation != other.orientation) { return false; } if (x != other.x) { return f...
6ccc7008-1654-4bed-be87-30d6fe2925b2
3
public static String getMaxAithorID(){ try { ResultSet rs=DB.myConnection().createStatement().executeQuery("select max(AuthorID) from author"); while(rs.next()){ max_Author_id=Integer.toString(rs.getInt(1)+1); } } catch (ClassNotFoundE...
f18f7149-624a-46ce-a2ee-f9935c84966c
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
6445c19f-a27c-41cc-a63c-a4e805a06c3a
0
public Id3v2PlayCountFrame(Property property,PropertyTree parent) { super(property, parent); }
917481f3-2234-4a36-b71d-4c4e5800f992
7
public static int flagsCheck(IOFlags flags) { int output = 0; if (flags.PRODUCE) { if (flags.LOAD) output = 1; } if (flags.SAVE) { if (!flags.PRODUCE) output = 2; } if (flags.LOAD) { if (flags.PRODUCE || flags.SAVE) output = 3; } return output; }
cf7f34bd-e50e-4ee2-963a-e599f7888c54
0
protected final static void writeCRC(OutputStream os, CRC32 crc) throws IOException { int i = (int) crc.getValue(); os.write(new byte[] { (byte) ((i >> 24) & 0xFF), (byte) ((i >> 16) & 0xFF), (byte) ((i >> 8) & 0xFF), (byte) (i & 0xFF) }); crc.reset(); }
12924bb1-f45e-4a20-87af-6dd223b69646
5
public void leave(String message) { if (left) return; left = true; if(properties.containsKey("translation") && !ping) { Translation t = (Translation)properties.get("translation"); System.out.println(t.translate("client.left", message)); } if(message == null) throw new NullPointerException(); t...
aa111ee9-2cf5-4bef-b8c3-a2ba36b273c9
7
public static void main(String[] args) { Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; ComboPooledDataSource source = new ComboPooledDataSource(); try { conn = source.getConnection(); ps = conn.prepareStatement("SELECT * FROM users where name=? and password=?"); ...
5a4ddf1b-2d06-4eaa-ac8d-c81c93d31f64
1
public AdminFrame(DB database, String loginName) { super("Ա"); this.database = database; this.loginName = loginName; GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); this.setLayout(layout); // 3ť JButton button = new JButton("ӹԱ"); layout.setConstraints(bu...
64ee05b1-98ed-46cc-8ee5-c0aaee31aad8
0
@Override public int fight() { return super.fight(); }
be0bc24d-e7e9-4c98-a0a4-6f12c59f0db0
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof SupplierStatus)) { return false; } SupplierStatus other = (SupplierStatus) obj; if (statusId == null) { if (other.statusId != null) { return false; ...
d552df4e-2dd1-4714-b5b4-726275f22b07
8
private void openFile() { JFileChooser fileChooser; if (lastOpenPath != null && !lastOpenPath.equals("")) { fileChooser = new JFileChooser(lastOpenPath); } else { fileChooser = new JFileChooser(); } FileFilter wavFilter = new FileFilter() { @Override public String getDescription() { retu...
264e67c7-8ae9-43b8-8c36-24b5e9284fa6
1
public final byte[] toBytes() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { write(baos); } catch (IOException e) { } return baos.toByteArray(); }
b09fb560-8128-4c64-91df-029cb62f7a71
4
public TreeNode creat( TextProcessing TextPro, String Situ, String ParName ) { TreeNode root = new TreeNode(); InformationGain infoGain = new InformationGain(); root.AttributeName = infoGain.getMaxGain(TextPro); root.SituationName = Situ; root.ParentName = ParName; root.isLeafNode = false; Attribute ob...
77c4ca96-d9a5-4d21-b86f-dc27c002b85b
0
@Override public String getHdfs() { //return "hdfs://192.168.178.41:8020"; return "hdfs://192.168.178.40:9000"; }
cbd50e39-3eac-4467-844b-726c29dd0cfc
9
public static DataSet loadDataSet(String path) throws Exception{ DataSet ret = new DataSet(); ArrayList<Row> datal = new ArrayList<Row>(); FileReader f = new FileReader(path); BufferedReader in = new BufferedReader(f); String line = "";//in.readLine(); while (line != null) { line = in.readLine(); if (...
5cb34574-a85f-47b0-bcda-8cb66a2c78cd
1
public LoggerBuilder(ILoggerConfig loggerConfig) throws Exception { if (loggerConfig == null) throw new IllegalArgumentException("loggerConfig is null"); appenders = new ArrayList<String>(); config = loggerConfig; configureLogger(); }
85000e46-f454-45b9-aaf7-4520c5166e95
9
private void changeDir(int clickX) { int dir = (int)Math.floor(clickX/29) + 1; if (dir == 1) { } else if (dir == 2) { } else if (dir == 3) { } else if (dir == 4) { if (buildDir.equals("N") || buildDir.equals("S")) selectedTrack = 3; ...
a4f75c12-3063-4969-bfb5-215ae20113fd
6
public void visit( final Class<?> type ) { if ( type == null || type.getPackage().getName().startsWith( JAVA_PACKAGE ) ) { return; } // TYPE this.visitElements( type ); if ( !type.isInterface() ) { // CONSTRUCTOR this.visi...
c3ebea4c-656b-4b63-81d1-8be72c59a342
3
@Override public Acesso getByTipo(String tipo) { Acesso acessoLido = null; try{ conn = ConnectionFactory.getConnection(); String sql = "SELECT id " + "FROM acesso" + "WHERE tipo LIKE \'?\';"; ps = conn.prepareState...
b9bdc452-b33f-4e4e-a754-c0f509e61db3
5
public static void createDatabase() { if (getConfig.MySQLEnabled()) { Connection connection = null; Statement st = null; int rs = 0; try { //Connecting to database connection = DriverManager.getConnection("jdbc:mysql://" + getConfig.MySQLServer() + "/" + getConfig.MySQLDatabase() , getConfig.MySQ...
5ac21309-fa1d-48ce-bed8-415a543c2c02
6
private void saveMailsLocalyByFireingUIDLandRETRandDELE(int amount) throws IOException { String reply = ""; String uidlOfMail = ""; for (int i = 1; i <= amount; i++) { // firering UIDL writeToServer("UIDL " + i); reply = readFromServer(); uidlOfMail = reply.split(" ")[2]; // firering ...
eb024edb-8979-4ce1-a1f9-81d9b68667c3
6
public static double getHue(int color) { double var_R = ( color >> 16 & 0xff ) / 255.0; //RGB from 0 to 255 double var_G = ( color >> 8 & 0xff ) / 255.0; double var_B = ( color & 0xff ) / 255.0; double var_Min = Math.min(Math.min( var_R, var_G), var_B ); //Min. value of RGB double var_Ma...
bf08ab47-dba2-47ec-8bab-e25230c269a6
8
public void start() { CommandFactory commands = new CommandFactory(citationStorage, io); io.println("Welcome to \"Citation Needed\"!"); io.println("Available commands: " + commands + ", quit"); while (true) { String commandStr = io.getString("> "); commandStr = ...
216ccb73-3119-413e-90d9-7b3fbcc89c85
9
public ClientP2P() { /* Initialise GUI */ gui = new ClientP2PGUI(this); /* Get server IP */ server_IP = JOptionPane.showInputDialog("Enter server IP:"); if (server_IP == null) System.exit(-1); else if (server_IP.equals("")) server_IP = "localhost"; /* Generate random key */ key = (int) (Math.random()...
4a8dd8f8-5f77-43b7-8288-5bbd34af094c
4
public boolean renderBlockStairs(Block block, int i, int j, int k) { boolean flag = false; int l = this.blockAccess.getBlockMetadata(i, j, k); if (l == 0) { block.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F); this.renderStandardBlock(block, i, j, k); bl...
639cb4bf-a1f5-47dc-8d39-5a99d5a01e75
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof User)) return false; User other = (User) obj; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other.firstNa...
e2fcbd12-c4de-43eb-b116-fd79ff83455b
1
private float gaussian(int sample, int mean){ int diff = Math.abs(mean - sample); // .46 + 2(.22) + 2(.04) + 2(0.01) = 1.0 if (diff == 0) return 1.0f; //else if (diff == 1) return 0.22f; //else if (diff == 2) return 0.04f; //else if (diff == 3) return 0.01f; return 0f; }
8b092045-2084-465f-9f7e-495923df8e30
4
public LigneDeCaisses (Echeancier echeancier) { tableauDesCaisses = new Caisse[nombreTotalDeCaisses]; int i = 0; int rapide = ratioDeCaissesRapides; while ( i < tableauDesCaisses.length ) { rapide = rapide - 1; Caisse caisse = new Caisse (this, i + 1, rapide == 0); tableauDesCaisses[i] = caisse; if...
21e39004-7927-4384-847d-897409052aa6
7
public boolean isFree(int casePositionX, int casePositionY) { if(casePositionX < 0 || casePositionX >= mapFile.getNbCol() || casePositionY < 0 || casePositionY >= mapFile.getNbLine()) return false; //Si la case dépasse les limites de la fenêtre, alors false else if(mapTab[casePositionY][casePositionX] =...
3ee42de8-8a3f-4e2b-90d4-c8df6f9da3a3
4
private static int getUserOption(BufferedReader br, int min, int max) { int opt; while (true) { try { opt = Integer.parseInt(br.readLine()); if (opt >= min && opt <= max) { break; } else { System.out.prin...
f7611997-a330-40ea-942b-484c9198870f
2
public BEPlaylist getById(int id) throws SQLException { for (BEPlaylist aSong : getAllPlaylists()) { if (aSong.getId() == id) { return aSong; } } return null; }
0c614dda-72af-433e-91ce-6cf191e8b6fe
0
public void setState(State state) { this.state = state; }
3b9e25d1-37e0-4696-802b-2d9cb45fe247
0
public Iterator GetIterator() { return busStop.iterator(); }
68493cda-19d6-42b5-9074-14839481b1cd
0
@Override public String getEmail() { return super.getEmail(); }
30bd01fb-bdcb-4641-9360-32f3f7dc562b
3
protected void processOtherEvent(Sim_event ev) { try { // get the sender ID. // NOTE: Sim_event.get_data() carries a generic object. It might // carries Gridlet, String, etc depending on the sender. // Therefore, be careful when casting th...
c736e33d-076f-4685-9432-1001fa2040b7
8
protected void appExec(int param1) throws Exception { if (param1 != cmdlineArgs.length) { cmdParser.usage(cmdlineArgs, 0, "Excess params="+(cmdlineArgs.length-param1)); return; } long systime_boot = System.currentTimeMillis(); System.out.println(new java.util.Date(systime_boot)+" - NAF BOOTING in "...
a2d17992-a24f-4b67-a9f6-f76554387bbe
6
public void promote( ) { //promotes player2's pieces for( int column = 1 ; column < MAX_COLUMNS ; column += 2 ) { if( board[ 0 ][ column ] != null && board[ 0 ][ column ].toString().equals( Checker.TWO.toString() ) ) { board[ 0 ][ column ] = Checker.TWO_KING; } } //promotes player1's pieces ...
0e191a31-5e65-4329-892c-a99d08e1c25e
4
public Method[] factoryMethods() { Set<Method> methods = new HashSet<Method>(); for (Method m : clazz.getMethods()) { if (Modifier.isPrivate(m.getModifiers())) { continue; } if (!Modifier.isStatic(m.getModifiers())) { continue; } if (m.getReturnType() != clazz) { continue; } metho...
e2a6726d-972f-4302-ac74-36c370006ec4
8
public void process(JCas aJCas) throws AnalysisEngineProcessException { //Annotation's index from JCas pipeline AnnotationIndex<Annotation> an_toks = aJCas.getAnnotationIndex(Token.type); //Iterators for annotations FSIterator<Annotation> iter_toks = an_toks.iterator(); ArrayList<Annotation> tokens = new Arr...
78e24dd7-9c59-41a1-9b39-eda263190814
9
protected void processEntity(IXMLReader reader, IXMLEntityResolver entityResolver) throws Exception { if (! XMLUtil.checkLiteral(reader, "NTITY")) { XMLUtil.skipTag(reader); return; } XMLUtil.skipWhitespace(reader, null); char c...
0e2e27a1-58de-4530-9287-8f749a56e312
2
public boolean isFull() { boolean full = false; for(int index =0; index < seat.length; index++) { if(seat[index] == true) { full = true; } else { full = false; return full; } } return full; }
fb5733cd-c641-4e3f-83b2-e0f4263c5d2b
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
86d0dfe1-8952-4041-bd3e-9d8b8f0f96cb
9
public static Object getValueClass(char ch) { switch (ch) { case '@': return PatternOptionBuilder.OBJECT_VALUE; case ':': return PatternOptionBuilder.STRING_VALUE; case '%': return PatternOptionBuilder.NUMBER_VALUE; ...
1d01ba24-f952-41d1-9b85-04fb76f683d2
9
public void saveFileWithCipher(File file, boolean useCipher, boolean resetOldPass) { try { JAXBContext jc = JAXBContext .newInstance("org.nisshiee.passwordManager.xml"); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); Fil...
ca8e6979-d460-46c3-88fc-97779bb52cb0
4
public TableHelper( final String tableId, final String tableClass, final Object[] headersTopRow, final Object[] headersLeftRow, final Object[][] contents ) { super(); this.headersTopRow = headersTopRow; this.headersLeftRow = headersLeftRow; this.contents = contents; if (this.headersLeftRow != nul...
e6698541-e3c0-4aff-9b30-9a754aaeee83
5
public boolean keyup(KeyEvent ev) { if (focusctl) { if (focused != null) { if (focused.keyup(ev)) return (true); return (false); } else { return (false); } } else { for (Widget wdg = child...
0f680af7-7373-4fef-99ca-ae768a5a97e4
8
@Test public void test() { List<String> myOutput = new LinkedList<String>(); for (String s : input) { String[] parts = s.split("->"); NonTerminalSymbol key = new NonTerminalSymbol(parts[0]); List<List<Symbol>> productionDestination = new ArrayList<List<Symbol>>(); if (parts.length > 1) { for (Strin...
e7bcda6c-b9cf-4495-a357-7711a824b918
9
@Override @SuppressWarnings( "LocalVariableHidesMemberVariable" ) public void execute() throws MojoExecutionException, MojoFailureException { if( skip ) { getLog().info( "artifactinfo-maven-plugin execution is skipped" ); return; } String packa...
c459bd13-4a8b-4424-af1e-fd3a4199d1d1
8
@Override public List<Move> generateMoves(Position from) { List<Move> result = new ArrayList<Move>(); Column column = from.getColumn(); Row row = from.getRow(); Position to; if (!row.isFirst()) { if (!column.isFirst()) { to = Position.get(column.previous(), row.previous()); result....
3c1ba27b-4e93-479e-abbb-8d9e596a6459
3
public boolean conflict(ValueIndexPair in) { return index1 == in.index1 || index1 == in.index2 || index2 == in.index1 || index2 == in.index2; }
cea25817-fa8f-4a58-aed7-fa87de2c839c
3
@Override public void update(LinkedList<GameObject> object) { x += velX; y += velY; if (falling || jumping) { velY += gravity; if (velY > MAX_SPEED) { velY = MAX_SPEED; } } collision(object); }
08dea332-dc01-47b3-b769-8ea15f86d6fb
5
private static Move BackwardRightCaptureForBlack(int r, int c, Board board){ Move backwardRightCapture = null; if(r<Board.rows-2 && c>=2 && ( board.cell[r+1][c-1].equals(CellEntry.white) || board.cell[r+1][c-1].equals(CellEntry.whiteKing) ...
cb90b48a-5c85-4a1f-95a4-42acac3f7867
1
@Override public void mousePressed( MouseEvent e ) { for( MouseListener listener : listeners( MouseListener.class )){ listener.mousePressed( e ); } }
a559131a-06d7-4178-90e7-e61357e13835
5
public void run() { Map<String, Term> solution; Variable X = new Variable("X"); // -------------------------------------------------- Query q2 = new Query("child_of", new Term[] { new Atom("joe"), new Atom("ralf") }); System.err.println("child_of(joe,ralf) is " + (q2.hasSolution() ? "provable" : "not prova...
cf14ad83-e44c-4c7a-9c35-1605f9f2dde9
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(!(affected instanceof MOB)) return true; if((msg.amISource((MOB)affected)) &&((msg.targetMinor()==CMMsg.TYP_LOOK)||(msg.targetMinor()==CMMsg.TYP_EXAMINE)) &&(msg.target()...
2b06c8ce-3eef-4246-b823-6fe5b8e05452
5
private int decodeWhiteCodeWord() { int current; int entry; int bits; int isT; int twoBits; int code = -1; int runLength = 0; boolean isWhite = true; while (isWhite) { current = nextNBits(10); entry = white[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (ent...
33752e4f-e199-4184-a714-29a5b6f08162
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GetFields_Result other = (GetFields_Result) obj; if (!Objects.deepEquals(this.projectIds, other.projectId...
e9e87e5a-379f-48e5-a995-9799f708c61f
3
@Override public boolean equals(Object o) { if (!(o instanceof FieldID)) { return false; } FieldID id = (FieldID) o; return name.equals(id.name) && owner.equals(id.owner) && desc.equals(id.desc); }
18612931-f850-41cf-a504-fab39020ad11
0
public void setBrewButtonStatus(int status) { this.brewButtonStatus = status; }
23623f29-367a-458b-8d95-623aa0ef2314
1
public String toString() { return (this.parent == null ? "" : (this.parent.toString() + " ")) + this.name; }
97acb308-d03a-45a7-a043-187a00ea38ba
9
@Override public Object getValueAt(int indiceLinha, int indiceColuna) { //Verifica o índice da linha e obtém o valor através da posição na lista RegistroNaoConformidadeApontado registroNaoConformidadeApontado = linhas.get(indiceLinha); //Verifica o índice da coluna e obtém o valor ...
9f8c5d94-72e8-41a0-9703-9c425be25b93
4
private void startTimer() { if (timerMode_ == TimerMode.SINGLE) { stopTimer(); } if (timer_ == null) { try { timer_ = new Timer(); int delay = getSetting(Delay).getValue().getInt(); if (timerMode_ == TimerMode.SINGLE) { timer_.schedule(new MyTask(), delay); } else { timer_.sched...
39110aef-3515-4b64-86cc-4bfc11e20a99
9
public void calcCourseResult() { setNumofTotalStudent(0); setNumofSecondGradeStudent(0); setNumofThirdGradeStudent(0); setNumofFourthGradeStudent(0); setNumofMainMajorStudent(0); setNumofMultiMajorStudent(0); setNumofPartMajorStudent(0); setNumofOtherStudent(0); int secondGrade = 0; int thirdGrad...
03b50128-643f-4be6-8d9e-b8812bd25605
7
public static void openURL(String url) { String os = System.getProperty("os.name").toLowerCase(); Runtime rt = Runtime.getRuntime(); try { if (os.indexOf("win") >= 0) { rt.exec("rundll32 url.dll,FileProtocolHandler " + url); } else if (os.indexOf("mac") >= 0) { rt.exec("open " + url); } else if...
3dca28e9-7a68-4df1-8f16-470a7c8d3e6f
9
protected boolean validateParameters(ParameterBlock args, StringBuffer msg) { // The number of parameters supplied. int argNumParams = args.getNumParameters(); if(argNumParams == 0) { // set width to default args.add(paramDefaults...
f1c95bed-5f8d-4e70-8a96-9e3b5aa08fbb
8
public void compExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; // System.out.print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime...
a46a84b3-5ae5-40e8-a39d-0bc711443ecf
3
private static Task getTask(String id) { Task retVal = null; try { XStream xstream = new XStream(new DomDriver()); File remFile = new File((String) Server.prop.get("taskFilePath")); Task[] allTasks = (Task[]) xstream.fromXML(remFile); for (Task task : allTasks) { if (task.getId().equals(id)) { ...
939cc14a-f40d-4fcd-ad63-eeb6445a3833
2
public List<MediaUrlModel> getUrlList() { List<MediaUrlModel> mediaUrlModelList = new ArrayList<MediaUrlModel>(); Statement stmt; ResultSet rs; try { stmt = con.createStatement(); String query = "SELECT * FROM " + TABLE_NAME + ";"; rs = stmt.executeQuery(query); while (rs.next()) { MediaUrlMo...
b021a998-64d3-40f6-b139-97e0afc0bf6d
0
public static void main( String[] args ) throws Exception { System.err.println(urlEncode( "http://it.bestshopping.com/prezzi/Rome.sku=9780751339031|.html" )); }