method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9433a7d2-fcd1-42c9-9721-2c0a38288285 | 3 | public void mainAction()
{
ship s = getShipToRecieveAction();
ship f = getShipToPerformAction(); //this is the ship that has all the hardpoints.
//When the ship is recieved from this function, say if player1 has basicShip, does it return it as a basicship?
for(hardpoint h: f.returnHa... |
d1218cd0-6f39-4d11-a114-d401dd383e01 | 9 | public List<WatchableObject> convert(List<WatchableObject> list) {
Iterator<WatchableObject> itel = list.iterator();
List<WatchableObject> newList = new ArrayList<WatchableObject>();
List<Integer> sentValues = new ArrayList<Integer>();
boolean sendAllCustom = false;
while (itel.h... |
445a9a7b-7ef1-4fe1-ac1e-94ecb49d2b3f | 1 | public void setBackRightTrim(int backRightTrim) {
this.backRightTrim = backRightTrim;
if ( ccDialog != null ) {
ccDialog.getTrim4().setText( Integer.toString(backRightTrim) );
}
} |
13f6da43-2e47-4f5d-9daf-6fb7427693f2 | 2 | public Expression negate() {
if (!allowsNaN || getOperatorIndex() <= NOTEQUALS_OP) {
setOperatorIndex(getOperatorIndex() ^ 1);
return this;
}
return super.negate();
} |
ca5e5f6b-27c4-47c4-823f-c17a6c0e32f6 | 0 | public Individual getIndividual(OntModel model) {
return model.createIndividual(getUri(), OWL.Thing);
} |
b1c9e6b6-dd9d-4007-9f2b-ec1b88581e00 | 4 | private void del(Args args) throws IOException{
//根据autoCodeConfig中的配置,调用coder生成代码
AutoCodeConfig config = AutoCodeConfig.loadConfig(args);
if(args.getOptions() == null || args.getOptions().size() <= 0){
throw new RuntimeException("options is empty");
}
if(args.getO... |
dc585518-27eb-4af1-b171-7ad4eb114352 | 8 | private ArrayList<Coordinate> getAvailableMoves() {
boolean test = false;
if (test || m_test) {
System.out.println("ConnectFourAI :: getAvailableMoves() BEGIN");
}
ArrayList<Coordinate> list = new ArrayList<Coordinate>();
if (getYourTurn()) {
for(int x = 0;x<GAME_WIDTH;x++){
for(i... |
1f1f9540-b385-40a0-8f83-d4b877a6db65 | 3 | @Command(command = "kick",
arguments = {"target player[s]"},
description = "kicks the target player[s] for a given reason",
permissions = {"kick"},
consoleOnly = true)
public static boolean kickFromConsole(CommandSender sender, String targetPlayer) throws EssentialsCommandException {
// get a list of all... |
2f3f43d1-cb69-4e43-b3cd-03854bb1719a | 6 | public short notify_to_deinitialize()
{
if (t.isAlive())
{
try
{
exit.set(true);
// Sleep so that the worker thread can write the the rest messages to the device
Thread.sleep(100);
String debug_msg = "Notify the worker thread it's going to die...";
MsgDumperCmnDef.WriteDebugSyslog(__FILE__()... |
a24a8609-13a6-4fe3-a09d-9f12479fb5d0 | 0 | @Deprecated
public void doSomething()
{
System.out.println("Do Something !");
} |
09cf9e14-8ba8-4865-b44b-29629da8ae22 | 9 | public boolean attributeNameIsLessOrEqual( final AttributeGroup attributeGroup, final CellKey key) {
int lastIndex1 = -1;
int lastIndex2 = -1;
int index = 0;
int size = Math.min( getNumberOfParts(), key.getNumberOfParts());
while ( index < size) { // also getAttributePartArrayValue != null bzw. key.isSuperCol... |
772b2482-2071-4449-a273-edf4a278e15d | 6 | private void setSPA_Houston(String cityShopXML){
URL url=null;
if (decisionProcess == null){
if (url_status){//if network file is available
try {
url = new URL (urlStr + cityShopXML);
decisionProcess = new GasDecisionProcess(url, cityShopXML);
startPanel.appendText(">> Received th... |
13bc1eba-3c2a-4e48-851e-9b2c19e06c45 | 0 | public RoomEventObjectResponse(final Boolean success, final String errorMessage, final RoomEvent roomEvent) {
super(success, errorMessage);
this.roomEvent = roomEvent;
} |
bdbb2b78-73b6-4347-9208-0ab42ae102f1 | 4 | @Override
public void channelRead(ChannelHandlerContext handlerContext, Object object) throws Exception {
ByteBuf byteBuf = ((ByteBuf) object);
Channel channel = handlerContext.channel();
try {
switch (this.currentProtocol) {
case HANDSHAKE:
h... |
0ebcc99d-0733-4fe9-9420-199e8f72d0da | 1 | public void run()
{
try
{
try
{
input = new Scanner(socket.getInputStream());
output = new PrintWriter(socket.getOutputStream());
output.flush();
CheckStream();
}
finally
{
socket.close();
}
}
catch (Exception e)
{
System.out.println("error in client run");
System.... |
2b635d87-5080-4284-ae9d-0a639f847486 | 1 | public void render(Graphics g)
{
g.setColor(Color.BLACK);
g.fillRect(0, 0, Main.size.width, Main.size.height);
g.setColor(Color.white);
g.setFont(new Font(Font.SANS_SERIF, 2, 70));
int cX = x;
g.drawString(credits[0], Main.size.width/3, cX);
cX +=firstPointD;
g.setFont(new Font(Font.SANS_SERIF, 2, 30))... |
a921928a-1c87-4947-9deb-3aa5640ff6da | 3 | public boolean deleteBarcode(int barcodeLine) {
Path tmpPath = null;
try {
// create tmp file
tmpPath = Files.createFile(Paths.get(path.toString() + ".tmp"));
// read from path, write to tmpPath
try (BufferedReader reader = Files.newBufferedReader(path);
BufferedWriter writer = Files.newBufferedWr... |
36d66f7e-bff5-4d28-9f04-fb4588944710 | 4 | private boolean isOver(MoveResult result){
boolean isGameOver = false;
switch(result){
case BLUE_WINS:
isGameOver = true;
break;
case DRAW:
isGameOver = true;
break;
case RED_WINS:
isGameOver = true;
break;
case OK:
isGameOver = false;
break;
}
return isGameOver;
} |
eeaadc65-8d0a-419c-ac86-ca138f8eb3f5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
P2Identifier other = (P2Identifier) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else if (!name.equals(other.... |
76b38e15-184b-4bc9-b1a5-021b97a3a5cf | 5 | @Override
protected void compute() {
int sortingSize = endIndex - startIndex;
if (sortingSize <= directSortingSize) {
sortDirectly();
} else if (sortingSize == 2) {
compareAndSwap(startIndex, endIndex - 1);
} else if (sortingSize > 2) {
int middleIndex = splitData(startIndex, endIndex);
Li... |
202c8232-96ea-493f-8c4e-535e786a9174 | 9 | private void movePiece(){
System.out.println("Moving an existing piece on the board");
System.out.println("Dest x "+destX_+ " "+destY_);
System.out.println("Preparing to send move to backend");
try {
turn_ = false;
System.out.println("Turn is false");
backend_.me().move(originX_, originY_,... |
de95a7d2-5a51-49e2-b4d0-1af57b1f38c7 | 8 | public void flip(boolean flip) {
if (transFrames != null) {
for (TextureRegion t: transFrames) {
if (t.isFlipX() != flip) {
t.flip(true, false);
}
}
}
if (primaryFrames != null) {
for (TextureRegion t: primaryFrames) {
if (t.isFlipX() != flip) {
t.flip(true, false);
}
}
}
... |
07267f5b-7973-4aaf-8ba5-2426079ed281 | 0 | public Card getRandomCardFromDeck() {
Random rand = new Random();
int random = rand.nextInt(deck.size() - 1);
Card card = deck.remove(random);
deck.trimToSize();
return card;
} |
a8d6f0e7-fb96-4495-8da8-cb195be1caaa | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TransObj other = (TransObj) obj;
if (initTime != other.initTime)
return false;
if (seq != other.seq)
return false;
return ... |
a5d59e98-26ee-472a-8f9d-4b70676475e3 | 7 | public Image rotate(double radians) {
if(radians == 0) return new Image(pixels, width, height);
int x, y, fromX, fromY, toX, toY, transparent = 0x7f007f;
double cosAngle = Math.cos(radians);
double sinAngle = Math.sin(radians);
int[] rotatedPixels = new int[width * height];
for (y = 0; y < height; ... |
1951a70d-d8be-4465-a4aa-7e9932f1dc40 | 3 | public void update() {
if (delay == -1) return;
long elapsed = (System.nanoTime() - startTime) / 1000000;
if (elapsed > delay) {
currentFrame++;
startTime = System.nanoTime();
}
if (currentFrame == frames.length) {
currentFrame = 0;
playedOnce = true;
}
} |
9035de25-4353-407e-bdc1-5a48c7166f81 | 2 | public final ByteBuffer buf()
{
if (buf == null && type != type_lmsg)
buf = ByteBuffer.wrap(data);
return buf;
} |
5a10da54-399d-4513-ace2-b8bbbc87e417 | 3 | private void jButton30ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton30ActionPerformed
String currentServerID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
currentServerID = ((String[]) serverMap.get((Integer) jCom... |
0fc2d989-7e34-4899-80d3-164d337baa11 | 3 | @Override
public Iterable<PlanTicket> filter(Iterable<PlanTicket> source,
TicketPoolQueryArgs args) {
ArrayList<PlanTicket> rs = new ArrayList<PlanTicket>(args.getCount());
Iterator<PlanTicket> iter = source.iterator();
for(int i = 0; i < args.getCount() && iter.hasNext(); i ++)
{
rs.add(iter.next());... |
b99435df-dc18-41ab-91eb-26adf93bb30d | 5 | public void render(IAction action, IContext context, Router router) throws Exception {
JsonExtractor extractor = new JsonExtractor();
ArrayList<String> layoutDependencies =
extractor.getDependencies(context.getRequest().getSession().getServletContext().getRealPath("/") + context.getProperties().... |
f54043ff-2491-4d45-b019-bd61dc672364 | 6 | public static void main(String[] args) throws InterruptedException {
/**
* Now trying to make a fixed number of increments to see how much time it takes with AtomicLong
*/
AtomicLong atomicIncrementer = new AtomicLong();
Runnable increment = () -> {
long numIncrem... |
8cdf2b78-d030-4656-95d2-81d1df5dd1a5 | 8 | public Set<Map.Entry<Short,Float>> entrySet() {
return new AbstractSet<Map.Entry<Short,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortFloatMapDecorator.this.isEmpty();
}
p... |
115e30a4-ac1d-4ed2-b005-0dab87a992ea | 8 | public boolean initialize(String domain,String _rootFolder){
boolean result;
try {
if (!domain.startsWith("/")){
if(domain.startsWith("ccnx:")){
domain = domain.substring(5);
}
}
else{
Log.severe("strings must begin with a / or ccnx:/");
return false;
}
_namespace = Conten... |
b74c22b8-5833-49e7-b222-a786a8d4b938 | 9 | protected void serialize_set(Set<?> set, PrintWriter p, int level)
{
if(!this.setliterals)
{
// output a tuple instead of a set-literal
serialize_tuple(set, p, level);
return;
}
if(set.size()>0)
{
p.print("{");
Collection<?> output = set;
if(this.indent)
{
// try to sort the set
... |
351c81a6-6a67-4d06-b8da-0c9cb954aa62 | 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... |
cf11fa81-78c6-4544-83ea-671889130668 | 9 | public static void mixer_play_streamed_sample_16(int ch, ShortPtr data, int len, int freq) {
int/*UINT32*/ step_size, input_pos, output_pos, samples_mixed;
int mixing_volume;
/* skip if sound is off */
if (Machine.sample_rate == 0) {
return;
}
mixer_channel[... |
b1d601bd-a4d9-46de-bec8-e6f6199a4df6 | 7 | public static Graph createGraph(int vertexCount, boolean isUndirected) {
Graph g = new Graph();
int r = RandomGenerator.generateRandom(1, 1000); // to bring some randomness into indices
for (int i = 1; i <= vertexCount; i++) {
g.addVertex(i + r);
}
for (Vertex tailVe... |
f053104b-0fb3-45f3-a990-47ddd9c2c713 | 2 | public void performCSE() throws Exception {
Instruction i = dominating;
while(i != null) {
if(this.isCommonSubexpression(i)) {
this.delete(i.getSubstitute());
return;
}
i = i.dominating;
}
} |
2ba79e7f-db6c-4e23-8706-604a314e6ec0 | 7 | public int iterativeChop(int target, int[] dataSet) {
boolean notFound = true;
int result = -1;
int relativePosition = 0;
if(dataSet.length == 0) {
return result;
}
while(notFound) {
int arrayLength = dataSet.length;
int arrayMiddle = arrayLength/2;
int middleValue = dataSet[arrayMiddle];
... |
951fb1d8-7247-4a1f-92eb-3fdcc4057a53 | 4 | public List<MessageResponse> sendMessage(Message message) throws MalformedURLException, IOException {
URL obj;
List<MessageResponse> responseList = new LinkedList<>();
if (session_mode) {
obj = new URL(URL + "sendmsg?session_id=" + session_id + "&to=" + message.getDestinationAddress... |
3503bd41-7797-4231-98e7-7ea522c2a1d7 | 7 | public static CoordinateMatrix cube(Coordinate center, Double size, Double step)
throws LengthException{
Coordinate d1 = null, d2 = null, d3 = null;
int numberOfRows = 4;
int numberOfColumns = (int) Math.ceil(Math.pow(size / step, 3));
if (center.getLength() != numberOfRows) {
... |
0fa4f962-eae3-476e-ab1f-6a0fb01d9843 | 4 | public void applyCluster(String fileInput, String fileOutput) {
try {
BufferedReader in = new BufferedReader (new FileReader(fileInput));
PrintWriter out = new PrintWriter(fileOutput);
String line;
String[] lineArray;
int countLine = 0;
while ( ( line=in.readLine() ) != null ) {
countLine++;
... |
7f9b0e0e-c5fb-4ea5-8b68-b829f285cd98 | 2 | public boolean canContinue() {
boolean cont = false;
if (containsUnderscores()) {
cont = true;
}
if (getWrongLettersSize() == 6) {
cont = false;
}
return cont;
} |
0adb95db-2583-43fb-ae9a-92170c39fde4 | 8 | private void doQueryRound(int n, int range)
{
Future<RPCMessage> futureReply;
int i=0;
int rangeCounter=1;
Iterator<Contact> it = shortList.iterator();
Contact c;
while (it.hasNext() && rangeCounter <= range && i < n)
{
c = it.next();
//if c is unprobed and it is not the local node then que... |
7c744002-acd3-4ff7-a03c-8fddb72b5589 | 7 | void validateNoInterveningTiles(
int fromX, int fromY, int toX, int toY) throws IllegalMoveException
{
if (fromX == toX) {
// Check Y-axis
for (int y = Math.min(fromY, toY) + 1; y < Math.max(fromY, toY); y++) {
Tile interveningTile = getTile(fromX, y);
if (interveningTile != null)... |
e1ead073-fa95-49e2-9225-c235c0af6efe | 0 | public String getAge() {
return age;
} |
805400b9-c18d-461f-a98d-113187c08c1d | 5 | private void handleStateEvent(StateUpdateEvent event) {
switch (event.getDetail()) {
case END_OF_SPLASH:
switchState(this.menuState);
break;
case QUIT_SELECTED:
switchState(this.endState);
break;
case SINGLE_PLAYER_SELECTED:
switchState(this.singlePlayerState);
break;
case TWO_PLAYER_SEL... |
3ed64bef-4268-475a-9515-d57e209515f2 | 1 | public final boolean equals(Object object) {
return object == null || object == this;
} |
4f1eb714-8194-44a5-a3fe-4abd2c8ea279 | 6 | private Polynomial xgcd(Polynomial polynomial1, Polynomial polynomial2, Polynomial a, Polynomial b) {
if (polynomial2.getSize() > polynomial1.getSize()) {
//swap
Polynomial swapPoly = polynomial1;
polynomial1 = polynomial2;
polynomial2 = swapPoly;
swa... |
eb5b6d2a-1a10-4eab-afa2-373d2c0413db | 0 | public void paint(Graphics g)
{
super.paint(g);
g.drawImage(goBackground.getImage(), 0, 0, 515, 585, this);
} |
fd10a828-76fe-4090-a0f1-82434c0f473c | 7 | @SuppressWarnings("unchecked")
public void readObjectFile(String fn) throws IOException{
this.setFilename(fn);
File file = new File(filename);
if (file.exists())
{
try
{
f = new FileInputStream(file);
o = new ObjectInputStream(f);
try
{
do
{
objectlist.add((E) o.re... |
fc53f845-274f-46f6-8f30-fd9b4b657c18 | 0 | public GUI() {
//setting sizes
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
int screenWidth = (int) 700;
int screenHeight = (int) 200;
setSize(screenWidth,screenHeight);
//setting elements
c=this.getContentPane();
c.setLayout(new GridLayout(2,2));
memo=new JTextArea(20,60... |
d4cb2196-647f-4a74-a6e8-98e324680fe3 | 9 | public void func_73800_i(int par1)
{
int i = text.length();
if (par1 > i)
{
par1 = i;
}
if (par1 < 0)
{
par1 = 0;
}
selectionEnd = par1;
if (fontRenderer != null)
{
if (field_73816_n > i)
... |
10992e29-a24c-431b-ba3f-c5e595a7dd76 | 2 | public boolean equals(final Object o) {
if (!(o instanceof Method)) {
return false;
}
Method other = (Method) o;
return name.equals(other.name) && desc.equals(other.desc);
} |
3ceb2b16-69ff-42fd-8f21-cc7d4a125d6a | 7 | private void readValues(Stream buffer) {
do {
int i = buffer.getUnsignedByte();
if (i == 0) {
return;
}
if (i == 1) {
configId = buffer.getUnsignedShort();
anInt649 = buffer.getUnsignedByte();
anInt650 = buffer.getUnsignedByte();
} else if (i == 10) {
buffer.getString();
} else i... |
e64a4d29-95e9-4af2-bc4f-30a5af174bdf | 8 | public Node getFrom(Status d){
Node n;
switch(d){
case up:
n=new Node(this.x-1,this.y);
if(n.IsValid())
return n;
break;
case down:
n=new Node(this.x+1,this.y);
if(n.IsValid())
return n;
break;
case left:
n=new Node(this.x,this.y-1);
if(n.IsValid())
return n... |
433a48e9-15ac-408d-be46-0cd4bd2554b1 | 2 | public int deleteProvince(String worldName, int chunkX, int chunkZ) {
String SQL = "DELETE FROM `Monarchy_Provinces` WHERE `world` = ? AND `x` = ? AND `z` = ?;";
int success = 0;
try {
Connection con = getSQLConnection();
PreparedStatement statement = con.prepareStatement(SQL);
statement.setString(1, w... |
54fd7131-6207-4c91-8046-eb93176996e9 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.... |
06f7f1fc-9c8a-4b42-bb18-aaa71ec4c0d3 | 2 | public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.set("opt-out", ... |
ac921866-696b-4a6b-9af2-99a18fb625a6 | 2 | public Module getModule(String name){
for(Module mod : modules){
if (mod.getName().equalsIgnoreCase(name)){
return mod;
}
}
return null;
} |
a0c065be-f616-4e5a-bcf4-c26042ddd2a7 | 1 | *
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public int getArity(CycFort predicate)
throws IOException, CycApiException {
String command = makeSubLStmt(WITH_ALL_MTS,
makeNestedSubLStmt("ari... |
c061ca9c-7b51-4e49-b468-e422cca6e294 | 3 | @Override
public final void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
GameSession session = (GameSession)ctx.getAttachment();
if(e.getMessage() instanceof Message) {
if(session != null) {
synchronized(LogicService.getWorkerThread()) {
Message packet = (Message)e.getMessage();
s... |
57ec951d-4daa-4a2f-b195-4646845f84f6 | 0 | public boolean getIncludeReadOnly() {
return this.includeReadOnly;
} |
354198b1-03cc-4c04-aced-5a403c0aa35a | 1 | @Override
public Bitmap getBitmap() {
try {
checkLoaded();
} catch (IOException ex) {
Logger.getLogger(ProxyImage.class.getName()).log(Level.SEVERE, null, ex);
}
return realImage.getBitmap();
} |
a8c2ea43-e3a2-401d-a30a-5fdb1590a5ab | 5 | @Override
public List<StrasseDTO> findStreetsByStartPoint(Long startPunktId, boolean b) {
List<StrasseDTO> ret = new ArrayList<StrasseDTO>();
if(startPunktId ==1){
StrasseDTO s= new StrasseDTO();
s.setStartPunktId(Long.valueOf(1));
s.setEndPunktId(Long.valueOf(2));
// s.setStartPunktName("s"... |
585280bb-0dc8-41ba-b503-1948fcbe2511 | 2 | private void handleInput() {
if (Keys.isPressed(Keys.ESCAPE)) {
System.out.println("Paused : Press Escape to un-pause");
gsm.setPaused(false);
}
if (Keys.isPressed(Keys.BUTTON1)) {
gsm.setPaused(false);
gsm.setState(GameStateManager.MENUSTATE);
}
} |
4ceae452-1b23-467f-ad07-05c15811660a | 6 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
n = in.nextInt();
m = in.nextInt();
char[][] A = new char[n][m];
for(int i=0;i<n;i++){
A[i]=in.next().toCharArray();
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(A[i][j]=='.'){
fill(A, i, j, 'W');
... |
754faa31-6229-47e9-91e9-db25f9c60795 | 4 | public static int sumNumbers(TreeNode root) {
if(root == null) return 0;
if(root.left == null && root.right ==null) return root.val;
ArrayList<Integer> list = new ArrayList<Integer>();
countLeft(list, root.left, root.val);
countRight(list, root.right, root.val);
int sum =... |
75d10d20-b58a-416f-bdbb-ef4f34ed8346 | 9 | public int decimalValue()
{
decimal = 0;
for(int i=0; i<roman.length(); i++)
{
if(roman.charAt(i) == 'I' && roman.length() > 1)
decimal++;
else if(roman.charAt(i) == 'V')
decimal += 5;
else if(roman.charAt(i) == 'X')
decimal += 10;
else if(roman.charAt(i) == 'L')
decimal += 50;
else... |
ba90fd06-2228-4dd1-b643-3935cf99d4b5 | 5 | public void keyPressed(int k) {
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_UP) player.setUp(true);
if(k == KeyEvent.VK_DOWN) player.setDown(true);
if(k == KeyEvent.VK_Z) player.setPummeling();
} |
14999285-4dd5-4e48-9770-0961bbe43333 | 5 | public void addInfo(Site s) {
content[0] = "Individual Ranking";
content[1] = " id\t" + "strat\t" + "score / games (average)" ;
if (agents.length < 10) {
for (int i = 0; i < agents.length; i++) {
int num = i + 1;
content[(i + 2)] = num + ". " + agents[i].getRanking();
setColor(i);
... |
ee360288-cb4c-452f-88c3-9e1f3960bf76 | 6 | private boolean processAdminCommand(MapleClient c, MessageCallback mc, String[] splitted) {
DefinitionAdminCommandPair definitionCommandPair = admincommands.get(splitted[0]);
if (definitionCommandPair != null) {
try {
definitionCommandPair.getCommand().execute(c, mc, splitted... |
eae46902-b9b7-4e42-a5db-dacc329efd3f | 9 | private void executeInternal(InputStream in,OutputStream out, Integer sessionId,Integer userId) throws OctetServerException {
try {
parse(in);
// check for errors from the XML parser
if (errorLevel > NONE) throw new OctetServerException(0, errorMsg);
... |
8c3162be-c13d-4b75-ad4b-3ea803a7dab9 | 6 | public void update() {
int stage = getStage();
if (stage == 0) {
player.getAppearence().switchHidden(); // hides player
} else if (stage == 1)
player.getCutscenesManager().play("HomeCutScene");
else if (stage == 2) {
player.getInterfaceManager().sendInterface(1079);
player.setCloseInterfacesEvent(ne... |
7a93f7a1-0440-4a14-8379-f701823bf460 | 4 | private int getNextPossibleNumber(int[][] game, int x, int y, List<Integer> numbers) {
while (numbers.size() > 0) {
int number = numbers.remove(0);
if (isPossibleX(game, y, number) && isPossibleY(game, x, number) && isPossibleBlock(game, x, y, number))
return number;
... |
87e65894-cbe9-4636-91c1-a65ebae8fc4a | 6 | public static void render(float x, float y, float z, double color1, double color2, double color3) {
Boolean top= true, down= true, back= true, front= true, left= true, right = true;
/*for (Chunk chunk : ChunkManager.LoadedChunksList) {
for (Block block : chunk.BlocksList) {
i... |
d326d659-6f77-4c72-a1d1-c3dbfe559e60 | 2 | public void putIfNone(String oldname, String newname) {
if (oldname == newname)
return;
String oldname2 = toJvmName(oldname);
String s = (String)get(oldname2);
if (s == null)
super.put(oldname2, toJvmName(newname));
} |
67a47e53-1aa0-4a62-9780-b11dbb0453db | 1 | public T getNext(){
if (it.hasNext()) {
same = (T) it.next();
return same;
} else {
return null;
}
} |
76cee436-64f0-49dc-b788-2a17b561d2e4 | 2 | public AIConnection sendGamestate(int roundNumber){
AIConnection playerTurnOrder[] = playerSelector.getListInTurnOrderAndMoveToNextTurn();
String matrix[][] = world.returnAsRowMajorMatrix();
if(roundNumber != 0){
playerTurnOrder[0].clearAllMessages();
}
graphicsContainer.get().sendGamestate(roundNumber, worl... |
a9fd80e9-857e-481f-8127-f0cea18f7339 | 3 | static int getClock(boolean opponent) {
if (opponent) {
if ("black".equals(Engine.color)) {
return whiteClock;
} else {
return blackClock;
}
} else if ("black".equals(Engine.color)) {
return blackClock;
} else {
... |
63ef067b-a51a-4d19-bdf3-6c80ae0f4e29 | 9 | public ArrayList<Integer> top_features_overall(int num,ca_table t1,ca_table t2)
{
int[] t1_totals=new int[t1.columns()];
int[] t2_totals=new int[t1.columns()];
int[] t1_totals_copy=new int[t1.columns()];
int[] t2_totals_copy=new int[t1.columns()];
for(int i=0;i<t1.columns();i++)
{
t1_totals[i]=t1.colum... |
60d91087-490a-4843-86ab-f73e025bb77e | 1 | private JLabel getLblArtistName() {
if (lblArtistName == null) {
lblArtistName = new JLabel("Artist name :");
lblArtistName.setBounds(10, 17, 86, 14);
}
return lblArtistName;
} |
b6e9dcff-e4e7-4216-b888-8ea894a09925 | 2 | private void initComponents() {
selectUserLbl = new JLabel();
userListScrollPane = new JScrollPane();
userListTable = new JTable();
addNewUserLbl = new JLabel();
userNameTextField = new JTextField();
selectUserBtn = new JButton();
backBtn = new JButton();
... |
997912a1-e89a-4afd-9de9-554c7299ac0d | 0 | @Test
public void success() {
} |
ee1293f9-fc5c-4b71-8293-380440b5b7c9 | 6 | public float[] toRGB(float[] cmykValues) {
//System.out.println("CMYK: " + cmykValues[0] + " " + cmykValues[1] + " " + cmykValues[2] + " " + cmykValues[3]);
/*
float c = 1.0f - cmykValues[0];
float m = 1.0f - cmykValues[1];
float y = 1.0f - cmykValues[2];
float k = cmykValues[... |
13735209-9bbc-4cf4-acae-ceb85b0b33d6 | 9 | @Override
public void run() {
while(running){
float onStart = System.currentTimeMillis();
if(player.meleeCounter==0){
player.meleeReady = true;
}else if(player.meleeCounter > 0){
player.meleeCounter--;
}
collisionDetect();
theEnemies = new CopyOnWriteArrayList<Enemy>(enemylist);
for(... |
16e7ed23-1d73-48f9-b849-31039a5069d6 | 1 | public List<String> getLinks() {
Pattern pattern = Pattern.compile("(?i)(?s)<\\s*?a.*?href=\"(.*?)\".*?>");
Matcher matcher = pattern.matcher(content);
List<String> list = new ArrayList<String>();
while (matcher.find()) {
list.add(matcher.group(1));
}
return list;
} |
e9a2399a-e751-4c0f-b8de-32c8d9452b76 | 9 | @Override
public long solve() {
final SortedSet<Integer> set = new TreeSet<Integer>();
for (int a = 2; a <= 100; a++) {
boolean found = false;
for (int x = 2; x <= Math.sqrt(a) && !found; x++) {
for (int y = x * x, i = 2; y <= a && !found; y *= x, i++) {
... |
e2520d7d-5820-49c1-9d5c-bc1beb98a701 | 7 | private synchronized void sendPacket()
{
if (packetList_ == null || packetList_.isEmpty() == true) {
return;
}
// submits the first packet in the list
Packet np = (Packet) packetList_.remove(0);
boolean ping = false; // a flag to determine ping packet or not
... |
e9cec86a-673c-412b-bc33-25e5da7ff47e | 1 | public List<Juoma> haeJuomat() throws DAOPoikkeus {
List<Juoma> juomat = new ArrayList<Juoma>();
// haetaan hörpyn tiedot tietokannasta
try {
JuomaDAO jDao = new JuomaDAO();
juomat = jDao.haeJuomat();
} catch (DAOPoikkeus e) {
throw new DAOPoikkeus("Juomien hakeminen tietokannasta ei onnistun... |
1dacc13a-0134-4a44-81dd-5f62651dca4f | 9 | public static HashMap<String,Course> parseUserInput(String fileLocation){
// Initialize instructor list and null string.
courseMap = new HashMap<String,Course>();
String line = null;
// Open a buffered/file reader to read the input file.
try {
BufferedReader br = new BufferedReader(new FileReader(System.g... |
8a36923b-a6e0-4c0b-a484-8bc330e68cb9 | 7 | public boolean conflict(int row, int col, int val) {
//System.out.println("Looking for conflict at: ("+row+","+col+") with value: "+val);
for (int k = 0; k < 9; ++k) {
if (val == board[k][col].getValue()) {
return true;
}
}
for (int k = 0; k < 9; ... |
cd634a8c-0357-40d9-a2a4-c2eb0d0ce1da | 0 | public Query(BST tree){
this.tree = tree;
totalDocuments = WebPages.getDocCount();
} |
a3054d39-1e12-4e38-924f-47a3fc4a57c3 | 7 | private boolean decideToAddPassantTile(Board b, ArrayList<PossibleTile> pts, PossibleTile pt) {
if (!checkBounds(pt.getX(), pt.getY())) {
return false;
}
PossibleTile ps;
if (isWhite) {
ps = new PossibleTile(pt.getX(), pt.getY() - 1, pt.getOriginalPiece());
} else {
ps = new PossibleTile(pt.getX(), p... |
f5945661-7d1c-49a8-bd90-da325878c302 | 2 | public EncryptedHand requestDecryptHand(EncryptedHand encHand,
final User usr) throws InvalidSubscriptionException, IOException,
InterruptedException {
final Subscription encSub = elvin.subscribe(NOT_TYPE + " == '"
+ DECRYPT_HAND_REPLY + "' && " + GAME_ID + " == '"
+ gameHost.getID() + "' && " + REQ_US... |
e3740f30-6a52-45c0-8496-5cf24a9305c2 | 5 | public void testSafeMultiplyLongLong() {
assertEquals(0L, FieldUtils.safeMultiply(0L, 0L));
assertEquals(1L, FieldUtils.safeMultiply(1L, 1L));
assertEquals(3L, FieldUtils.safeMultiply(1L, 3L));
assertEquals(3L, FieldUtils.safeMultiply(3L, 1L));
assertEquals(6L, ... |
a2e4d73a-8711-46c5-a99e-766f8a5f7825 | 9 | @Override
protected boolean doSecondPhase(String query, Configuration conf, String outputPath, String[] table,
String[] filter_table, int numberOfReducer) {
try {
List<String> dimension_talbe = new ArrayList<String>();
dimension_talbe.add(TABLE_CUSTOMER);
dimension_talbe.add(TABLE_DATE);
dimension_tal... |
85708cc5-acf4-4d9e-8316-f700b81ee837 | 7 | void getValue() {
String methodName = "get" + nameCombo.getText();
getText.setText("");
Widget[] widgets = getExampleWidgets();
for (int i = 0; i < widgets.length; i++) {
try {
java.lang.reflect.Method method = widgets[i].getClass().getMethod(methodName, null);
Object result = method.invoke(widgets[i... |
21ba43f8-ce70-4380-8238-33d487b8b21c | 6 | public static double expectedEntropy(int featureIndex, List examples) {
{ double e = 0.0;
int numExamples = examples.length();
int p = 0;
int n = 0;
{ TrainingExample example = null;
Cons iter000 = examples.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest... |
f3d35f7a-ba98-4f0a-9259-b308d6e98210 | 4 | public int getTopSolidOrLiquidBlock(int var1, int var2) {
Chunk var3 = this.getChunkFromBlockCoords(var1, var2);
int var4 = 127;
var1 &= 15;
for (var2 &= 15; var4 > 0; --var4) {
int var5 = var3.getBlockID(var1, var4, var2);
Material var6 = var5 == 0 ? Material.ai... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.