method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f6e2f653-a899-4dc2-b77d-b811f6cb73ff | 6 | public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout();
} ... |
c1301e67-23ed-4559-9ab5-5b0da48cbec4 | 1 | public static List<TableColumnDesc> getColumns(String sql) throws SQLException{
List<TableColumnDesc> result = new ArrayList<TableColumnDesc>();
Statement stt = con.createStatement();
ResultSet rs = stt.executeQuery(sql);
while (rs.next()) {
TableColumnDesc tcd = new TableColumnDesc();
tcd.setField(rs.ge... |
e8184b60-2214-4d41-ab65-d44aebb9b486 | 3 | public void cambiarPosicionJugado2(){
for(int x=0;x<8;x++){
for(int y=0;y<8;y++){
if(pd.mapa_jugador2[x][y].equals(codigo))
pd.mapa_jugador2[x][y]="";
}
}
int x=rd.nextInt(0)+7;
int y=rd.nextInt(0)+7;
cam... |
a8b4d9ed-a56d-4d94-8db3-c0e959f27688 | 3 | protected String getBoxDescription(Box box)
{
if (box.getType() == Type.TEXT_CONTENT)
return box.getText();
else
{
final String cls = box.getAttribute("class");
final String id = box.getAttribute("id");
StringBuilder ret = new StringBuilder("<"... |
9b6b5c80-826f-4b20-b8d7-6ff76c4693dd | 8 | void removeInternal(Node<K, V> node, boolean unlink) {
if (unlink) {
node.prev.next = node.next;
node.next.prev = node.prev;
}
Node<K, V> left = node.left;
Node<K, V> right = node.right;
Node<K, V> originalParent = node.parent;
if (left != null && right != null) {
/*
*... |
87fd9b0c-fdc6-49a3-afbb-1ea302c2a649 | 1 | public boolean addToKit(T elem){
if(kit.add(elem))
return true;
else
return false;
} |
01178cb3-5a1f-4b31-b77e-076634442c67 | 2 | @Override
public int compare(Chromosome o1, Chromosome o2) {
if(o1.getFitness() > o2.getFitness())
return -1;
if(o1.getFitness() < o2.getFitness())
return 1;
return 0;
} |
004cfe0d-e440-4199-8b1a-7d756f047589 | 6 | public void out(String level, String msg) {
// The messages level
int severity = 0;
// Send passed value to upper case
String compare = level.toUpperCase();
// Set log level to passed parameters (if it can be mapped)
if (compare.startsWith("INFO")) {
// All messages
severity = 4;
} else if (compare... |
b167e3ff-312b-4902-afe1-7e30420f3bc9 | 1 | public boolean isZeroVector(){
return x == 0 && y == 0;
} |
5ebc3d50-3c1e-4ba6-8b70-af3457ffcf97 | 5 | public void analyse() {
LexicalAnalyser lexicalAnalyser = CommandAnalyseFactory
.createLexicalAnalyser(this.sentence);
try {
lexicalAnalyser.analyse();
} catch (AnalyseException e) {
}
if (!lexicalAnalyser.isComplete()) {
this.errors = lexicalAnalyser.getErrorMsg();
return;
}
SyntaxAnalyser s... |
5207b3db-2f59-4c80-a272-d5691961cfda | 8 | public double getPerformance(int evaluation) {
double result;
result = Double.NaN;
switch (evaluation) {
case EVALUATION_CC:
result = m_CC;
break;
case EVALUATION_RMSE:
result = m_RMSE;
break;
case EVALUATION_RRSE:
result = m_RRSE;
break;
case EVALUATION_MAE:
res... |
2eecd670-1cec-4e5a-a581-3201f56a661d | 3 | @Override
public void update(Match obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("update Matches set equipeA=?, equipeB=?, scoreA=?, scoreB=?, datematch=? where id=? ;");
pst.setString(1, obj.getEquipeA());
pst.setString(2, obj.g... |
24a5230b-5b1c-4dd3-80c1-c4e5bf981553 | 8 | private boolean readFeed()
{
try
{
// Set header values intial to the empty string
String title = "";
String link = "";
// First create a new XMLInputFactory
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
// Setup... |
a93df292-22f0-4397-af72-8c4989e571a1 | 5 | @Override
public void tick(double dt) {
this.dt = dt;
super.move(dt);
gravitate();
if (x > GameState.getInstance().getWidth() + 100 || x < -100 || y > GameState.getInstance().getHeight() + 100 || y < -1000)
remove();
handleIntersects();
applyFriction();
liveTime += dt;
if (liveTime >= explosionTime... |
5a8cf9ab-943f-4344-8447-734fe457cb54 | 2 | public static void prePlay(String charType, Scanner scan, Random gen) { //Parameters: Character type, Scanner and a random number generator
if (charType == "Mage") {
Mage player = new Mage();
play(scan, player, gen, "Mage");
}
else if (charType == "Necromancer") {
Necromancer player = new Necro... |
445d6f86-03f3-4e97-8cc9-fa90fa53a7c1 | 2 | public void run()
{
while ( true )
{
try {
Socket newClient = sock.accept();
handler.handleNewConnection(newClient);
} catch (IOException e) {
System.exit(0);
return;
}
}
} |
cfaacf36-75cd-4e5f-8460-0465031788fa | 0 | public String getMessage() {
return this.message;
} |
f44c3542-8eed-4f99-bbee-59e6adc7d2e5 | 8 | public static void main(String[] args) {
Scanner dado = new Scanner(System.in);
Agencia a = new Agencia();
int numero;
String proprietario;
float valor;
boolean opcao = false;
while (!opcao) {
try {
menu();
int operacao... |
c0bd4d55-9f71-4db6-a990-269218ef19af | 7 | public void update() {
int xChange = 0, yChange = 0;
if (anim < 7500) anim++;
else anim = 0;
if (input.up) yChange--;
if (input.down) yChange++;
if (input.left) xChange--;
if (input.right) xChange++;
if (xChange != 0 || yChange != 0) {
move (xChange, yChange);
moving = true;
} else {
... |
aef4c288-3477-4080-8d65-c9995970fa96 | 3 | public synchronized void start(int... ports) {
if (ports != null && ports.length > 3) {
// TODO set ports
gameSocketServerPort = ports[0];
chatSocketServerPort = ports[1];
managerSocketServerPort = ports[2];
}
if (!listening) {
listening = true;
(new Thread(this)).start();
}
} |
766bef53-6e44-4ccc-9ed3-62365b376b23 | 1 | public void updateUniforms(Matrix4f worldMatrix, Matrix4f projectedMatrix,
Material material) {
if (material.getTexture() != null)
material.getTexture().bind();
else
RenderUtil.unbindTextures();
setUniform("transform", projectedMatrix);
... |
48e127a0-a2f6-4f26-b388-d5ed2b4e9068 | 2 | public void saveMetaRecords() throws IOException{
Metafile record;
KeyFrame key;
String metaFile = "";
primaryFileName = primaryFileName.split(".rgb")[0];
System.out.println("primary file name "+primaryFileName.split(".rgb")[0]);
FileWriter fstream = new FileWriter(primar... |
80e42cf4-8cfb-4b5b-981a-8dc7cc4382b9 | 0 | public void setFunTipo(String funTipo) {
this.funTipo = funTipo;
} |
7a672e1b-c471-4765-b98d-01d413a02831 | 2 | public static double acos(double a){
if(a<-1.0D || a>1.0D) throw new IllegalArgumentException("Fmath.acos argument (" + a + ") must be >= -1.0 and <= 1.0");
return Math.acos(a);
} |
7ead7975-2c4b-4bac-8d48-b2eadabba390 | 3 | private void processEvent(Sim_event ev) {
Object data = null;
data = ev.get_data(); // get the event's data
if (data != null && data instanceof Gridlet) {
Gridlet gl = (Gridlet)data;
completedJobs.add(gl);
}
else {
// handle ping request
... |
c1a58b0d-7e31-447c-aa79-f9399a3f1dda | 9 | private boolean r_combo_suffix() {
int among_var;
int v_1;
// test, line 91
v_1 = limit - cursor;
// (, line 91
// [, line 92
ket = cursor;
// substring, line 92
... |
3fa7bd6f-6c76-4935-9626-51afd17d73c5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
FieldListNode other = (FieldListNode) obj;
if (node == null) {
if (other.... |
ce1c840b-897c-4d65-bdac-922b1a959809 | 9 | public int hashCode() {
int hash = 0;
if (foreground != null)
hash ^= foreground.hashCode();
if (background != null)
hash ^= background.hashCode();
if (font != null)
hash ^= font.hashCode();
if (metrics != null)
hash ^= metrics.hashCode();
if (underline)
hash ^= (hash << 1);
if (strikeout)
... |
6b63a455-4d50-4990-b513-0b5e3e6b6d92 | 1 | private void compute_pcm_samples12(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[1... |
94ca70ce-b2e9-4097-84dc-de82e00acc0f | 1 | public static InputStream getInputStreamByFilename(String filename) {
File inputFile = new File(filename);
InputStream inputStream = null;
try {
inputStream = inputFile.toURI().toURL().openStream();
} catch (IOException e) {
System.out.println("Unable to create In... |
55cbdf84-f704-4680-a350-a1997a6c33c6 | 6 | private Map<Integer, Double> getAllUsages(List<Bookmark> bookmarks, double timestamp, boolean categories) {
Map<Integer, Double> usageMap = new LinkedHashMap<Integer, Double>();
for (Bookmark data : bookmarks) {
List<Integer> keys = (categories ? data.getCategories() : data.getTags());
double targetTimestamp ... |
0d90ce1a-8954-4908-aa33-fe8655028c02 | 2 | public void actionPerformed(ActionEvent e) {
for (int i = 0; i < t.getSize(); ++i) {
t.TowerDefense_TransArray[i]
.setX(t.TowerDefense_TransArray[i].getX() + 1);
t.TowerDefense_TransArray[i]
.setY(t.TowerDefense_TransArray[i].getY() + 1);
t.TowerDefense_TransArray[i... |
ff52d38f-cc9d-4f78-bfc7-6d1f8581bd7a | 1 | @Test
public void testAddFutureMeetingIDs()
{
// add several future dates all on one day
Calendar date = (Calendar)futureDate.clone();
date.set(Calendar.HOUR, 8);
cmInst.addFutureMeeting(testContactSet, date);
date.set(Calendar.HOUR, 9);
cmInst.addFutureMeeting(testContactSet, date);
date.set(Calendar.H... |
d6b548b1-abce-4b03-9324-7998e4d42f1d | 7 | private void validarDatos(String nombre, String fecha_inicio, String fecha_fin) throws BusinessException {
String mensaje = "";
if(nombre == null || nombre.isEmpty())
mensaje += "Fecha de pago no puede ser nula o vacia\n";
if(fecha_inicio == null || fecha_inicio.isEmpty())
... |
920ebe15-6847-4e0f-adba-d086909a5288 | 6 | public int getMachineIndexByName(String machineFileName){
ArrayList machines = getEnvironment().myObjects;
if(machines == null) return -1;
for(int k = 0; k < machines.size(); k++){
Object current = machines.get(k);
if(current instanceof Automaton){
... |
088178ab-b03e-4183-8112-0aacb7613d41 | 1 | private void printResults() {
for (String result : results) {
System.out.println(result);
}
} |
e9d69915-4e14-44da-8b64-384f4ceb5851 | 1 | @Override
public void save() throws RemoteException {
try (OutputStream os = new FileOutputStream(settingsFile)) {
properties.storeToXML(os, "FTP File Manager Settings");
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
} |
9aa0d9a1-b830-4ad4-9c4f-66afaa4684d9 | 4 | public List<IGraph<N>> getMinimumGraphs() {
return result != null && result.size() > 0 && result.get(0) instanceof IGraph<?> ? (List<IGraph<N>>) result : null;
} |
ffe92ca4-99f1-40ca-877f-4520c37677ef | 0 | public void setNom( String nom ) {
this.nom = nom;
} |
f41bc9a1-e6b2-4924-ba89-d93945cd0ad7 | 7 | public void read_dic(String dictionaryFileName, TagSet tagSet) throws IOException{
String str = "";
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(dictionaryFileName)));
INFO[] info_list = new INFO[255];
for (int i = 0; i < 255; i++) {
info_list[i] = new INFO();
}
whil... |
ff5f44b9-4074-4a10-807d-525358e706a0 | 4 | @Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
Problem problem = problems.get(rowIndex);
switch (columnIndex) {
case COLUMN_TITLE:
problem.setProblemName(value.toString());
break;
case COLUMN_FILE_NAME:
problem.setFileName(value.toString());
break;
case COLUMN_IN... |
c72c46c1-915f-412b-83e9-c8d65c4e10d4 | 4 | private void loadPreferences() {
print("Loading user preferences");
preferences = new Properties();
// Try and load from a file
preferencesFile = new File(homeDir, "preferences.xml");
if (preferencesFile.isFile()) {
try {
preferences.loadFromXML(new FileInputStream(preferencesFile));
} catch (Inv... |
99b0401f-aed3-4328-8128-6ca66195c394 | 9 | public boolean onBoard() {
return (((col + row) % 2 == 0) &&
((col + row) >= 6) && // northwest border
((col + row) <= 22) && // northeast border
(col >= 1) && // west border
(col <= 9) && // east border
(row >= 1) && // north border
(row <= 17) &&... |
3dc69ae2-bb28-4ea2-a287-5524e3f64e10 | 2 | public void addValueToHashes(String currState,String prevState,double totalValue,
HashMap<String,String> bestToFrom,HashMap<String,Double> bestScoreTo) {
Double myVal=bestScoreTo.get(currState);
if (myVal==null || myVal<totalValue) {
myVal=new Double(totalValue);
bestToFrom.put(currState,prevState);
best... |
fd8b58bf-f52a-4def-91b7-400b54d26938 | 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... |
22e24791-b187-4b38-bb71-4584d4e268bd | 6 | @Override
public CounterParty createNewChild(TreeMap<String, String> properties) {
CounterParty counterParty = new CounterParty();
counterParty.setName(properties.get(NAME));
String aliasesString = properties.get(CounterParties.ALIAS);
if(aliasesString!=null){
counterPart... |
ffe69b81-6573-49a5-acc1-36528168c3d1 | 6 | @Override
public void hit(GameObject obj) {
if (obj instanceof Bullet && !((Bullet)obj).enemy) {
this.game.addScore(5);
width = width / 2;
height = height / 2;
v = new Vector2D(Math.random() * MAX_SPEED, Math.random() * MAX_SPEED);
if (width < 20 |... |
f0350faf-1e5d-404e-8fa6-c3be0c9209ad | 8 | public ArrayList<Edge> getEdges()
{
ArrayList<Edge> edges = new ArrayList<Edge>();
for (Integer u : adjList.keySet())
{
for (Integer v : adjList.get(u))
{
boolean found = false;
for (Edge e : edges)
{
if ((e.u == u && e.v == v) || (e.v == u && e.u == v))
{
found = true;
... |
d5d4431e-4728-40f9-80ef-74e15198bffc | 4 | private static void btxToXML_help(BTXParser in, XMLEventFactory ev, XMLEventWriter out)
throws IOException, XMLStreamException {
in.next(); // START_OBJECT
ParseEventData d = in.getEventData();
if (d.objName.equals("<t")) {
// Special for text type!
// Single unnamed attribute for the text
in.next(); ... |
a6500595-f7c4-4793-940f-042f19fdb949 | 4 | private static String searchEvent(String inputCommand) {
String keyword = getParameter(inputCommand);
if (keyword == null)
return MESSAGE_INVALID_CMD;
ArrayList<String> searchResults = new ArrayList<String>();
Iterator<String> eventIter = events.iterator();
while (eventIter.hasNext()) {
String currentEv... |
cfeee70f-28c0-4bac-b2fb-54c94368e57d | 2 | boolean isPalindrome(String str) {
for (int i = 0; i < (str.length() / 2) + 1; ++i) {
if (str.charAt(i) != str.charAt(str.length() - i - 1)) {
return false;
}
}
return true;
} |
c423420b-6193-406e-9e3c-cf92eb371440 | 9 | public static void main(String[] args) throws ClientProtocolException, IOException, InterruptedException {
// 读取配置文件
Properties config = new Properties();
config.load(new FileInputStream(GreatCustomerBak.class.getResource("/").getFile() + "config.properties"));
// 读取代理列表文件地址
String proxyListFile = config.getP... |
9b306304-ee54-4ece-bae7-c0f79e9a1185 | 7 | public static int dayToNum(String name)
{
int num;
if (name.equals("Monday"))
num = 1;
else if (name.equals("Tuesday"))
num = 2;
else if (name.equals("Wednesday"))
num=3;
else if (name.equals("Thursday"))
num = 4;
else if (name.equals("Friday"))
num=5;
else if (name.equals("Saturday"))
... |
4b3858d6-d850-423a-8e70-2c1a14fd180a | 8 | @Override
public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp)
{
final StringBuffer TBL=(StringBuffer)Resources.getResource("WEB SOCIALS TBL");
if(TBL!=null)
return TBL.toString();
final List<String> socialVec=CMLib.socials().getSocialsList();
final StringBuffer msg=new StringBu... |
7ec83593-9266-4cc8-9ec9-37181b53ea14 | 7 | static final public void Literal() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case NULL:
jj_consume_token(NULL);
break;
case TRUE:
jj_consume_token(TRUE);
break;
case FALSE:
jj_consume_token(FALSE);
break;
case INTEGER:
jj_consume_token(... |
c5907da3-67af-4a2d-aa9d-83ee5f047f1d | 3 | public static Matrix getMatrix(int rows, int cols, DataType dataType) {
Matrix matrix = null;
switch (dataType) {
case INTEGER:
matrix = new MatrixInteger(rows, cols);
break;
case DOUBLE:
matrix = new MatrixDouble(rows, cols);
... |
8499a0df-024a-4d54-a5b1-57f72594af94 | 0 | public void setFocused(boolean focus) {
focused = focus;
} |
6311b598-299f-40c3-9a2b-5b111ae5e265 | 6 | public Component getTableCellRendererComponent(JTable table, Object cell,
boolean isSelected, boolean hasFocus, int row, int column) {
super.getTableCellRendererComponent(table, cell, isSelected, hasFocus, row, column);
setToolTipText(ToolTipHelper.makeToolTip((Card)table.getValu... |
f6057016-7908-49bf-9ed9-079bd53653f7 | 0 | public VirtualReplayGainNode(Property property,
PropertyTree parent) {
super(property, parent);
} |
d47e2d1e-07f8-4b73-9000-80c327f5ce3c | 8 | public Suggestion createSuggestion(Set<Card> seenCards, Map <String, Card> cards, Map<Character, String> rooms){
Card rCard =new Card("Name", Card.CardType.ROOM);
Random rand = new Random();
int randNum = rand.nextInt(cards.size());
ArrayList <Card> unseenC = new ArrayList <Card>();
for(String c : cards.keyS... |
4a05d409-7c5f-43bd-a3e4-d56bc97c6a30 | 9 | public Instances getDataSet() throws IOException {
if (getDirectory() == null)
throw new IOException("No directory/source has been specified");
String directoryPath = getDirectory().getAbsolutePath();
FastVector classes = new FastVector();
Enumeration enm = getStructure().classAttribute().enu... |
e5feae7d-da24-4456-b077-df482f5e5cd9 | 5 | public Collection<PearsonDictionaryEntry> filter() {
List<PearsonDictionaryEntry> retVal = new ArrayList<PearsonDictionaryEntry>();
for (PearsonDictionaryEntry entry : entries) {
if (entry.getHeadword() != null && headword != null) {
if (entry.getHeadword().equals(headword)) {
if (posTagConstrains.conta... |
ec520705-53f8-46da-9929-412f5879d6ac | 7 | public void openDoors(Vector3f position, boolean playSound)
{
boolean worked = false;
for(Door door : doors)
{
if(Math.abs(door.getTransform().getPosition().sub(position).length()) < 1.5f)
{
worked = true;
door.open(0.5f, 3f);
}
}
if(playSound)
{
for(int i = 0; i < exitPoints.size... |
65c2f515-96e9-4e47-ac8a-c7fc4a059e36 | 7 | private void loadScene()
{
File stdSceneDir = new File("scenes");
if (!stdSceneDir.exists())
{
stdSceneDir.mkdir();
}
UIManager.put("FileChooser.cancelButtonText", LOCALIZER.getString(L_CANCEL));
UIManager.put("FileChooser.cancelButtonToo... |
6bb18bdc-4aa5-4830-8d91-b6627cf92059 | 8 | public void parseParameters() throws IOException {
int len = request.getContentLength();
if (len <= 0) {
return;
}
if (len > this.maxPostSize) {
log.warn("Parameters were not parsed because the size of the posted data was too big. "
+ "Use the maxPostSize attribute of the connector to resolve this ... |
30ab4975-2b1a-4382-863c-850217df5f04 | 3 | public static void saveAccounts() {
try {
StringBuilder rawAccs = new StringBuilder();
File accountsFile = new File(Configuration.ACCOUNTS_DIR + File.separator + "Accounts.txt");
if (!accountsFile.exists()) {
accountsFile.createNewFile();
}
... |
bab48204-0ddf-4416-a8a3-0a4d39388c83 | 5 | static final void method159(int i) {
if ((Class260.anInt3312 ^ 0xffffffff) < -1) {
int i_1_ = 0;
for (int i_2_ = 0; Class286_Sub1.consoleMessages.length > i_2_;
i_2_++) {
if (Class286_Sub1.consoleMessages[i_2_].indexOf("--> ") != -1
&& ++i_1_ == Class260.anInt3312) {
Class363.aString4461
... |
95a881e7-daa3-47e6-9f21-1a19a3f8913d | 5 | @Override
public List<Customer> searchCustomer(String term) {
term = ".*" + term + ".*";
List<Customer> match = new ArrayList<Customer>();
for (Customer customer : getCustomers()) {
if (customer.getAddress().matches(term)
|| new String(customer.getCustomerID() + "").matches(term)
|| customer.getName... |
252a05b5-42b3-4823-b67e-28c08e7d2c99 | 7 | public void run ()
{ Socket s = null;
try
{ String res;
s = new Socket(Mailhost, 25);
PrintStream p =
new PrintStream(s.getOutputStream(),true);
in = new DataInputStream(s.getInputStream());
expect("220", "greetings");
p.println("HELO " + "helohost");
expect("250... |
97f41cad-858b-4208-98f1-93f8b44eace4 | 1 | public void computerwins() {
if(tie==true)//occupied[0][0]==occupied[0][1]&&occupied[0][1]==occupied[0][2]&&occupied[0][2]==occupied[1][0]&&occupied[1][0]==occupied[1][1]&&occupied[1][1]==occupied[1][2]&&occupied[1][2]==occupied[2][0]&&occupied[2][0]==occupied[2][1]&&occupied[2][1]==occupied[2][2]&&tie==true)
... |
bc7c1eb7-7c45-42a3-bb77-2f7e85a50e70 | 9 | @Override
public Scorer scorer(LeafReaderContext context) throws IOException {
assert termArrays.length != 0;
final LeafReader reader = context.reader();
PhraseQuery.PostingsAndFreq[] postingsFreqs = new PhraseQuery.PostingsAndFreq[termArrays.length];
final Terms fieldTerms = reader.terms(... |
043410dd-dfda-4cd3-b1ad-643ca6f8490d | 9 | public Tetrad(BoundedGrid<Block> grid) {
blocks = new Block[4];
for (int i = 0; i < 4; i++) {
blocks[i] = new Block();
}
Color color = Color.WHITE;
Location[] locs = new Location[4];
int shape = 0;
shape = ((int) (Math.random() * 7));
switch (shape) {
case 0: // I shape
color = Co... |
c8faa86a-e426-478e-8132-fda00f9223f7 | 8 | public String toStringExtended() {
String info = (this.type + "-section named '" + this.name + "', id (" + this.reference
+ ") on level: " + level
+ "; complete path: " + this.getPath() + "\n\t- ");
if (this.subsections != null && this.sectionCount() != 0 && this.getSections() != nu... |
9e4cdd47-f363-45aa-86e2-4f259a3abecb | 4 | private JLabel menuItem(String title, final String desc, final int index) {
final JLabel btn = new JLabel(title);
btn.setHorizontalAlignment(JLabel.CENTER);
btn.setForeground(Color.WHITE);
btn.setBackground(new Color(0, 0, 0, 0));
btn.setFont(new Font("Serif", 0, 40));
btn.setPreferredSize(new Dimension(... |
cbc77573-65d9-4897-ac68-614dd1bdd3d6 | 8 | private PickResult pickGeomAny (PickShape pickShape) {
Node obj = null;
int i;
SceneGraphPath[] sgpa = null;
if (pickRootBG != null) {
sgpa = pickRootBG.pickAll(pickShape);
} else if (pickRootL != null) {
sgpa = pickRootL.pickAll(pickShape);
}
if (sgpa == null) return null; // no match
for(i=0; i<s... |
3a662685-993d-46f7-a633-3e9f990a2d41 | 5 | private void agrupar() {
Agrupamento agrupamento;
switch(agrupamentoAtual){
case TODOS:
agrupamento = criarAgrupamentoTodos();
break;
case ANO:
agrupamento = criarAgrupamentoPorAno();
break;
case ATIVO:
... |
911cc33f-14f0-4c1e-9425-ac1693b27494 | 6 | private static byte[][] generateSubkeys(byte[] key) {
byte[][] tmp = new byte[Nb * (Nr + 1)][4];
int i = 0;
while (i < Nk) {
tmp[i][0] = key[i * 4];
tmp[i][1] = key[i * 4 + 1];
tmp[i][2] = key[i * 4 + 2];
tmp[i][3] = key[i * 4 + 3];
i++;
}
i = Nk;
while (i < Nb * (Nr + 1)) {
byte[] temp ... |
6c7aea1d-9b66-461b-91f1-81f589e25684 | 2 | public static boolean probarConexion(String url,String user , String pass){
java.sql.Connection con = null;
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = java.sql.DriverManager.getConnection(url, user, pass);
if (con != null) {
... |
cca922e4-6155-40ab-a637-1f2167a335e7 | 2 | private SelectionTransition findFirstNonEmptyTransition() {
for (SelectionTransition transition : transitions) {
if(!transition.isEmpty())
return transition;
}
return null;
} |
2668d123-9585-4597-98ae-9fe672d9ef7d | 2 | public static int indexOf(int[] arr, int val){
for (int i = 0 ; i < arr.length; i++){
if (arr[i] == val) return i;
}
return -1;
} |
07f2665d-98cf-4055-b47b-9768f7d148a4 | 9 | static final void method432(int i, int i_0_, int i_1_, int i_2_) {
anInt619++;
i = i * Class213.aNode_Sub27_2512.aClass320_Sub25_7274.method3776(false) >> 8;
if ((i_1_ ^ 0xffffffff) != 0 || Class377_Sub1.aBoolean8775) {
if ((i_1_ ^ 0xffffffff) != 0 && ((Class313.anInt4013 ^ 0xffffffff) != (i_1_ ^ 0xffffffff) |... |
0ab69a6b-69cf-4ce9-a0cd-d79a64a62031 | 5 | public static Consumable loadConsumable(int ID) {
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/consumables"));
String line;
while((line = reader.readLine()) != null) {
final String[] temp = line.split(";");
... |
78db8769-3599-419d-bb4c-27ffa2a03999 | 4 | private void checkUndeclaredVariable(ParseTree node) {
if (node.attribute.equals("IDENTIFIER") && !containsVariable(node.value) && !undeclaredVariables.contains(node.value)) {
System.out.println("Undeclared Variable: " + node.value);
undeclaredVariables.add(node.value);
}
for (int i = 0; i < node.childr... |
62cbc004-f719-467a-a5c0-a87a2d610c45 | 6 | private boolean setHoustonMap(String mapName){
Image mapImage = null;
ImageIcon imageIcon;
boolean hasFile = false;
//for displaying message on the panel.
startPanel.appendText(">> Connecting... \n" +
">> Destination: " + urlStr + " \n");
if (url_status){//If URL Internet connection is availa... |
1571bad0-74f4-438d-bead-a0dfa4c1b46c | 4 | @Override
public void sequence(String id, String sequence, String quality) {
// Testing the strings (if some are null the method will stop here)
if ((sequence == null) || (quality == null) || sequence.isEmpty()
|| quality.isEmpty()) {
return;
}
super.addValue(sequence.length());
} |
df9182a7-30e1-44b2-a691-699b51933457 | 2 | @Override
public int getAddress(Identifier var, int size)
throws Exception {
addressRecord a = usedMem.get(var);
if(a != null) {
if(a.size != size) {
throw new Exception("varaible accessed as different size than expected");
}
return a.addre... |
365b8092-22a4-4546-bbad-eb2223f2d3aa | 8 | SignatureInputStream(Hessian2Input in)
throws IOException
{
try {
_in = in;
byte []fingerprint = null;
String keyAlgorithm = null;
String algorithm = null;
byte []encKey = null;
int len = in.readInt();
for (int i = 0; i < len; i++) {
S... |
ea0485e5-79d1-4b12-9ba6-01e4d70df1a0 | 0 | @Override
public String getName() {
return name;
} |
0793f8aa-9981-4f4f-8868-056b3ab58908 | 5 | public int size(int niveau){
int size = 0;
switch(niveau){
case 1:
size = beginner.size();
break;
case 2:
size = intermediate.size();
break;
case 3:
size = advanced.size();
break;
case 4:
size = expert.size();
break;
case 5:
size = grandmaster.size();
break;
... |
45126465-3738-425a-b2b4-53d9ca331571 | 2 | public void execForAbonent(Abonent abonent) {
Queue<Msg> messageQueue = messages.get(abonent.getAddress());
if (messageQueue == null) {
return;
}
while (!messageQueue.isEmpty()) {
Msg message = messageQueue.poll();
message.exec(abonent);
}
... |
f99cc6a9-0251-4eb7-aa95-91d04079ddb8 | 7 | protected static void initFilters(boolean loader, Vector<String> classnames) {
int i;
int n;
String classname;
Class cls;
String[] ext;
String desc;
FileSourcedConverter converter;
ExtensionFileFilter filter;
if (loader)
m_LoaderFileFilters = new Vector... |
46b93bce-3849-4076-b3fd-d785cb48b3d0 | 8 | public void merge(Iterable<? extends Player> updateDatabase) {
for (Player rhs : updateDatabase) {
boolean matched = false;
boolean conflict = false;
for(String key : rhs.getIds().all()) {
String id = rhs.getIds().get(key);
Map<String,Player>... |
4b691403-2bcf-468b-87b3-6c523b4734db | 7 | public static boolean getStationsData(String pathName) {
DocumentBuilderFactory docBuilderFactory;
DocumentBuilder docBuilder;
Document document = null;
try {
docBuilderFactory = DocumentBuilderFactory.newInstance();
docBuilder = docBuilderFactory.newDocumentBuilder();
document = docBuilder.parse(new... |
205d9cf3-13df-42ff-8e83-ded4cfc3513f | 8 | public static void unjar(Path file, Path to) throws IOException {
if (Files.notExists(to)) {
Files.createDirectories(to);
}
try (JarFile jarFile = new JarFile(file.toFile())) {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = ... |
2b3eea38-1572-4921-87fd-67115ee0d1b5 | 4 | public Reservation modifyReservation(int reservationId, double startTime,
int duration, int numPE) {
Reservation currReservation = getReservation(reservationId);
if(currReservation == null) {
logger.info("Error modifying reservation, ID is invalid");
return null;
}
... |
0c932d7d-18f0-454c-b2e8-b5bab353fd7f | 6 | private static void twoPlayers(int numOfCards) {
frame.setLayout(new BorderLayout());
// If a game has already been started
// cardHolderPanel has to be cleared before
// it can be used properly again.
cardHolderPanel.removeAll();
// Adds the cardHolderPanel to the frame.
frame.add(cardHolderPanel, Bor... |
2b93ace7-cedc-49b6-88d1-77fd1cf30a93 | 0 | @Test
public void testHasMatchedWord() {
assertTrue(_dictionary.hasMatchedWord("356937"));
} |
75cd1e6c-db5b-47f9-94fd-8a809ff0d0e2 | 9 | protected boolean isSubTypeOf(final Value value, final Value expected) {
Type expectedType = ((BasicValue) expected).getType();
Type type = ((BasicValue) value).getType();
switch (expectedType.getSort()) {
case Type.INT:
case Type.FLOAT:
case Type.LONG:
... |
2dac3df4-677d-4886-8c06-3984c9e1c9a4 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if((tickID==Tickable.TICKID_MOB)
&&(affected instanceof MOB)
&&(affected != invoker))
{
final MOB M=(MOB)affected;
final MOB mob=invoker();
final Room R=CMLib.map().roomLocation(M);
... |
14fef1fd-2142-46be-908f-786f9c5bf6fd | 1 | @Override
public void run() {
Loader loader = new Loader();
try {
loader.setUrl(url);
loader.load();
} catch (Exception e) {
e.printStackTrace();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.