method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
147f4c9b-aad9-433d-aa67-2743b5500d7d | 2 | private static boolean supportsDnD() { // Static Boolean
if (supportsDnD == null) {
boolean support = false;
try {
Class arbitraryDndClass = Class
.forName("java.awt.dnd.DnDConstants");
support = true;
} // end try
catch (Exception e) {
support = false;
} // end catch
supportsDnD =... |
271970d7-4463-4946-932b-073fd8649449 | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
c28dc3ba-6f0e-4086-94fe-872a1f71b2ea | 6 | public void onEnable() {
instance = this;
Configuration.reloadConfiguration();
dbcore = new DatabaseCore(this);
clisten = new CoreEvents(this);
plisten = new PlayerEvents(this);
elisten = new EntityEvents(this);
getServer().getPluginManager().registerEvents(clisten, this);
getServer().getPluginManager()... |
0948d049-8e48-49d7-ad17-f1ebbaae8f07 | 1 | public List<String> getMedium() {
if (medium == null) {
medium = new ArrayList<String>();
}
return this.medium;
} |
8356407c-ad7c-4c37-ae51-f81238895b20 | 1 | public static ArrayList<Excel> move(int a, int b, int c, ArrayList<Excel> toScale)
{
ArrayList<Excel> result = new ArrayList<Excel>();
double matrix[][] = { {1, 0,0,0},
{0, 1,0,0},
{0, 0,1,0},
{a, b,c,1}
};
Matrix scaleMatrix = new Matrix(4,4);
scaleMatrix.setM... |
e51869db-37db-478f-8b2a-3ccd9ed72ffb | 7 | public void saveReport(){
final Dictation self = this;
if(report == null) { //New report
if(ddlPatient.getSelectedIndex() > 0) {
SwingWorker<Boolean,Void> createWorker = new SwingWorker<Boolean,Void>(){
@Override
protected Boolean doInBackground() throws Exception {
return controller.cr... |
b1531f75-46a1-4b58-b83b-5ca1ce67f0d1 | 5 | public void render()
{
BufferStrategy bs = getBufferStrategy();
if (bs == null)
{
createBufferStrategy(3);
return;
}
if (game != null)
game.render();
if (menu != null)
menu.render(art, this);
for (int y = 0; y < art.getHeight(); y++)
{
for (int x = 0; x < art.getWidth(); x++)
{
... |
949e3d2a-741c-4827-84d2-516e274dfb97 | 3 | protected void fireTreeNodesChanged(Object source, Object[] path,
int[] childIndices, Object[] children) {
// Guaranteed to return a non-null array
Object[] listeners = this.listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested ... |
a9670f72-9692-4475-b9eb-7e26c4ea2cd9 | 7 | public void removeKey(String var) {
Boolean changed = false;
if (this.props.containsKey(var)) {
this.props.remove(var);
changed = true;
}
// Use an iterator to prevent ConcurrentModification exceptions
Iterator<String> it = this.lines.listIterator();
... |
9b51249b-885f-4137-8258-79f251264037 | 2 | private <E extends AnnotatedElement> AnnotatedHandlerBuilder<E> handleElement( final Class<E> annotatedElementType )
{
return new AnnotatedHandlerBuilder<E>()
{
public <A extends Annotation> LinkedHandlingBuilder<E, A> annotatedWith( final Class<A> annotationType )
{
... |
89a6a847-7cc0-4ac8-a712-262e8474cf3e | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidadElementos()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
cb31f99a-d14d-47cb-86e1-796153343f5b | 7 | private boolean testFilterProperty_Size(SpecialFile other) {
String byteType = this.filter.getMetricSize();
BigInteger sourceSize = new BigInteger(String.valueOf(this.SIZE));
BigInteger targetSize = new BigInteger(String.valueOf(other.SIZE));
String num = "";
switch (byteType) {
default:
case "BYTE":
n... |
99122ca1-e267-46bf-9930-d4d9e78522d5 | 4 | private boolean init() {
for (Object i : graph.getEdgeMap().values()) {
Integer integer = (Integer) i;
// wenn es nagative Werte gibt, gib eine Warnung aus
if (Math.abs(integer) != integer) {
JOptionPane.showMessageDialog(null,
"Dijkstra kann auf diesen Graph nicht angewendet ... |
b2149a8e-3fad-43bb-9c66-b9cda0150e2a | 6 | private Zone checkActiveZone(Point eventLocation)
{
//Zone that event location is currently being checked against
Zone currentZone = null;
//Concise form of the event location
int x = eventLocation.x;
int y = eventLocation.y;
//Flag which is set if event is found to be within a zone
Boolean withinZone ... |
d6cc4d75-698b-4c4e-bfd1-e174ffc6efb6 | 5 | private void putComment (Graphics2D g2d, String t, int i) {
Integer fWidth = MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (i).getFieldWidth();
Font font = MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (i).getPrintFont();
Integer fontSize = font.getSize();
Integer ... |
e94ca38a-de8a-4245-b695-b5c73fda06b9 | 2 | public boolean opEquals(Operator o) {
if (o instanceof ConstOperator) {
Object otherValue = ((ConstOperator) o).value;
return value == null ? otherValue == null : value
.equals(otherValue);
}
return false;
} |
898114a2-a1c3-4b09-b24c-6c82b93c2f31 | 4 | public static Configuration getLauncherConfiguration()
{
final Configuration config = new Configuration();
// Load JavaConfig class.
try
{
Class<?> clazz = configClass;
if (clazz == null)
{
clazz = Configuration.class.getCl... |
3aa1a0c8-7a31-4dbd-91b3-f1caeaaf768d | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String forwardTo = "";
String message = "";
String action = request.getParameter("action");
HttpSession session = request.getSession();
if... |
1b37aaa4-397f-4d6d-b34a-f7f2754c0221 | 6 | public static boolean visibleFromP(Context viewedcontext, Context fromcontext) {
{ boolean testValue000 = false;
if (viewedcontext == fromcontext) {
testValue000 = true;
}
else {
if (fromcontext.allSuperContexts.membP(viewedcontext)) {
testValue000 = true;
}
... |
f9ab7d74-b1bf-421f-9a7c-a80b0098ee5c | 2 | public void start()
{
if(!Run)
{
this.StartTimeStamp = System.currentTimeMillis();
this.Run = true;
}
else
{
try {
throw new Exception("the stopwatch are running");
} catch (Exception e) {
e.prin... |
de74645b-23b1-4ee4-837c-53bd65419f32 | 1 | public void start()
{
if (timerOn)
timer.startTimer();
} |
3268e485-2ff4-4c29-818f-b56d72791fc4 | 4 | public void writeHistory(DataOutput output) {
try {
output.writeInt(VERSION);
int stringCount = stringCombo.getItemCount();
Vector strings = new Vector();
for (int i = 0; i < stringCount; ++i) {
String next= (String) stringCombo.getItemAt(i);
... |
4fec36e2-9783-4aac-860e-42df13ce08c5 | 8 | @Override
public void process(Object[] input) {
this.mowers=new ArrayList<Mower>();
if(this.readFile((String)input[1])&&lawn!=null&&mowers!=null&&mowers.size()>0)
{
for(Mower m:mowers)
{
lawn.addMower(m);
}
lawn.startMowers();
for(Mower m:lawn.getMowers())
{
System.out.print(m... |
e6792f9b-52a9-499d-bcb0-ef1682951fb6 | 2 | private void jButton1ActionPerformed() {
if(Desktop.isDesktopSupported()){
try {
Desktop.getDesktop().browse(new URI("http://www.twitch.tv/" + TwitchStream.getStreamID(jList1.getModel().getElementAt(jList1.getSelectedIndex()).toString().replace(" (ONLINE)", ""))));
} catc... |
1c5e413b-7686-4328-9fbf-6d7c9907008b | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
//out.println("<html><body>");
// Retrieving Data from the Ajax Post ... |
591904e6-3153-4e0f-a205-e97cdb470d05 | 2 | public OtpErlangTuple receiveMessage() {
System.out.println("Controller:receiveMessage() is working");
try {
OtpErlangObject erlangObject = mbox.receive();
msg = (OtpErlangTuple) erlangObject;
System.out.println(msg);
// if (erlangObject != null ){
// ... |
a2ac46a4-d808-4442-a2e1-8af56fd0e1a5 | 7 | public void cleanNotChangedToDama(){
boolean ctd = false;
//Controllo se c'è una mossa che mi fa vincere
for(int i=0;i<desmosse.length;i++)
if(desmosse[i]!=null)
if(desmosse[i].isChangedToDama()){
ctd = true;
break;
}
System.out.println("Variabile che controlla se ci sono mossa ch... |
b2881c31-6862-4c93-911a-92ebc4c0be42 | 5 | public ArrayList<CharImage> extractCharImages(BufferedImage source){
//labeling image to this.labeledImage
labeling(source);
int width = labeledImage[0].length;
int height = labeledImage.length;
HashMap<Integer,CharRange> map = new HashMap<Integer,CharRange>();
ArrayList<CharImage> result = n... |
0872dae6-d87d-4bb2-92b8-192cf6f2224e | 7 | private boolean ctrlFields() {
if (ztAdresse.getText().isEmpty() ||
ztNom.getText().isEmpty() ||
ztPrenom.getText().isEmpty() ||
ztNumeroNational.getText().isEmpty() ||
ztTel.getText().isEmpty() ||
dpDateNaissance.getDate() == null ... |
0c131812-fbc0-49e7-a3b0-00875a5b543e | 3 | private String getUsers(String data) throws Exception{
users = null;
users = new ArrayList<String>();
String userlist = "";
String begin = "<!--unameb-->";
String end = "<!--unamee-->";
String _tmp = data;
while (_tmp.indexOf(begin) != -1) {
int i = _tmp.indexOf(begin)+begin.length();
int k = _tm... |
0fe052e0-46db-428c-9d8c-6e10f13e7b7c | 0 | public String getSessionId() {
return sessionId;
} |
84744861-a896-45e8-bb0b-37aecc037574 | 6 | public static void main(String[] args) {
// Testing FileSet factory
FileSet aFileSet, bFileSet, cFileSet;
String testFile = "C:\\temp\\SerializedFileSet.sfs";
String testDirectory = "S:\\";
aFileSet = null;
bFileSet = null;
if(args.length < 2){
System.out.println("Please, specify valid parameters."... |
a4b36aaf-d1ec-4ca1-8adc-14f17f13b59c | 4 | private void initSimplexe(Matrice ciDansB, Matrice iDansB)
{
int colN = 0;
int colB = 0;
int nbN = 0;
for(int i = 0; i<this.X.getNbColumns(); i++)
{
if(this.X.getValueAt(0, i) == 0)
{
nbN++;
}
}
... |
a22fed12-1fa4-4bf4-ab24-be72a1b09dd9 | 8 | public void paintComponent(Graphics canvas)
{
canvas.setColor(Color.WHITE);
//Make sure the outside of the board is white.
canvas.fillRect(0, 0, this.cols * X_DIM + 2*X_OFFSET, this.rows * Y_DIM + 2*Y_OFFSET);
/*Placing the squares on the board*/
for(int i=0; i<this.rows; i++) {
for(int j=0;... |
54eae530-451f-4a24-ac2f-76113aa3ef15 | 0 | public String getBookChapter(int book, int chapter) {
String strBook = String.format("B%02d", book);
String strChapter = String.format("C%03d", chapter);
return strBook + strChapter;
} |
5d62f4af-bdb8-4fc1-8783-bdf12feee68c | 3 | public List<TaxaNode[]> completeHierarchyPerTaxon(){
List<TaxaNode[]> completeHierarchy = new ArrayList<TaxaNode[]>();
TaxaNode t = null;
TaxaNode[] th = null;
for(String key: this.nodeList.keySet()){
t = this.nodeList.get(key);
if(TaxonRank.SPECIES == t.getTaxonRank() ||
Taxon... |
dc149953-72a1-4584-a482-6001af419fd8 | 4 | private JPanel getPanSaisieCle() {
if (panSaisieCle == null) {
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
gridBagConstraints8.gridx = 4;
gridBagConstraints8.gridy = 6;
GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
gridBagConstraints61.gridx = 5;
gridBagC... |
e2a78e98-a4a6-4b41-8736-a1cb2bd8eb0b | 5 | public void imprimirRelatorioSQLNoRelatorio(Map parametros, String diretorio) {
Connection conn = null;
try {
// Carrega conexão via JDBC
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/smdados", "root", "mutkch"... |
e6dc4f99-0f9e-4662-8a3c-fe7041328d7a | 4 | public void loadServers(Bot bot, ResultSet rs) {
// If something goes wrong...
if (rs == null) {
logMessage(LOGLEVEL_CRITICAL, "Unable to load servers from MySQL!");
return;
}
// Go through each server and initialize them accordingly
int database_id = -1;
try {
Server server;
while (rs.next()) ... |
ff4999ad-07d4-48ca-9537-13723d360b7b | 2 | @Override
public Set<String> getUserNames() {
Set<String> users = new HashSet<String>();
PreparedStatement pStmt = null;
ResultSet rs = null;
try {
pStmt = conn.prepareStatement("SELECT * FROM USER ORDER BY surname;");
rs = pStmt.executeQuery();
while (rs.next()) {
users.add(rs.ge... |
f82b2ac3-6489-4616-9d7b-7ef73d2a8f85 | 9 | @Override
public Scalar getScalar(String key) {
if ("%localData".equals(key)) {
return SleepUtils.getHashWrapper(data);
}
Scalar temp = (Scalar) data.get(key);
if (temp == null && parmsValue != null && (Character.isDigit(key.charAt(1)) || key.charAt(1) == '-')) {
StringParser parser;
int begin, end;... |
11402f99-2e8a-4678-bfdc-15f5d07230ac | 0 | public DatatypeProperty getDatatypeProperty(OntModel model) {
return model.createDatatypeProperty(getUri());
} |
f95cb046-a49d-4039-adb2-42aa9325bf48 | 6 | public void init()
{
boolean debug = CommandLine.booleanVariable("debug");
if (debug)
{
// Enable debug logging
Logger logger = Logger.getLogger("com.reuters.rfa");
logger.setLevel(Level.FINE);
Handler[] handlers = logger.getHandlers();
... |
8a86daa7-842e-4f14-aeb1-a3489cb8515b | 8 | static WeiboMessage parseInfo(Node infoNode) throws UnsupportedEncodingException {
WeiboMessage msg = new WeiboMessage();
Span spanNode = (Span) Util.getFirstChildByTagName(infoNode, "span");
SimpleNodeIterator aNodeIter = Util.getChildrenByTagName(spanNode, "a")
.elements();
while (aNodeIter.hasMoreNodes(... |
06328940-d05b-4dcd-a340-af9a7d7d6978 | 1 | public CachedRowSetImpl getRanking(){
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String getRanking = "SELECT jnick AS Jamertag, Level,... |
16bb5f27-e414-45c0-9e3d-1a086e8bda49 | 0 | private boolean isValidInput(final String s) {
return s.matches("[0-9]{4}[-][0-9]{1,2}");
} |
15e4092e-fc76-4a65-bdb4-817a55c22248 | 9 | public static ArrayList<User> getAllUsers() {
String url = "jdbc:mysql://localhost:3306/ouaamou_com";
String username = "root";
String password = "";
try {
Class.forName("com.mysql.jdbc.Driver");
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
ArrayList<User> users = new Arra... |
9ce86b92-90db-4987-8cc1-a58cb4d29cb4 | 3 | public static String compileToHSAIL(String openCLSource, String baseName, String batchScript) {
// return compileToHSAILJNI(openCLSource);
try {
final String oclFileName = baseName + ".ocl";
final String binFileName = baseName + ".bin";
final String hsailFileName = ba... |
2627f3b9-3fcf-4854-b312-45ba82de0558 | 2 | public MCQ getModel(int Question_ID) {
MCQ mcquestion = new MCQ();
try {
StringBuffer sql = new StringBuffer("");
sql.append("SELECT Question_ID,QType_ID,Question_Text");
sql.append(" FROM `MCQ`");
sql.append(" where Question_ID=" + Question_ID);
... |
a6ddd33a-11b9-46a4-bd3a-cc87a8a8a298 | 9 | @Override
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String view = "/WEB-INF/view/receiver/";
ReceiverCommand rcommand = null;
if (request.getParameter... |
ec3788ad-db36-45a8-8700-9fe912be12b1 | 3 | @SuppressWarnings("unchecked")
private static ArrayList<String> getCategoryCodes(
HashMap<String, Object> map) {
ArrayList<String> list = new ArrayList<String>();
Map<String, Object> attrs = (Map<String, Object>) map.get("attributes");
for (Object m : (ArrayList<Object>) attrs.get("subjects")) {
String nam... |
29bb51a3-3db3-492b-871a-eb66e81e3d86 | 2 | public static long task3(long x) {
long a = 2;
while (x > 1) {
if ((x % a) == 0) {
x = x / a;
} else {
a++;
}
}
return a;
} |
3da1ce22-8634-43a0-91c1-841cbbd1a451 | 0 | public LRParseController(LRParsePane pane) {
this.pane = pane;
productions = pane.grammar.getProductions();
} |
da63f699-3662-44e4-9a5c-1237fbb6d830 | 8 | public void TelnetRead(StringBuffer buf, InputStream rawin, BufferedReader in[]) throws InterruptedIOException, IOException
{
final char c = (char) in[0].read();
if (mccppattern[patDex] == c)
{
patDex++;
if ((patDex >= mccppattern.length) && (!neverSupportMCCP))
{
while (rawin.available() > 0)
... |
ddf18810-c315-4952-80d4-7534002b7db1 | 9 | private void createDocumentNodes(List listNodes, CleanTimeValues cleanTimeValues) {
Iterator it = listNodes.iterator();
while (it.hasNext()) {
Object child = it.next();
if (child == null) {
continue;
}
boolean toAdd = true;
if (child instanceo... |
604aa0d6-9594-4f61-91b8-60fc9b5b0d88 | 2 | @Override
public void terminateSimulation(Host... network) {
logger_.debug("Hello");
for (Host host : network) {
logger_.debug("Trying to get a handle to {}:{}", host, host.getPort());
try {
SimulationHandle simulationHandle = getRemoteHandle(host);
... |
2a2245b7-3e95-4ec4-acf4-4bf72fcb706d | 8 | public void removeComponent(Component component)
{
if(component instanceof InteractableContainer) {
InteractableContainer container = (InteractableContainer)component;
if(container.hasInteractable(currentlyInFocus)) {
Interactable original = currentlyInFocus;
... |
4f4c81a7-8e4f-4767-8db1-d34ff869791c | 2 | public static Move TakeUserInput(int r1, int c1){
// Display the game board
Game.board.Display();
PrintSeparator('-');
// Ask for user input
System.out.println("Enter your Move.");
System.out.println("Piece To Move:");
System.ou... |
b567a71f-9363-4f32-8e35-69c4b20f5a47 | 0 | public void write(String symbol) {
buffer.deleteCharAt(tapeHead);
buffer.insert(tapeHead, symbol);
cachedHash = 0xdeadbeef;
} |
3db6f896-b0f8-4fb8-8a3f-24b2a34356ee | 3 | @Override
public boolean canImport(JComponent comp, DataFlavor[] flavors)
{
for (int i = 0; i < flavors.length; i++)
{
if (flavors[i] != null
&& flavors[i].equals(mxGraphTransferable.dataFlavor))
{
return true;
}
}
return false;
} |
b425f2c2-2ca2-4b36-bc86-7df6f7a19d35 | 7 | public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)pa... |
e57cc3da-830a-466f-88cc-4c325037e691 | 9 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (averageGroundLevel < 0)
{
averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (averageGroundLevel < 0)
{
... |
f8c8e9e2-c807-4b9b-b4ed-5acfb87c7dd2 | 8 | public void clear(){
for(int i=0;i<modes;i++){ mode_param[i]=null; }
mode_param=null;
for(int i=0;i<maps;i++){ // unpack does the range checking
FuncMapping.mapping_P[map_type[i]].free_info(map_param[i]);
}
map_param=null;
for(int i=0;i<times;i++){ // unpack does the range checking
... |
79be4774-155d-4da0-8385-c5603160965a | 9 | @Override
public void characters(char[] ch, int start, int length) throws SAXException
{
if (ch != null)
{
String s = new String(ch, start, length).trim();
if (product == null || s.length() < 1)
{
return;
}
else
{
if (qName.equalsIgnoreCase(ProductsConstants.PROVIDER.getContent()))
... |
10f53d42-6a2d-4831-956a-5803bab4e8f1 | 9 | public void testClear() {
ByteArrayBuilder builder = new ByteArrayBuilder();
byte[] testdata = new byte[1024];
for(int i=0;i<testdata.length;i++) {
testdata[i] = (byte)i;
}
builder.clear();
for(int i=0;i<testdata.length;i++) {
assertEquals(i, builder.length());
builder.append(testdata[i]);
// c... |
f1451065-93c7-4e44-abf1-4eccbcb46e25 | 4 | private void mapEdge(){
if(Base.render.yOffset < 0) Base.render.yOffset += mapMovementSpeed;
if(Base.render.yOffset > (Base.level.height * 32) - Base.height) Base.render.yOffset -= mapMovementSpeed;
if(Base.render.xOffset < 0) Base.render.xOffset += mapMovementSpeed;
if(Base.render.xOffset > (Base.level.width *... |
fe6548a5-fac7-4e0c-842b-d9cdf5803a40 | 7 | public String get(String keyValue, Object ... args)
{
String message = super.getMessage(keyValue, args, locale);
if(inCharset != null && outCharset != null) {
try {
message = new String(message.getBytes(inCharset), outCharset);
}
catch(UnsupportedEncodingException e) {
e.printStackTrace();
}... |
af5fd934-9485-47b4-8927-c58bcddbc0b6 | 5 | private int getY(Dimensions dim){
Face direction = surface.roomView.playerDirection;
if (direction == Face.EASTERN){
if (ceiling){
return dim.getX();
}
return 100 - dim.getX();
}
if (direction == Face.SOUTHERN){
return 100 - dim.getY();
}
if (direction == Face.WESTERN){
if (ceiling){
... |
97d384d8-0fe4-438f-9268-56d90a859480 | 6 | public boolean isActive(Component c) {
boolean active = true;
if (c instanceof JDialog) {
JDialog dlg = (JDialog) c;
if (dlg.getParent() instanceof JComponent) {
return JTattooUtilities.isActive((JComponent) (dlg.getParent()));
... |
aa0ccbf7-ec98-4ac3-87e9-6f62644ef23f | 7 | public void newPiece(double percent) {
Block piece = Block.EMPTY;
if (percent < .14)
piece = Block.TALL;
else if (percent < .28)
piece = Block.ELL;
else if (percent < .42)
piece = Block.BACKELL;
else if (percent < .56)
piece = Block.HORN;
else if (percent < .70)
piece = Block.EGYPT;
e... |
b2b4f106-519a-4724-bd22-b89fba777f45 | 0 | @Override
public int compareTo(TVC o) {
return intencity.compareTo(o.intencity);
} |
945831b1-a9b9-40a7-b782-832a098e25d0 | 2 | protected void processMouseEvent(MouseEvent e) {
if (e.getID() == e.MOUSE_PRESSED) {
if (hasFocus()) {
int code = InputManager.getMouseButtonCode(e);
mapGameAction(code, true);
}
else {
requestFocus();
}
... |
215caba3-32e5-42d1-96d7-ab224bca9cae | 3 | edge depthFirstTraverse( edge e )
{
edge f;
if ( e == null )
{
f = this.root.leftEdge;
if ( f != null )
f = f.findBottomLeft();
//this is the first edge of this search pattern
return f;
}
else //e is non-null
{
if ( e.tail.leftEdge == e )
// if e is a left-oriented edge, we ski... |
af21a27e-f181-4662-9155-eea78e91ef3c | 8 | void load(){
theoriesSplittedsRead = original.split("END");
for(int i=0;i<theoriesSplittedsRead.length;i++)
if(theoriesSplittedsRead[i].contains("THEORY ProofList IS"))
proofListRead = theoriesSplittedsRead[i];
for(int i=0;i<theoriesSplittedsRead.length;i++)
if(theoriesSplittedsRead[i].contains("... |
b871e7a3-da92-48be-8baf-7fd34b064591 | 6 | public void mutate(int probabilty, int mutationSize) {
Random randGen = new Random();
int test = randGen.nextInt(100);
if(test > probabilty)
return;
//mutation
if(bins.size() < mutationSize){
for(int i = 0; i < bins.size(); i++){
List<Element> items = bins.get(i).getAll();
for(int... |
0a1c9097-c53d-41df-b2b0-5354e86874b0 | 4 | public ImageIcon saveImg(String imgUrl, String fileName, boolean returnImage) {
System.out.println("Save to file " + fileName + " from " + imgUrl);
try {
URL url = new URL(imgUrl);
BufferedImage originalBufImg = ImageIO.read(url);
BufferedImage resizedBufImg = null;
if(originalBufImg.get... |
d00ad401-6478-4005-a8d7-01274389840f | 8 | public static Vector<Vector<Move>> expandMoves(Board board, Player player){
Vector<Vector<Move>> outerVector = new Vector<Vector<Move>>();
if(player == Player.black){
Vector<Move> moves = null;
moves = Black.CalculateAllForcedMovesForBlack(board... |
17bc79ce-fc9a-42de-8132-e97be19dbc6d | 9 | synchronized void resizeMap(int x, int y)
{
int i,
i2,
X,
Y;
short newMap[][][]= new short[MapLayers][x][y];
X = MapColumns;
if (x < MapColumns)
{
X = x;
}
Y = MapRows;
if (y < MapRows)
{
Y = y;
}
for (i=0;i<X;i++)
{
for (i2=0;i2<Y;i2++)
{
try
{
newMap[i][i2] =... |
4754ac4b-923c-4fd9-919b-174be8618fff | 8 | private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
if(con==null){
JOptionPane.showMessageDialog(null, "Could not connect to the database! Please check connection and then retry.", "Communication Failure", JOptionPane.ERROR_MESSAGE);
... |
e39335c8-829e-40c0-afdc-715f997a38f5 | 7 | @SuppressWarnings("RedundantIfStatement")
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pair pair = (Pair) o;
if (first != null ? !first.equals(pair.first) : pair.first != null) return false;
... |
ba59e4d2-566c-4da7-a59c-75b855fb947e | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
ID3v2UrlFrameData other = (ID3v2UrlFrameData) obj;
if (description == null) {
if (other.description != null)
return false;
} else... |
ab47a7b3-c1d8-442f-a19d-c922795552ba | 3 | public Component getTableCellRendererComponent(JTable table,
Object value, boolean isSelected, boolean hasFocus, int row,
int column) {
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
if (column == 4) {
setIcon(new ImageIcon(scaleAmmoImage));
setPreferredSize(new Dimension(30, 30));
... |
38be9924-c0d4-47d6-8cc6-15d793fc9511 | 5 | private static VirusStats[] getVirusStats() {
TreeMap<Integer, LinkedList<Virus>> invert = new TreeMap<Integer, LinkedList<Virus>>();
TreeMap<Virus, Integer> virusCounts = getVirusCounts();
// Invert the map
for (Entry<Virus, Integer> entry : virusCounts.entrySet()) {
int count = entry.getValue();
Virus v... |
d5fdd1f0-dd98-4bb2-9b7a-845d5475f1df | 6 | public void assign(Entry entry) {
ColonyTile colonyTile = null;
Building building = null;
if (entry.getWorkLocation() instanceof ColonyTile) {
colonyTile = (ColonyTile) entry.getWorkLocation();
colonyTiles.remove(colonyTile);
} else if (entry.getWorkLocation() ins... |
3a587ac9-5825-4f25-aa72-b26756fd03a9 | 9 | public boolean isSvek() {
boolean defaultValue = false;
// if (OptionFlags.SVEK && type == UmlDiagramType.CLASS) {
// defaultValue = true;
// }
if (type == UmlDiagramType.CLASS) {
defaultValue = true;
}
if (type == UmlDiagramType.OBJECT) {
defaultValue = true;
}
if (type == UmlDiagramType.USECASE)... |
2a3400dd-b4b1-456e-a91b-df3649a8cd39 | 9 | private boolean generateRoom(int x, int y, Direction direction)
{
int roomWidth = Main.rand.nextInt(ROOM_MAX_SIZE - ROOM_MIN_SIZE) + ROOM_MIN_SIZE;
int roomHeight = Main.rand.nextInt(ROOM_MAX_SIZE - ROOM_MIN_SIZE) + ROOM_MIN_SIZE;
int x1, x2, y1, y2;
if (direction == Directi... |
e8dfe0c1-eaaa-4177-ad0b-664c9e61e1ae | 2 | public static boolean isCorporationID(int id) {
try {
InputSource data;
String notCorp = "{\"info\":null,\"characters\":[]}";
data = Download
.getFromHTTP("http://evewho.com/api.php?type=corplist&id="
+ id);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(data.... |
b8891f02-2663-45b7-bdd5-8ed62ad675cf | 5 | public static Graph initialize(DynamicArray<String> matrix) {
Graph g = new Graph();
String[][] adjacencyMatrix = parseStringArray(matrix);
Vertex[] vertices = new Vertex[matrix.getSize()];
for (int i = 0; i < vertices.length; i++) {
vertices[i] = new Vertex(i);
g... |
9d4bf282-44b2-4131-8751-5a51c47f3848 | 7 | public boolean Salvar(Pessoa obj) {
if (obj.getCodigo() == 0) {
try {
PreparedStatement sql = getConexao().prepareStatement("insert into pessoa(Nome,DataNascimento) values(?,?)");
sql.setString(1, obj.getNome());
sql.setDate(2, new java.sql.Date(obj.ge... |
f6317e93-d0c7-4b5c-9939-20307f01e94e | 8 | public void search(ListView<String> list, String word) {
//now to find them!
list.getItems().clear();
for (JournalEntry entry : journal.getEntries()) {
//look thru topics first...
boolean found = false;
for (String topic : entry.getTopic()) {
i... |
01f06083-b8df-4838-bcfe-76805e4747b6 | 0 | public int getNum()
{
return num;
} |
a1135e37-fb21-4b7c-bc90-f9bfdc5eba56 | 2 | private String createProtectedLines() {
StringBuilder sb = new StringBuilder();
List<String> lines = getProtectedLines( fileName );
if ( !lines.isEmpty() ) {
for ( String line : lines ) {
sb.append( line );
}
}
else {
sb.append... |
265ebd11-c8be-48c1-8d80-39ed3cd6aacc | 0 | public DeviceType getDeviceType() {
return deviceType;
} |
3bd08e9a-8a6e-46ed-b89d-4882046fea60 | 7 | public String toString() {
return ((this.day == 0 ? "Mon " : (this.day == 1 ? "Tue " : (this.day == 2 ? "Wed " : (this.day == 3 ? "Thu " : (this.day == 4 ? "Fri " : (this.day == 5 ? "Sat " : (this.day == 6 ? "Sun " : "Unknown " + this.day + " "))))))) + (int)this.hour + "h" + (int)this.min + "m");
} |
b4b50d1a-60bc-406f-80c1-73b37e6ec428 | 8 | public static String[] verifyTimeArguments(String[] args) throws Exception {
if (null == args || args.length != 3) throw new IncorrectNoOfArgumentsException(3);
String[] t = new String[3];
int hour = Integer.parseInt(args[0]);
int min = Integer.parseInt(args[1]);
int ms = Integer.parseInt(args[2]);
if (ho... |
e8ae38c9-55a0-47e0-9f4e-b775e6d62858 | 7 | public int compareTo(Object o)
{
int row1 = modelIndex;
int row2 = ((Row)o).modelIndex;
for (Iterator<Directive> it = sortingColumns.iterator(); it.hasNext();)
{
Directive directive = (Directive)it.next();
int column = directive.co... |
d325731d-16ba-4ffe-b1d0-6739106d37c9 | 2 | public void setAllAccessible(boolean b){
for(int x = 0; x< IConfig.LARGEUR_CARTE;x++ ){
for(int y = 0; y< IConfig.HAUTEUR_CARTE;y++ ){
this.mapGraph[x][y].setMarkedAccessible(b);
}
}
} |
ffddfc64-3c22-4344-953b-08f8895dfc94 | 7 | public void mouseMoved(MouseEvent e) {
MouseX = e.getX();
MouseY = e.getY();
if (state == 2)
{
int x = 50 * winZoom, y = 25 * winZoom, num = 0;
while (num < var.NUM_ELS) {
if (MouseX > x && MouseY > y && MouseX < x + (40*winZoom) && MouseY < y + (4... |
a2496bd3-7a81-47ab-a0e2-6702529b7d9e | 6 | @Override
protected Object registeringGUI() {
long idProd, idBuyer, idSeller;
while(true){
try{
idProd = Long.parseLong(guiImpl.requestData("Código do produto:"));
break;
}catch(NumberFormatException e){
GUIAbsTemplate.operation... |
6c3906c4-a903-40d5-867e-315ef52c1e0f | 9 | private void persist(String cubeIdentifier) throws PersistErrorException,
PageFullException, IOException, SchemaNotExistsException,
CubeNotExistsException {
SchemaClientInterface schemaClient = SchemaClient.getSchemaClient();
Schema schema = schemaClient.getSchema(cubeIdentifier... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.