method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ca54bf92-07c0-495a-923f-6b42ad15a18e | 5 | public void save() {
final ColumnMapper mapper = getColumnMapper();
final ContentValues values = new ContentValues();
final Field[] fields = Reflection.getNonStaticDeclaredFields(getClass());
for (Field field : fields) {
if (!isMultiValued(field) && !isTransient(field)) {
values.put(field.getName(), map... |
dade8518-e9b5-4ac0-b674-e17e8cbf5116 | 2 | public Endereco Abrir(int idEndereco){
try{
PreparedStatement comando = banco.
getConexao().prepareStatement("SELECT * FROM enderecos WHERE id =? AND ativo = 1");
comando.setInt(1, idEndereco);
ResultSet consulta = comando.executeQuery();
coman... |
6f6f0bff-361d-4c2f-85f4-b70393530b57 | 2 | protected int positionsTotal(Instrument instrument) throws JFException {
int counter = 0;
for (IOrder order : engine.getOrders(instrument))
if (order.getState() == IOrder.State.FILLED) counter++;
return counter;
} |
f63c67e1-bf13-499f-bd91-14b122fd8ea6 | 4 | private boolean setDrawing(Drawing drawing) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: SetDrawing() BEGIN");
}
m_drawingControl = drawing;
if (test || m_test) {
System.out.println("GameWindow :: SetDrawing() END");
}
return true;
} |
df7812c9-3f02-4e2e-9986-723f6dafaa5d | 7 | public void updateLyricsPane(final Track t) {
if(!currentTrack.equals(t)) {
currentTrack = t;
new Thread() {
@Override
public void run() {
String artist = t.get("artist");
String title = t.get("title");
... |
73770f65-3704-4f81-b230-8285019b35e3 | 7 | private void generateLevel() {
doors = new ArrayList<>();
enemies = new ArrayList<>();
collisionPosStart = new ArrayList<>();
collisionPosEnd = new ArrayList<>();
medKits = new ArrayList<>();
ArrayList<Vertex> vertices = new ArrayList<>();
ArrayList<Integer> indi... |
18938b87-2efb-410c-b74a-a9c40368539e | 8 | public Set<Map.Entry<Float,Float>> entrySet() {
return new AbstractSet<Map.Entry<Float,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TFloatFloatMapDecorator.this.isEmpty();
}
p... |
cacac16a-4537-465f-94c0-7f14726146b3 | 0 | private Printer(){} |
87832dca-869f-4e34-9884-f2f8ef7a51d9 | 7 | private void rec(int as, int bs, int rets, int n){
if(n<=SMALL){
for(int i=0;i<2*n;++i) t[rets + i] = 0;
for(int i=0;i<n;++i)
for(int j=0;j<n;++j) t[rets + i+j] += t[as + i] * t[bs + j];
return;
}
int ar = as;
... |
2a5321a4-9da8-4649-a87f-13b2b898daa4 | 7 | public String toString() {
StringBuffer result;
int i;
int n;
boolean found;
result = new StringBuffer();
// title
result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n");
result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") ... |
f40beef8-e7f3-4efc-aee3-c62ff802a6a5 | 0 | public JTextField getjTextFieldLieux() {
return jTextFieldLieux;
} |
cd5194aa-99b3-4069-9b3e-0e07504a5e39 | 9 | public void render() {
bg.bind();
Molybdenum.GLQuad(0, 0, Display.getWidth(), Display.getHeight());
Molybdenum.setAwtColor(Color.WHITE);
Molybdenum.getText().drawStringS("Molybdenum | Properties", 16, 16, Text.LEFT, 3f,4);
Molybdenum.getText().drawStringS("Press enter to confirm a choice!", 64, 64, Text.LEF... |
e41084f7-182e-43e5-8cd1-19e2f7e0b810 | 9 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
if(sender instanceof ConsoleCommandSender)
{
getLogger().info("Console cannot use this plugin.");
return true;
}
if(args.length == 0)
return true;
if(p.has(sender, cmd, Arrays.copyOfRange(args, 0, 1), fa... |
b98374dd-8cbb-4878-a558-af3e7accc015 | 0 | public String getName() {
return Name;
} |
43d5f7e9-d44b-4127-9f16-c6b143289fde | 2 | @Override
public void performUseAction(Player user, UI ui) {
Location current = user.getCurrentLoc();
for (Item item : current.getItems())
{
if (item instanceof BasiliskItem)
{
current.removeItem(item);
ui.display("A giant duck swoops through a broken window, into the hall, and sings the \"quac... |
943f52b3-ecac-46e3-9307-f348c1450d22 | 7 | @EventHandler
public void GhastResistance(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("Ghast.Resist... |
c840d965-ac8b-4bf3-b79a-bb4bc16c2f5d | 7 | double gradCorrect(double g, double eta)
{
int nPos = sequence.length();
int y = sequence.getY(0);
double[] grad = new double[]{g};
updateU(grad, 0, y, 1, eta);
double sum = u[0][y];
for (int pos = 1; pos < nPos; ++pos)
{
int lasty = y;
... |
9ffd0e43-7d3c-4781-a3f8-399c8e8e7095 | 6 | public EnigmaMachine(int r1, int r2, int r3, int pos1, int pos2, int pos3, String p1, String p2, String p3){
reflector = new Reflector();
if(pos1 < 26 && pos2 < 26 && pos3 < 26){
rotor1 = new Rotor(r1, pos1, null);
rotor2 = new Rotor(r2, pos2, rotor1);
rotor3 = new Rotor(r3, pos3, rotor2);
}
if(p1.l... |
ced57f16-f381-40ce-8e43-c5a95cea13e8 | 3 | public boolean suurempiKuin(Siirto toinen){
if (this.arvo > toinen.arvo){
return true;
} else if (this.arvo < toinen.arvo){
return false;
} else {
// jos siirroilla on sama arvo, priorisoidaan syntyneiden rivien mukaan
if (this.rivit > toinen.rivit... |
3322dcfb-36cc-4f24-b5b0-a74c8a95cfc9 | 5 | public void calculateLoS()
{
lineOfSight.reset();
int Xx;
int Yy;
int d;
int dr;
int dx;
int dy;
boolean yes;
int resolution = 18;
for (int i = 0; i < resolution; i++)
{
Xx = (int)world.x-world.viewX;
... |
532e24a8-3873-4ab7-a21b-920f920799de | 0 | private static void help() {
System.out.println("The allowed commands are:");
System.out.println(" n/north");
System.out.println(" s/south");
System.out.println(" e/east");
System.out.println(" w/west");
System.out.println(" h/help");
System.out.println(... |
86581b0a-bd89-463c-9ac7-e3dec0e0bd24 | 3 | public void preencherTabela() throws Exception
{
ArrayList<String> colunas = new ArrayList<String>();
colunas.add("id");
colunas.add("titulo");
colunas.add("orientador");
colunas.add("pesquisadorResponsavel");
colunas.add("colaboradores");
colunas.add("anoSubmissao");
colunas.add("tempoDuracao");
col... |
7cfecec2-9827-4dc3-96f6-086656261c5d | 6 | public void printResultTable(String queryString) {
String query = queryString;
try {
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
// printColTypes(rsmd);
// System.out.println();
int numberOfColumns = rsmd.getColumnC... |
6ba3a778-bd39-4b12-8a80-122526525598 | 7 | public static char[][] generate_bifid_square(String keyword)
{
boolean[] alpha=new boolean[26];
char[][] square=new char[5][5];
int cur_row=0;
int cur_col=0;
//write the keyword to the square in a clockwise spiral
for(char c:keyword.toLowerCase().toCharArray())
{
if(c=='j')
{
c='i';
//i... |
fdf36bb3-a9c5-4db7-8d97-a71362b8f463 | 7 | private JPanel getInstallationPanel(final InstallationWorker installationWorker){
JPanel installationPanel = new JPanel();
installationPanel.setBackground(Color.WHITE);
final JProgressBar installationDirectoryProgress = new JProgressBar();
// TODO: Test this width in different OS
... |
2deddf68-c2e3-46d5-89f9-e3523e5f4842 | 4 | public void findMostValuableCombination(int itemIndex, int price, int weight) {
if (weight <= maxWeight && price > bestFoundPrice) {
this.bestFoundPrice = price;
this.bestFoundWeight = weight;
bestSet = Arrays.copyOf(tempSet, tempSet.length);
}
int nextItemInd... |
d8cd2893-59bd-4135-8cde-ec8cfb2a64d6 | 6 | public void loadHighScores() throws IOException, FreeColException {
highScores = new ArrayList<HighScore>();
File hsf = FreeColDirectories.getHighScoreFile();
if (!hsf.exists()) return;
XMLInputFactory xif = XMLInputFactory.newInstance();
FileInputStream fis = null;
try {... |
c86e828b-f68a-4c42-b816-b3020671c57c | 0 | public static void main(String[] args) {
List<String> list = new ArrayList<String>(
Arrays.asList("cat", "dog", "horse")
);
System.out.println(list);
String item = list.get(1);
System.out.println(item);
boolean contains = list.contains(item);
System.out.println(contains);
int index = list.... |
ddfdd96f-d008-44f5-8018-f6478eb97bcd | 5 | public static void main(String[] args){
final int N = 10;
final int[] values = new int[N];
for (int i = 0; i < N; i++) values[i] = 0;
final Frame frame = new Frame("Random test");
Canvas canvas = new Canvas(){
public void paint(Graphics g){
g.setColor(new Color(255,255... |
b033f1ac-1580-480a-9c8b-c71e66a69dc0 | 0 | ThreadDemo(String str) {
t = new Thread(this, str);
// this will call run() function
t.start();
} |
d22411f8-6f71-4197-817f-6967507957ae | 7 | private void makeConnection(ArrayList<String> connection)
{
// Check the type of gate and call the appropriate function
if (connection.get(0).equals("INVERTER"))
createInverter(connection.get(1), connection.get(2));
else if (connection.get(0).equals("AND"))
createAnd(connection.get(1), connection.get(2), c... |
ffa0d44a-e812-424a-b575-e734175f1ae7 | 0 | public void setSootConfig(IInfoflowConfig config) {
this.sootConfig = config;
} |
dd297eaf-7226-4f12-9700-41238a4ddbca | 9 | private void onSessionClosed() {
if (this.isSendingFile) {
if (this.exceptionOccurred || this.closedByRemote) {
this.finishSendingFile(false);
this.fileSendingEventHandler.onSendingFailed(this.sendingFile);
}
} else if (this.isReceivingFile) {
if (this.exceptionOccurred || this.closedByRemote) {
... |
90ab60e3-0104-4006-b41c-8750eb56a1ac | 7 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.out=response.getWriter();
PrintWriter out=response.getWriter();
String message=request.getParameter("msgtxt");String pnumber=request.getParameter("da");String time=request.getParameter("dt... |
8c157ab1-d1ce-4dab-b740-428253afa583 | 1 | private void doLaunchButton() {
launchButton.setEnabled(false);
if (frame == null) {
frame = new Pentominos("Pentominos",8,8,true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.addWindowListener( new WindowAdapter() {
public void windowClosed(WindowEv... |
843ae99b-a94f-4582-bbcd-af384526c2a3 | 0 | public Coffee() {
this.setName("Coffee");
this.setPrice(new BigDecimal(10));
} |
930186b3-589a-44b9-bae2-666a7df1f2b3 | 6 | 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 ... |
1ba6240c-febd-4acd-8828-166003de7536 | 0 | @Override
public String getDesc() {
return "DarknessJupitel";
} |
60722fd4-4d43-4576-8f15-945cd97fbadd | 6 | public static boolean renameTo(File file1, File file2) throws IOException {
if (!file1.exists()){
throw new IOException(file1.getAbsolutePath()+" does not exist");}
/// That's right, I can't just rename the file, i need to move and delete
if (isWindows()){
File temp = new File(file2.getAbsoluteFile() +"."+n... |
ed47272a-9a23-4560-9d90-ea4e2cb235b1 | 8 | private void addMarker(final MarkerTile markerTile) {
add(markerTile);
markerTile.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
Position huffPosition;
board.removeMarkers();
AbstractPlay play= markerTile.getRelatedPlay();
play.execute();
... |
e6c00b63-d747-4b44-bce8-568e1eaf5671 | 3 | public static void updateCarte(Carte carte) {
PreparedStatement stat;
try {
stat = ConnexionDB.getConnection().prepareStatement("select * from carte where id_carte=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
stat.setInt(1, carte.getId_carte());
... |
96d2c9cb-9102-456d-9921-eafbbc25ffa1 | 9 | @Override
public void actionPerformed(ActionEvent e)
{
String event = e.getActionCommand();
if(event.equals("Add item"))
{
// get description of the item
String description;
do
{
description = JOptionPane.showInputDialog(null, "Description of the item: ", "Add an item", JOptionPane.QUESTION_MES... |
ebea42f8-c3c8-4c06-8cb2-d2dbe26a177c | 2 | public static void checkAutoBroadcastMessagesYAML() {
File file = new File(path + "AutoBroadcast/messages.yml");
if(!file.exists()) {
try {
file.createNewFile();
FileConfiguration f = YamlConfiguration.loadConfiguration(file);
List<String> messages = new ArrayList<String>();
messages.add("&lThis ... |
a0432d65-ec91-4b50-9010-5b30534e9550 | 6 | public static void swapElements(Vector someVector, int indexOne, int indexTwo) {
// size is useful
int size = someVector.size() ;
// validate parameters
// also leave in identity case
if ( (someVector == null) ||
(indexOne < 0) || (indexOne >= size)||
(indexTwo < 0) || (indexTwo >= size)||
(in... |
fdb2faeb-e8b6-464e-902d-62004cec27a3 | 3 | public MeetingInvite getMeetingInviteByUsernameAndMeetingID(int meetingInviteID, String username){
for(MeetingInvite meetingInvite : meetingInvites){
if(meetingInviteID == meetingInvite.getMeetingID() && username.equals(meetingInvite.getUsername())) return meetingInvite;
}
return nu... |
fabc44fc-9cc0-46f2-8bb1-97d312a30fd0 | 0 | public void removeOutlinerDocumentListener(DocumentListener l) {
outlinerDocumentListeners.remove(l);
} |
bc4185ca-4504-421e-94d4-53b41e69321b | 5 | @Override
public boolean equals(Object other) {
boolean isEqual = false;
if (other == this) {
isEqual = true;
} else if (other != null && other.getClass() == this.getClass()) {
Coordinate otherCoord = (Coordinate) other;
isEqual = oth... |
1f96a7c6-7e2a-4b2c-a7fa-a67981e87d8f | 1 | public void onRoundChanged(int round, int maxRound)
{
String text = INIT_TEXT + round;
if (maxRound != 0)
text += ADDITIONAL_OF_TEXT + maxRound;
setText(text);
} |
eac13827-5a0a-465b-aa3a-00d0fd0080c6 | 0 | @Test
public void test_movement() throws OutOfBoardException{
assertNotNull(pawn);
//Four direction
Direction dirDown = Direction.Down;
Direction dirUp = Direction.Up;
Direction dirRight = Direction.Right;
Direction dirLeft = Direction.Left;
when(board.getX... |
fffd9b01-82f6-4dff-818a-488ac2874e0a | 8 | public void useIt(){
panel.player.equipment.remove(this);
switch(this.itemType){
case(1):
if(panel.player.energy <100){
int diff = (int) (100 - panel.player.energy);
if(diff > healthPts){
panel.player.energy += healthPts;
panel.actionMessages.add(new ActionMessage(panel,"Got " +healthPt... |
c90658ee-78fd-485d-89a1-adc08cd0a77d | 5 | public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (handledElements.contains(qName) && parentElement.equals(ROOT_ELEMENT)) {
currentElement = qName;
}
if (qName.equals(TRANSACTIONS_ELEMENT)) {
parentElement... |
01768b29-ae4c-49c1-a5ac-6796dc538863 | 6 | public void capturegroup (int i, int j, int c, Node n)
// Used by capture to determine the state of the groupt at (i,j)
// Remove it, if it has no liberties and note the removals
// as actions in the current node.
{
int ii, jj;
Action a;
if (P.color(i, j) != c) return;
if ( !P.markgrouptest(i, j, 0)) // lib... |
533241be-3912-4a17-9d3d-41c9327a957a | 1 | @Override
public float contains( int x, int y ) {
if( parent.getBoundaries().contains( x, y ) ) {
return 1.f;
} else {
return 0.f;
}
} |
e33405fe-1b7f-4761-9d40-27f415513e75 | 0 | public Priority getPriority() {
return priority;
} |
085a9fb9-fee9-4a0d-84a3-14de0d5305be | 8 | public void checkPurchase()
{
if(BackerGS.storeVisible)
{
if(CurrencyCounter.currencyCollected < 80)
{
if(Greenfoot.mouseClicked(this))
{
NotEnoughMoney.fade = 200;
boop.play();
}
... |
c080a9d6-8bfe-4053-b000-48d2c0461987 | 8 | private <T extends TaobaoResponse> Map<String, Object> doPost(TaobaoRequest<T> request, String session) throws ApiException {
Map<String, Object> result = new HashMap<String, Object>();
RequestParametersHolder requestHolder = new RequestParametersHolder();
TaobaoHashMap appParams = new TaobaoHashMap(request.getTe... |
f06beeaa-68de-4566-ae42-ee0ea8692b3d | 6 | public void dump(DumpSource ds) {
num.setLength(0);
txt.setLength(0);
offset = 0;
try {
int b = 0;
int column = 0;
while ((b=ds.get()) != -1) {
num.append(String.format("%02x", b & 0xff));
num.append(' ');
txt.append(Character.isLetterOrDigit((char)b) ? (char)b : '.');
if (++c... |
c8ffc5a8-3732-4e41-88f4-b9ea98495e24 | 5 | public boolean SendHeader() throws IOException
{
File l_fileAttribute;
PrintStream l_printStream;
Scanner l_readStream;
String l_basename;
long l_fileSize;
/*
* Check if socket and/or filename are not null
*/
if( ( up_socket == null ) ||
( up_filename == null ) )
return false;
... |
830a36ed-3efe-4e24-ad60-1fc9db8aafc0 | 7 | public boolean isContinuousExcludeTerminalsAttachToRoot() {
int lcorner = getLeftmostProperDescendant().getIndex();
int rcorner = getRightmostProperDescendant().getIndex();
if (lcorner == rcorner) {
return true;
}
TokenNode terminal = ((TokenStructure)getBelongsToGraph()).getTokenNode(lcorner);
whi... |
d1f3c7c7-7460-4625-809b-3d10b2462d74 | 5 | public boolean add(String key, String value) {
String ligne;
try {
while ((ligne = _br.readLine()) != null) {
int a = 0;
while (ligne.charAt(a) != '@') {
a++;
}
ligne = ligne.substring(0, a);
... |
e17bebf4-055b-4751-88d7-5ea5d721a457 | 0 | private Vecteur getVecteur(int i) {
return new Vecteur(courante.getForme().getPoints(i).get(0) + position.get(0), courante.getForme().getPoints(i).get(1) + position.get(1));
} |
15590c1c-b4d1-446d-a552-1fc3abb20c4b | 4 | FloodFill(Canvas c, BufferedImage source, Point p, int threshold)
{
this.source = source;
this.threshold = threshold;
if (p.x < 0 || p.y < 0 || p.x >= source.getWidth() || p.y >= source.getHeight()) return;
targetRGB = source.getRGB(p.x,p.y);
floodFill(p,c);
} |
8a18fcc0-af02-446a-94a7-d9f125122897 | 4 | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(name);
if (stacksize > 1) {
sb.append(" [").append(stacksize).append("]");
}
if (price > 0) {
sb.append(" ");
int total = price * stacksize;
if (total > 1000000) {
sb.append(format.format(tota... |
e3168d6c-563d-400f-8c06-a137febd1e6d | 0 | public StopRange getRange() {
return this.Range;
} |
25170c2b-5c43-46f9-99cb-8e36129f0b70 | 8 | public int compare(Static o1, Static o2) {
if(tiledata != null && o1.getX() == o2.getX() && o1.getY() == o2.getY() && o1.getZ() == o2.getZ()){
ItemData t1 = tiledata.getItem(o1.getId());
ItemData t2 = tiledata.getItem(o2.getId());
if(t1 == null && t2 == null) return 0;
int t1b = (t1.getFlags().conta... |
97c7dd17-0ada-4690-8a71-8eb835d93712 | 7 | public void chooseShape(Point.Double p) {
JRadioButton rectangle = new JRadioButton();
JRadioButton circle = new JRadioButton();
JPanel radiopanel = shapeRadioPanel(rectangle, circle);
rectangle.setSelected(true);
circle.setSelected(false);
int chooseShape = JOptionPane.s... |
b1b3ec09-46aa-4737-803d-aca8a37f87cc | 3 | @Override
protected void resolveCollision(GameContext g,Collidable c, float percent) {
if (isGhost)
return;
setCollisionPosition(percent);
if (c instanceof Dot) {
if (((Dot)c).isGhost)
return;
g.removals.add(this);
setDead(true);
g.removals.add((Mob)c);
((Dot)c).setDead(true);
Vector new... |
5f5029ac-305c-483c-b49c-d5cf216694e1 | 1 | @Test
public void newBoard_verifyPiecePlacement() throws Exception {
// when
final Board board = new Board();
// then
for (int i = 0; i < 8; i++) {
assertPieceTypePlacement(board, PieceType.PAWN, i);
}
assertPieceTypePlacement(board, PieceType.ROOK, 0);
... |
235c98ad-aa7b-478e-a3e8-5dbbbb7a288a | 8 | public static boolean isTransition(char s1, char s2){
if ((s1=='A')&&(s2=='G')) return true;
if ((s1=='G')&&(s2=='A')) return true;
if ((s1=='C')&&(s2=='T')) return true;
if ((s1=='T')&&(s2=='C')) return true;
return false;
} |
38361eb8-4bd1-4645-a8c1-cd6f4821fb13 | 2 | @Override
public void valueChanged(ListSelectionEvent e) {
if (e.getSource() == orderList) {
// check if order list is empty
if (orderList.getSelectedIndex() > -1) {
// separate the text in the selected list item
String[] values = orderList.getSelectedValue().split("\\t");
// JOptionPane.showMessag... |
86754ce6-36d9-4467-8cf7-6f5e8140b582 | 9 | public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbTenantByUNameIdxKey ) {
GenKbTenantByUNameIdxKey rhs = (GenKbTenantByUNameIdxKey)obj;
if( getRequiredClusterId() < rhs.getRequiredClusterId() ) {
return( -1 );
}
else if( getRequiredClusterId() ... |
c0b53531-e2f8-4685-af66-47879c1465a9 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
0e90abd9-c4fa-4887-ad4d-abb28db41396 | 6 | public boolean updateLeagueHierarchyRequest(Sport sport) {
String request = null;
switch(sport) {
case NBA: case NHL:
request = "http://api.sportsdatallc.org/" + sport.getName() + "-" + access_level + sport.getVersion() + "/league/hierarchy.xml?api_key=" + sport.getKey();
Element element = send(requ... |
636cff67-d28b-4355-b233-d16b91673422 | 7 | private void initializeView()
{
this.setOpaque(true);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createLineBorder(Color.black, BORDER_WIDTH));
label = new JLabel("Welcome to the game hub");
Font labelFont = label.getFont();
labelFont = labelFont.deriveFont(labelFont.getStyle(), LABEL... |
47ed56fc-c529-4f60-bac2-85eb81d98abd | 7 | private void gameUpdate() {
if (!isPaused && !gameOver) {
//TODO Do something with game state
// You can for instance set certain flags and here you would then put: if(flag) => do something
/** PLACE A BLOCK **/
if(placeBlockFlag){
//Place the block
currentSelectedBlock.activate(new ArrayList<Node... |
010ee173-e07a-4126-97e4-9379029ceeda | 6 | public void evolve() {
// Create a buffer for the new generation
Chromosome[] buffer = new Chromosome[popArr.length];
// Copy over a portion of the population unchanged, based on
// the elitism ratio.
int idx = Math.round(... |
63346680-f707-4e0f-914b-45a0482944a5 | 5 | public void updateAt(Tile tile) {
int value = 0 ;
final Element owner = tile.owner() ;
if (owner instanceof Installation) {
value = ((Installation) owner).structure().ambienceVal() ;
}
if (owner instanceof Flora) {
value = ((Flora) owner).growStage() ;
}
for (Mobile m : tile... |
319269ba-4242-4774-a990-c48c7af2f24e | 1 | private void log(String string) {
System.out.print(string);
if (++m_count % 40 == 0) {
System.out.println("");
}
} |
b224e2e6-96d8-44ac-b3e4-e4fd6cbc5f9c | 5 | @Override
public void rodarJogo(){
if (JOptionPane.showConfirmDialog(null, "\nUsar midia física?\n","Iniciando...",JOptionPane.YES_NO_OPTION) == 0 ){
this.jogoRodando = JOptionPane.showInputDialog(null,"\nInforme qual o jogo a executar\n","Iniciando...",JOptionPane.INFORMATION_MESSAGE);... |
78d0dabd-8dc5-453c-8c91-b11eeb11c2f8 | 0 | public boolean isAccepted() {
return false;
} |
e077c46f-e070-45c8-9ce6-850786707443 | 2 | private String prepareGet(Response data) throws Exception {
if(data == null)
return "";
StringBuffer sb = new StringBuffer();
Map<String, String> params = data.toMap();
for(Entry<String, String> s : params.entrySet()) {
sb.append('&');
sb.append(URLEncoder.encode(s.getKey(), ENCODE) + "=" + URLEnco... |
db0489b1-b840-47a6-a2c3-7020d5f0421a | 0 | public Instruction getInstruction(int currState) {
return fsm.get(currState);
} |
b1d703a0-ce94-400a-9e02-44fc8c89ce1f | 5 | public static void main(String[] args) {
// TODO Auto-generated method stub
long temp = 1;
boolean flag = true;
for(int i=1;i<=20; i++)
temp=temp*i;
long lcm =temp;
System.out.println(temp);
for(long j = 1 ; j <lcm; j++)
{
for(long k=1; k <= 20; k++)
{
if(j%k != 0)
{
flag = false;
break;
}
flag = true;
}... |
b7b475db-4475-455d-8aa7-2f5898d9dd05 | 7 | public void use(BattleFunction iface, PokeInstance user, PokeInstance target, Move move) {
if (this.target == Target.target) {
if (target.battleStatus.flags[8] && levels < 0)
return;
target.battleStatus.modify(stat, levels);
if (levels > 0) {
iface.print(target.getName() + "'s " + stat.name() + " has... |
1e7673b9-c06d-472d-8d93-cb4e85708f25 | 4 | private static String[] tempFSA(String[] input) {
char[] transitions = {' ', ',', '.', '?'};
int numberOfTransitions = transitions.length;
String[] output = new String[input.length*input.length*numberOfTransitions];
int counter = 0;
int internalCounters[] = new int[input.length];... |
0975e6f2-37f5-4e63-b8dc-ab312a3fd1f1 | 2 | public Cell findByCellValue(String value) {
for(Cell c : cells) {
if(value.equals(c.getCellValue())) {
return c;
}
}
return null;
} |
b798c85a-2ebd-4290-b036-71e056d0dd35 | 0 | public Music(Animation anim) {
super(anim);
} |
935ce953-cce8-416e-a9d8-b0c4b89d0e74 | 4 | boolean safe(int r, int c, int n, int[] occ) {
for (int i = 0; i <= r; ++i) {
if(occ[i] == c || Math.abs(occ[i]+i)==Math.abs(r+c) || occ[i]-i==c-r) {
return false;
}
}
return true;
} |
5dfe5118-40ee-425a-9aa2-70d271b1bd13 | 6 | @Override
public void run(Player interact, Entity on, InteractionType type) {
if(type != InteractionType.DAMAGE) return;
int range = 2;
if(interact.isSneaking()) range = 5;
for(Entity e : on.getNearbyEntities(range, range, range)){
if(e instanceof LivingEntity){
LivingEntity le = (LivingEntity) e;... |
4afecd32-19be-4cd6-bd83-4fa21810c10c | 1 | public void cleanup() {
final Iterator iter = clean.iterator();
while (iter.hasNext()) {
final Node node = (Node) iter.next();
node.cleanup();
}
} |
02319488-3203-4be4-a2f9-132ddcdf8c7b | 0 | public EventServlet() {
super();
// TODO Auto-generated constructor stub
} |
a8269293-0b08-41b9-a73f-7a2aee651dc0 | 2 | private boolean untar(File fileToUntar) throws FileNotFoundException, IOException {
boolean fileUntarred = false;
String untarLocation = fileToUntar.getAbsolutePath();
TarArchiveInputStream tarStream = new TarArchiveInputStream(new FileInputStream(fileToUntar));
BufferedReader bufferedTa... |
0e010c23-7f80-4d63-9733-735ae9180e95 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof DiscountCode)) {
return false;
}
DiscountCode other = (DiscountCode) object;
if ((this.discountCode == null && ... |
0fcbd93d-93e8-44a2-b14a-9ad539d3eef8 | 6 | public void mouseDragged(MouseEvent e ) {
if( fGrowBase != null ) {
Point loc = fComponent.getLocationOnScreen();
int width = Math.max(2, loc.x+e.getX() - fGrowBase.x);
int height= Math.max(2, loc.y+e.getY() - fGrowBase.y);
if( e.isShiftDown() && fImage!=null ) {
float imgWidth = fImage.getWidth(this... |
d403c07b-8a2e-48bf-9b73-a31d50bffde8 | 3 | public String reverseWords(String s) {
String[] list = s.split(" ");
String result = "";
for(int i = list.length-1 ;i >= 0 ;i--){
if(!list[i].equals("") )
result = result+ list[i]+" ";
}
if(result.length() > 0)
return result.substring(0,re... |
5fbadc56-804b-452c-b9d7-b1893cf020ae | 7 | public void initTransitionSystem(GuideUserHistory history) throws MaltChainedException {
this.actionContainers = history.getActionContainerArray();
if (actionContainers.length < 1) {
throw new ParsingException("Problem when initialize the history (sequence of actions). There are no action containers. ");
}
i... |
71ccfae9-479c-4edb-bdf5-00645d4ee79c | 9 | public Parameter getLiblinearParameters() throws MaltChainedException {
Parameter param = new Parameter(SolverType.MCSVM_CS, 0.1, 0.1);
String type = liblinearOptions.get("s");
if (type.equals("0")) {
param.setSolverType(SolverType.L2R_LR);
} else if (type.equals("1")) {
param.setSolverType(SolverType.... |
b039e435-7fe6-4fd6-a145-a614c23496ef | 5 | private void situationalInfluenceUpdate()
{
//array to hold each stakeholder's numerator value
double[] stakeholderNumerators = new double[Stakeholders.size()];
double stakeholderDenominator = 0;
//tally up each stakeholder's list of relationships
for (int i = 0; i < Stake... |
529cf547-5f26-4a92-9772-4789e17fea04 | 1 | public void testFactory_FromCalendarFields() throws Exception {
GregorianCalendar cal = new GregorianCalendar(1970, 1, 3, 4, 5, 6);
cal.set(Calendar.MILLISECOND, 7);
TimeOfDay expected = new TimeOfDay(4, 5, 6, 7);
assertEquals(expected, TimeOfDay.fromCalendarFields(cal));
try {
... |
a45ad1c8-5eed-4679-91a9-e1daa38069bb | 5 | public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int f = 0;
d: do {
int s = scan.nextInt();
if (s == 0)
break d;
int[][] m = new int[s][s];
for (int i = 0; i < m.length; i++)
for (int j = 0; j < m.length; j++)
m[i][j... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.