method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7b16347a-1f33-4596-aea9-7d4c7db56028 | 1 | public boolean removeOpenFormat(String formatName) {
int index = indexOfName(formatName, openerNames);
if (index >= 0) {
openerNames.remove(index);
openers.remove(index);
// Also remove it from the list of formats stored in the preferences
Preferences.FILE_FORMATS_OPEN.remove(index);
return t... |
48e105d1-e306-4bdb-9930-1fbf4f7849e9 | 7 | private List<PseudoSequence> buildProjectedDatabase(Integer item, List<PseudoSequence> database, Set<Integer> sidset, boolean inPostFix) {
// We create a new projected database
List<PseudoSequence> sequenceDatabase = new ArrayList<PseudoSequence>();
// for each sequence in the database received as parameter
fo... |
e6f4bee8-0467-48b7-86fd-78deaece224e | 9 | public static int getTreeHeight(ParserNode node, int symbolSize) {
if (node.isVar())
return 0;
int height = 0;
List<ParserNode> children = node.getChildren();
int childrenSize = children.size();
if (childrenSize == 1) {
// Ako čvor ima samo jedno dijete, stablo je visoko koliko je
// visoko i podst... |
e60344a7-9803-49ac-b8bc-3f5494e1cf84 | 4 | private List<Integer> findSharedUsers(int movie1, int movie2) {
List<Integer> sharedUsers = new ArrayList<Integer>();
HashSet<Integer> movie1Raters = usersByMovie.get(movie1);
HashSet<Integer> movie2Raters = usersByMovie.get(movie2);
// Return empty list if one user didn't rate any movies
if (movie1Raters ==... |
73b36d98-b1fb-4837-b5f8-c0e5a5cf70c3 | 3 | public static void removeAllBorders()
{
if (!borderEnabled()) return;
for(CircleMarker marker : roundBorders.values())
{
marker.deleteMarker();
}
roundBorders.clear();
for(AreaMarker marker : squareBorders.values())
{
marker.deleteMarker();
}
squareBorders.clear();
} |
859a1bc8-e8e2-4f1a-8bc2-c6c792f553c5 | 5 | public void addCourse(String name, String course) {
/* search entire tree, if found, add course */
StudentNode currentStudent = root;
StudentNode preNode = null;
/* empty tree */
if (root == null) {
StudentNode newNode = new StudentNode(name);
newNode.courses.add(course);
root = newNode;
numStude... |
86d88f50-6c64-4f4a-8dd1-0a33b8ffc4a9 | 3 | public User login(String userName, String password) {
ArrayList<User> lista = (ArrayList<User>) userList.getUserList();
for (User us : lista) {
if (userName.equals(us.getName())
&& password.equals(us.getPassword())) {
return us;
}
}
return null;
} |
bd87b22a-d982-48e3-94f6-187409e3ffcd | 8 | final Class258_Sub3 method3467(int i, int i_4_) {
anInt4357++;
Object object = aClass60_4361.method583((long) i, -127);
if (object != null)
return (Class258_Sub3) object;
if (!aD4359.method4(-7953, i))
return null;
TextureDefinition class12 = aD4359.getTexture(i, -6662);
int i_5_ = (!((TextureDefinition... |
915fc64f-d653-4d16-a362-43dd769e7f99 | 8 | public static Phasor parsePhasor(String ss){
Phasor ph = new Phasor();
ss = ss.trim();
int anglePos = ss.indexOf('<');
if(anglePos==-1){
anglePos = ss.indexOf('L');
if(anglePos==-1)throw new IllegalArgumentException(... |
6128fabd-7fa6-4c5c-aae9-c71ddc654b84 | 5 | public void moveOwl() {
if (move != null){
if (move.getWhere() == 0){
x += 10;
} else if(move.getWhere() == 1){ //vasen
x -= 10;
}else if (move.getWhere() == 2){ //alas
y += 10;
} else if (move.getWhere() == 3) { //y... |
ccfe0a24-2217-44a8-acac-2d3b517afe31 | 6 | private AbstractResource findResource
(String resName,
String resID,
String packageName) {
// Find the correct package
for (ARSCFileParser.ResPackage pkg : this.resourcePackages) {
// If we don't have any package specification, we pick the app's default package
boolean matches = (packageName == null ... |
da597847-9d86-4867-9c54-993f944b2b86 | 6 | public String getDescription()
{
if ( fullDescription == null )
{
if ( description == null || isExtensionListInDescription() )
{
fullDescription = description == null ? "(" : description + " (" ;
// build the description from the extension list
Enumeration extensions = filt... |
eee42f05-a9e8-4d2a-a46a-ba488504d1f2 | 2 | public double newPurchase(){
Random r = new Random();
if (marketStrength == 0)
marketStrength += .01;
double marketEffect = marketStrength * beta + stockStrength; // strength less than one causes decrease in price, beta exaggerates/ mitigate's market's effect
double d = r.nextDouble() * volatility * marketEffe... |
e6530309-d9b8-4fec-9a49-e9a1cc179801 | 8 | private void message(String user_name, CommandArgsIterator args_it)
throws IOException
{
if (args_it.hasNext()) {
String dest = args_it.next();
String message = args_it.remainder();
if (dest.length() >= 1 && !message.isEmpty()) {
... |
fc3aec90-0bf2-4add-a89a-9920e7eeeeb3 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Circuit circuit = (Circuit) o;
if (eRank != null ? !eRank.equals(circuit.eRank) : circuit.eRank != null) return false;
if (hRank != null ? !hRa... |
74b1e7e7-2033-46ea-acda-620f5e314b41 | 0 | protected void setOutput(String output)
{
((MooreMachine) to.getAutomaton()).setOutput(to, output);
} |
2af4001b-b30d-4888-99d5-b5a494c3b8b8 | 1 | public static double informationGainRatio(String attribute,
ArrayList<HashMap<String, String>> examples,
HashMap<String, String[]> attributeValues, String goalAttribute) {
double iv = intrinsicValue(attribute, examples, attributeValues);
if (iv == 0) {
return 1;
}
return informationGain(attribute, exam... |
492378cc-719c-461c-885e-ec77842300fc | 2 | public DonneeArgos ( String numBalise, String precision,
String date, String heure,
String latitude, String longitude ) {
this.numBalise = numBalise;
this.precision = precision;
int annee = 0;
int mois = 0;
int jour... |
c56fd9eb-b5a1-48a2-8605-7cc72adfd82d | 3 | private void sendMessage(String text)
{
// Due to chunk generation eating up memory and Java being too slow about GC, we need to track memory availability
int availMem = Config.AvailableMemory();
Config.Log("[Fill] " + text + " (free mem: " + availMem + " MB)");
if (notifyPlayer != null)
notifyPlayer.sendM... |
9d20002a-5e53-46dc-9d7f-806c3b1cdc41 | 4 | @Override
public boolean equals(Object obj) {
if (super.equals(obj)) {
StringTag o = (StringTag) obj;
return ((data == null && o.data == null) || (data != null && data.equals(o.data)));
}
return false;
} |
08d8c095-423c-4eaa-8544-64508e9d048e | 8 | private void TfCodProdutoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TfCodProdutoKeyReleased
if (!TfCodProduto.getText().equals("")) {
prodcompravenda.getForneproduto().getProduto().setCodigo(Integer.parseInt(TfCodProduto.getText()));
if (!TfCodFornecedor.getText().equals... |
ac09d370-6e96-4605-a9e8-f663699aa7d7 | 4 | public static int firstPrimeAfter(int n) {
for(int i = n + 1; i > n; ++i) {
int factors = 0;
for(int j = 1; j < (i + 2) / 2; ++j) {
if((i % j) == 0)
factors++;
}
if(factors < 2) {
return i;
}
... |
693589f0-ff71-49c5-a622-d44bd2aea367 | 3 | public String getOneChapterContent(String ver, String bookChapter) throws ParseException, IOException {
Path file = Paths.get("/home/mark/bible/content/" + ver + "/" + bookChapter + ".htm");
StringBuilder sb = new StringBuilder();
Charset charset = Charset.forName("US-ASCII");
if (ver.e... |
d4367227-5e42-49ff-a69c-6616f7f4dbf6 | 6 | public static boolean isTrue(String s) {
if (s == null || s.length() == 0) {
return false;
}
char c = s.charAt(0);
return c == 't' || c == 'T' || c == 'y' || c == 'Y' || c == '1';
} |
d805cf84-f8d8-47d7-b618-c8fa836caf28 | 7 | public void paintGameObjects(Graphics2D g) {
if(instructions) {
g.setColor(Color.WHITE);
g.setFont( displayFont );
g.drawString("Player One Uses Arrow Keys.", 20, SCREEN_HEIGHT/4);
g.drawString("Player Two Uses WASD.", 20, SCREEN_HEIGHT/2);
g.drawStrin... |
fd92001e-18b6-478d-9c1e-7197abc6f02d | 4 | public void setQuery(String q)
{
tmp = new Vector<String[]>();
try
{
ResultSet rs = statement.executeQuery(q);
ResultSetMetaData meta = rs.getMetaData();
columns = meta.getColumnCount();
headers = new String[columns];
for (int i = 1; i <= columns; i++)
headers[i - 1] = meta.getColumnName(i);
... |
959d14c0-bfc1-4f18-ba88-303997f91f91 | 4 | public static List<Weapon> parseWeapons(File f){
List<Weapon> weapons = new ArrayList<>();
try {
Scanner sc = new Scanner(f);
while(sc.hasNextLine()){
String line = sc.nextLine();
String[] content = line.split(",");
String name = content[0];
String dmgDice = content[1];
String profBon... |
2a897f96-5634-460a-851c-9357823235b3 | 0 | private int getIntBigEndian(byte[] a, int offs) {
return
(a[offs] & 0xff) << 24 |
(a[offs + 1] & 0xff) << 16 |
(a[offs + 2] & 0xff) << 8 |
a[offs + 3] & 0xff;
} |
31ff7fa7-db8b-40df-a95c-8b1e9fee1391 | 5 | @POST
@Path("/createEvent")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createEvent(String jsonObject) {
Gson gson = new GsonBuilder().setDateFormat(WS_DATE_PATTERN).create();
Event event = null;
try {
event = gson.fromJson(jsonObject, Event.class);
} catc... |
fcbf7ee8-40fc-4950-a68e-81fdf3388547 | 3 | @Override
public Vector substract(Vector vector) throws IllegalArgumentException {
if (this.getFieldsNumber() != vector.getFieldsNumber()) {
throw new IllegalArgumentException();
}
for (int i = 0; i < getFieldsNumber(); i++) {
try {
setElementAt(i + 1, this.getElementAt(i + 1) - vector.getElementAt(i +... |
5d8d11e8-5350-49de-90dc-b504e290fc0c | 3 | private static DetailObject getDetailObject(String language) {
boolean objectFound = false;
DetailObject detailObject = null;
for (DetailObject detailObject1 : SourceScanner.detailObjects) {
if (detailObject1.getLanguage().equalsIgnoreCase(language)) {
objectFound = true;
detailObject = detailObject1;
... |
f88dc896-2e34-47f1-a6a7-70bfee5783ed | 7 | public void drawColored(Bitmap bitmap, int color, int xo, int yo) {
for (int y = 0; y < bitmap.height; y++) {
int yy = y + yo;
if (yy < 0 || yy >= this.height)
continue;
for (int x = 0; x < bitmap.width; x++) {
int xx = x + xo;
if (xx < 0 || xx >= this.width)
continue;
if (bitmap.pixels[... |
f2fbdac0-f317-4edb-8253-00403d57ee5f | 9 | public Causa eliminacionTestigoPorTeclado(){
@SuppressWarnings("resource")
Scanner scanner = new Scanner (System.in);
String texto;
int expediente;
Long dni;
Causa causa = new Causa();
try {
System.out.println("Eliminar Testigo de la Causa");
System.out.println("----------------------------");
w... |
816722a0-aa36-4962-a623-230b1919675d | 6 | public boolean listenSocket() {
try {
server = new ServerSocket(4444);
System.out.println("server running on port 4444");
} catch (IOException e) {
System.out.println("Could not listen on port 4444");
System.exit(-1);
}
//listen for new co... |
c3647a7f-ff4e-4f27-ae49-74f8960b6f2e | 5 | private void cpuLoadNextProcess() {
System.out.println("cpuLoadNextProcess()");
Process p = cpu.startNextProcess();
if (p != null) {
p.updateProcess(CPU_ACTIVE);
long processRemainingTime = p.getRemainingCPUTime();
long maxCpuTime = this.maxCpuTime;
long processNextIO = p.getTimeToNextIoOperation(... |
97745351-4171-4303-9ba8-fee4f0de34ee | 5 | int open_seekable() throws SoundException {
Info initial_i = new Info();
Comment initial_c = new Comment();
int serialno;
long end;
int ret;
int dataoffset;
Page og = new Page();
// is this even vorbis...?
int[] foo = new int[1];
ret = fetc... |
7e697940-3f48-4666-a8cb-c64da2d28b8a | 5 | public HashMap<String, Character> getState() {
HashMap<String, Character> points = new HashMap<String, Character>();
for (int i = 0; i < plateau.length; i++) {
for (int j = 0; j < plateau[0].length; j++) {
if (updates[i][j]) {
System.out.println("Updated");
char sym;
if(plateau[i][j]==nu... |
27daabc6-0986-4562-92db-4f0e29914846 | 9 | public void commandLine() {
while (true) {
System.out.print(">");
command = userInput.nextLine().split(" ");
//String junk = userInput.next();
if (command[0].equals("addplayer")) {
comAddplayer();
} else if (command[0].equals("removeplayer")) {
comRemoveplayer();
} else if (command[0].equals... |
0113a141-81fa-4379-8292-86d7feb8af93 | 8 | private void whereDoIGo(String urlParameter, HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
// URL string for the file the user should be taken to next.
String whereToGo;
// Check if parameter is null, ie, was not supplied
if(urlParameter == null){
urlPar... |
c87fd0a8-0da2-4285-a74a-8374dad83405 | 4 | public static MyList board() {
// generate positions for a square board, and let the
// onBoard() function filter out the wrong positions
MyList boardlist = new MyList();
for (int r = 1; r <= 17; r++) { // for every row
int c = ((r % 2 == 0) ? 2 : 1); // what col to start?
for (; c <= 9; c += 2) {
Hex... |
2fb5cc94-fc1b-4206-91f1-74bb5eb1c4f1 | 6 | public void recuperar() {
FileInputStream fis = null;
ObjectInputStream stream = null;
try {
File arquivo = new File("arquivo.bin");
if (arquivo.exists()) {
fis = new FileInputStream(arquivo);
stream = new ObjectInputStream(fis);
persistencia = (Persistencia) stream.readObject();
}
} catch ... |
21671040-368f-41a9-9527-c6945a5919ae | 4 | public void writeHistory(DataOutput output) {
try {
output.writeInt(VERSION);
sourcePanel.writeHistory(output);
destinationPanel.writeHistory(output);
int comboCount = commandCombo.getItemCount();
Vector commands = new Vector();
for (int i ... |
581260e0-90ca-41b3-b3ed-8b06c876cead | 9 | private static void invokeServiceListenerCallback(Bundle bundle,
final EventListener l, Filter filter, Object acc,
final EventObject event, final Dictionary<String, Object> oldProps)
{
// Service events should be delivered to STARTING,
// STOPPING, and ACTIVE bundles.
if ((bu... |
de39b7fa-a4d7-4adb-8679-2a9ce4759358 | 2 | @Override
public void createFrom(int elementIndex, int numberOfPoints) {
int size = 0;
for(int i = 0; i<numberOfPoints; i++){
size = size + inData.getLength()/numberOfPoints;
Float[] array = new Float[size];
for(int j = 0; j < size; j++ ){
array[j]... |
a50eaf64-5252-430c-a908-13e75aecc96c | 1 | public final void visitTryCatchBlock(
final Label start,
final Label end,
final Label handler,
final String type)
{
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "start", "start", "", getLabel(start));
attrs.addAttribute("", "end", "end",... |
ea593841-5a30-4c29-8c9a-2be16760a602 | 4 | public void tick() {
anim.tick(x, y);
if (Main.getKey("W"))
y -= speed;
if (Main.getKey("S"))
y += speed;
if (Main.getKey("A"))
x -= speed;
if (Main.getKey("D"))
x += speed;
} |
0b8b859a-0784-4722-933f-f6936a2534d2 | 1 | public RegistrationPage getRegistrationPage() {
if (registrationPage == null) {
registrationPage = new RegistrationPage(this);
}
return registrationPage;
} |
3a91f1fa-69d6-49dd-8784-23b1a4fad279 | 1 | public static void setMaxLitterSize(int max_litter_size)
{
if (max_litter_size >= 1)
Grass.max_litter_size = max_litter_size;
} |
53af1a72-601e-472b-9605-50665a5e8732 | 8 | public void changeOrAdd(MindmapLastStateStorage pStore) {
boolean found = false;
for (Iterator it = mLastStatesMap.getListMindmapLastStateStorageList()
.iterator(); it.hasNext(); ) {
MindmapLastStateStorage store = (MindmapLastStateStorage) it.next();
if (Tools.sa... |
9c397073-24a0-43d9-865d-6e214bbc97d8 | 8 | boolean shootAt(int row, int column){
if(this.isSunk()){
return false;
}
if(this.isHorizontal()){
for(int j = 0; j < this.getLength(); j++){
// System.out.println(this.bowRow + "," + this.bowColumn + j);
// System.out.println(row + "," + column);
... |
5eb99584-c73b-433d-9d9a-e78c6c24aed1 | 1 | static public DalcPlaylist getInstance() {
if (m_instance == null) {
m_instance = new DalcPlaylist();
}
return m_instance;
} |
a7708b82-0c7b-45d8-8f8b-c60e123404a8 | 5 | public void train(int maxIter, int windowSize, double initStep, double shrinkage){
int iteration = m_iteration;
// Step 0: output the settings
System.out.println("[Info]LambdaRank configuration:");
System.out.format("\tOptimization Type %s, Lambda %.3f, Shrinkage %.3f, WindowSize %d\n", m_oType, m_lambda, sh... |
f02e91df-d4f5-481d-9d55-2b6701b48f3a | 4 | public int compare(final Delta<?> a, final Delta<?> b) {
final int posA = a.getOriginal().getPosition();
final int posB = b.getOriginal().getPosition();
if (posA > posB) {
return 1;
} else if (posA < posB) {
return -1;
}
return 0;
} |
344c4a3d-c19d-4ac5-84c0-a947502ff451 | 2 | public void saveDefaults() {
if (file == null) {
file = new File(InstaScatter.ins.getDataFolder(), name);
}
if (!file.exists()) {
InstaScatter.ins.saveResource(name, false);
}
} |
458c8a89-3783-45bd-85e0-6fd172c6cf91 | 6 | @Override
public void map(IntWritable key, IntArrayWritable value,
OutputCollector<IntWritable, IntArrayWritable> output, Reporter reporter)
throws IOException {
IntWritable[] xMovie = (IntWritable[]) value.toArray();
Set<Integer> imdbMovie = new HashSet<Integer>();
for(int i =0 ;i<xMovie.length; i++... |
c4046aaf-0ea7-4ca4-89f4-4fb4da8759b8 | 9 | public static void commandHandler(String cmd) throws IOException {
// switch(String) doesn't exist on JDK 6 (only 7)... Resorting to a series of ifelse statments
if(cmd.contains("/query-for-peers")) {
System.out.println("Querying directory server...");
sendToDirectory("QUERY", null, null);
} else if(cmd.con... |
b536bc91-1418-45d4-b69e-214447b287bc | 9 | static final public void MessageSend() throws ParseException {
PrimaryExpression();
jj_consume_token(DOT);
Identifier();
jj_consume_token(LPAREN);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LPAREN:
case NOT:
case FALSE:
case NEW:
case THIS:
case TRUE:
case INTEGER_LITER... |
388dcd3c-1997-4be4-a222-7dfcfad830ee | 3 | public Cookie getUsuarioLogado() {
Cookie[] cookies = this.cookies;
if(cookies == null) return null;
for (Cookie cookie : cookies) {
if(cookie.getName().equals("usuarioLogado")){
return cookie;
}
}
return null;
} |
a79428fa-f241-4476-9101-5bc5d380a490 | 1 | public double calculoCoeficiente(double unPrecio){
if(unPrecio>500){
return(1.35);}
else{ return(1.1);}
} |
1b9e690b-d504-49b9-b86b-598d3b06ae1a | 1 | double[] randomSample() {
double[] sample = new double[n];
for (int i = 0; i < n; i++) {
sample[i] = (lowBound[i] + generator.nextDouble() * (upBound[i] - lowBound[i]));
}
return sample;
} |
e95d22b0-49d6-464f-811f-41e93c259fee | 8 | public synchronized byte[] encode(String str, int size) {
byte abyte0[] = null;
if (size > 0) {
abyte0 = f;
f = new byte[size];
}
g = 0;
h = 0;
int l = str.length();
e += l;
for (int j1 = 0; j1 < l;) {
Integer integer = null;
int i1 = j1 + 1;
Hashtable hashtable = c;
do {
if (j... |
6414a188-1442-4f6f-8ef1-83ec44772610 | 4 | public String toString() {
String equipmentString = "";
int i = 1;
for (Field f : EquipmentSet.class.getFields()) {
if (!f.getType().isPrimitive()) {
try {
equipmentString += i + ") " + f.getName() + ": " + f.get(this) + "\n";
} catch (IllegalArgumentException e) {
} catch (IllegalAccessExcept... |
9be3c000-a29d-4313-869a-b5c94b419564 | 0 | @Override public Iterator<String> iterator() {
return cookies.keySet().iterator();
} |
45afeb21-794f-487c-b768-4a34230a7319 | 4 | public String toString() {
String output = "";
for (int i = 0; i < lists.length; i++) {
if (i <= lists.length && lists[i] != null) {
if (lists[i].toString() != null) {
output += lists[i].toString();
output += "; ";
}
... |
b21c412e-a25b-467b-baed-252bb302f3a7 | 5 | public int getMinJaar()
{
int jaar = 99999;
// Itereer de datasets
for (DataSet set: this.datasets)
{
for (Category cat: set.categories)
{
for (SubCategory scat: cat.subcategories)
{
SubCategory subcat = new SubCategory(scat.id, scat.naam, scat.datatype, scat.wei... |
a287e883-37ad-4a67-897d-8457989c4c50 | 9 | public static void main(String[] args) {
try(AsynchronousSocketChannel socketChannel = AsynchronousSocketChannel.open()) {
if (socketChannel.isOpen()) {
Set<SocketOption<?>> socketOptions = socketChannel.supportedOptions();
System.out.println(socketOptions);
... |
e96c8c85-f36c-4046-b466-3386d073e49f | 0 | public boolean contains(Attributes attributeList) {
return indexOf(attributeList) >= 0;
} |
3962878d-0bae-4ec4-b077-47295e8f7668 | 3 | @Override
public boolean deleteICNum(String id, double num) {
// TODO Auto-generated method stub
double icnum = getICNum(id);
double totalNum = 0;
int status = memberDaoImpl.getICStatus(id);
if (icnum < num) {
if (status >= 6) {
memberDaoImpl.setICStatus(id, 6);
memberDaoImpl.alterStatus(id, Memb... |
050041e3-4d71-4a6f-91e1-e97109dfb17f | 3 | public static Integer getBoyToGirlRashiDistance(Rashi boyRashi, Rashi girlRashi) {
int boyNumber = boyRashi.ordinal() + 1;
int girlNumber = girlRashi.ordinal() + 1;
int distance = 0;
if (boyNumber < girlNumber) {
distance = girlNumber - (boyNumber - 1);
}
if (boyNumber > girlNumber) {
distance = (gir... |
9bcad427-467c-48eb-9fa5-cb78bdb15d78 | 5 | @SuppressWarnings("unchecked")
public <T> T getVariable(String name, T type) throws InvalidParameterException, TesseractException {
requireState(State.INITIALIZED);
int rv = 0;
if (type instanceof Integer) {
IntBuffer value = IntBuffer.allocate(1);
rv = api.T... |
c89c28cf-38c6-4004-8501-a5ff8b346673 | 6 | public void takeTurn(AtomicReference<Player> whoseTurn) throws InterruptedException {
this.gameStillRunning = true;
while (this.gameStillRunning) {
for (int i = 0; i < this.playerList.size(); i++) {
Player player = this.playerList.get(i);
whoseTurn.set(player)... |
5e72331d-76a6-44c7-827a-f2d7ff68eced | 6 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Location other = (Location) obj;
if (Double.doubleToLongBits(this.row) != Double.doubleToLongBits(other.r... |
2409cc23-0320-4a09-b4f3-2120802fd51c | 3 | public static File[] saveAs(Saveable saveable) {
if (saveable == null) {
return new File[0];
}
String path = saveable.getPreferredSavePath();
File result = StdFileDialog.choose(UIUtilities.getComponentForDialog(saveable), false, SAVE_AS, PathUtils.getParent(path), PathUtils.getLeafName(path), saveable.getAll... |
5b518a9e-3275-41b1-95c8-1234304eb02f | 8 | public Ruutu seuraavaRuutu(Ruutu ruutu, int suunta) {
int vipu=(suunta)%4;
switch (vipu) {
case 0: if (ruutu.getY()==koko) {
return null;
}
ruutu=pelilauta[ruutu.getX()][ruutu.getY()+1];
break;
case 1: i... |
11c872cd-32b3-48b4-9114-42e368d5a5a0 | 2 | public String toString(){
String clause = "";
for (int i = 0; i < literals.size() - 1; i++) {
clause += getLiteral(i) + " OR ";
}
if(literals.size() > 0){
clause += getLiteral(literals.size() -1);
}
return clause;
} |
d4f3631c-3816-45b4-b0e1-0b4edd9f2747 | 6 | public void mouseClicked(MouseEvent e) {
if (image !=null && tileset) {
if (e.getX()>=0 && e.getX() <image.getWidth() && e.getY() >= 0 && e.getY() < image.getHeight()) {
tileSelected = new Vector<Integer>();
x0 = (e.getX()/(8*zoom));
y0 = (e.getY()/(8*zoom));
tileSelected.add(x0 + (y0*(image.getWid... |
7a11f1c0-0f16-400c-8bd4-fff56e204cbb | 1 | @Test
public void calcMeanValues_test() {
try{
double [][]mat1= {{1.0,2.0}, {3.0,1.0}};
PCA pca = new PCA(mat1);
PCA.calcMeanValues(mat1);
pca.getEigenValues();
pca.getEigenVectors();
pca.getVectorsZeroMean();
pca.getResultingVectors();
pca.getMeanValues();
double[] result=PCA.calcMeanValues(mat... |
8e01985c-66e5-4b58-8857-8b0811ad762a | 5 | private UnitPlayer randomPositionAvatar() {
int id = -1;
//Get the current Highest ID to set the new Avatars ID to one higher than that ID
for (int x = 0; x < gameBoard.length; x++) {
for (int y = 0; y < gameBoard[0].length; y++) {
if (gameBoard[x][y] instanceof UnitPlayer) {
id = Math.max(id, ((UnitP... |
cde9f733-8f52-432d-87d8-10db4140b064 | 6 | @Override
public ArrayList<Task> findAllActive(Boolean active) {
ArrayList taskList = new ArrayList();
try {
connection = getConnection();
ptmt = connection.prepareStatement(QUERY_SELECT + "WHERE active=?;");
ptmt.setBoolean(1, active);
resultSet = ptm... |
0efe80cf-1b8c-41e1-a169-8f0594a77c1a | 9 | private void getData(){
try {
cbSubject.removeAllItems();
cbObject.removeAllItems();
cbVerb.removeAllItems();
cbLocation.removeAllItems();
cbLocationObject.removeAllItems();
ConnectDatabase cdb = new ConnectDatabase();
ResultSet result = cdb.st.executeQ... |
49c418a3-f1ab-4de1-8b86-5d8712c45cf9 | 4 | public void start() {
CountdownTimer.setDELTA_TARGET(Constants.DELTA_TARGET);
game = Game.getInstance();
final int DELTA_TARGET_NANOS = Constants.DELTA_TARGET * 1000 * 1000 * TICK_RENDER_RATIO;
while (true) {
long timeStart = System.nanoTime();
BufferStrategy bs = getBufferStrategy();
if (bs == null... |
46b6fd6b-638f-4c92-a64c-dd749947e1c9 | 3 | int NNI( double[][] avgDistArray, int count )
{
edge e, centerEdge;
edge[] edgeArray;
direction[] location;
heap p,q;
int i;
int possibleSwaps;
double[] weights;
p = new heap(size+1);
q = new heap(size+1);
edgeArray = new edge[size+1];
weights = new double[size+1];
location = new di... |
9d5df225-3372-4664-96b2-98bb38d4ef97 | 1 | @Override
public Ingredient addIngredient(String s) {
Ingredient c = getIngredient(s);
if(c != null){
return c;
}
c = new Ingredient(getNextId(), s.toUpperCase(Locale.ENGLISH));
ingredientRepository.add(c);
return c;
} |
d0a63cb7-c1cc-44bb-b4cf-b3a2482fef91 | 6 | private void drawSouth(Terrain[][] currentBoard,
Entities[][] currentObjects, Graphics g) {
//Same logic as above but reversed x, y in respect to board array to draw "upside down"
Location playerDir = boardState.getPlayerCoords();
for (int i = 0; i < currentBoard.length; i++) {
for (int j = 0; j < currentBo... |
5df34e7d-5beb-4381-9b5d-9b724f63b4c4 | 8 | public void kulkusuunnanKustannus(int i, int j) {
if ((i == 0 && j == 0) || (i == 0 && j == 2) || (i == 2 && j == 0) || (i == 2 && j == 2)) {
naapuri.setPaino(kulmittain); // Kulmittain
} else {
naapuri.setPaino(sivuttain); // Suoraan sivussa
}
} |
7e4d128c-356a-4aec-853a-3fa3585734ec | 3 | public static Controller getController(ControllerType type) {
switch (type) {
case TREE_CONTROLLER:
break;
case DOOR_CONTROLLER:
return new DoorController();
case ENTRANCE_CONTROLLER:
return new EntranceController();
}
... |
14f9e578-fb9a-453c-8671-02d620958f8b | 7 | @Override
public void keyPressed(KeyEvent key) {
switch (key.getKeyCode()) {
case KeyEvent.VK_UP:
System.out.println("pressed: Key Up");
break;
case KeyEvent.VK_DOWN:
System.out.println("pressed: Key Down");
break;
case KeyEvent.VK_LEFT:
if(!moveLeft){
moveLeft = true;
ball.move(moveRigh... |
43fb0d6c-75b5-41fb-94c3-66b2519fad63 | 0 | protected static void importFile(DocumentInfo docInfo, FileProtocol protocol) {
openFile(docInfo, protocol, MODE_IMPORT) ;
} |
5eb6e1f4-8fa8-4a40-983c-46540f5a3ed4 | 9 | * @param settlement The <code>Settlement</code> that is trading.
*/
private void attemptBuyFromSettlement(Unit unit, Settlement settlement) {
Player player = freeColClient.getMyPlayer();
Goods goods = null;
// Get list of goods for sale
List<Goods> forSale
= askServ... |
6039cf77-fae7-4aca-89ba-abd2d27bb69c | 3 | public int driveTheCar(int distanceTravelled) {
if (isCarRented() == true || fuelInCar > 0){
int consumptionRate;
if (distanceTravelled <= 50){
consumptionRate = distanceTravelled/10;
return consumptionRate;
} else {
consumptionRate = ((distanceTravelled - 50)/15) + 5... |
43f0ee92-b651-46a8-9ef4-849fff5bd647 | 5 | void updateContentInfo() {
Map<String, Integer> groups=new HashMap();
int dayLenght=0;
for(String name:Day.getAllDays().keySet())
{
Day d=Day.getAllDays().get(name);
for(DayEvent e:d.getEventList()){
if(!e.isUnused()){
... |
0df1205b-f1dc-40c7-98e8-ede8b1068909 | 7 | private Observer createObserver() {
return new Observer() {
@Override
public void update(final String event) {
switch (event) {
case "Opened":
int count = cell.countNeighborsWithMines();
refresh((count ==... |
00541fb5-7263-49f8-94a2-11015b1838ba | 8 | public static void printStepCounts(DualGbState state) {
System.out.println("size: "+state.stateBufferL.size() + " + " + state.stateBufferR.size());
int minStepCountL = Integer.MAX_VALUE;
int maxStepCountL = Integer.MIN_VALUE;
int minDelayStepCountL = Integer.MAX_VALUE;
int maxDelayStepCountL = Integer... |
48187d9b-d29f-4606-95cd-2ba262cd3337 | 7 | public LinkedList<Node> findPath()
{
DijkstraNode current, start = map_[start_.x][start_.y] ,
goal = map_[goal_.x][goal_.y];
start.setGScore(0); // setting the g score of the start to zero
while(!open_list_.isEmpty())
{
current = lookingForBestNode(); // get node with ... |
7079e847-1091-4b33-9e7d-ea7c0dd9c86c | 1 | public void print() {
for(int i = 0; i < nodes.size(); i++) {
((Node)nodes.get(i)).print();
}
} |
0887756a-863f-4aa8-987c-5dacbd8069a0 | 7 | public static void loadConfig() {
try {
BufferedReader reader = new BufferedReader(new FileReader(System.getProperty("user.dir") + "/config"));
String line;
while((line = reader.readLine()) != null) {
if(line.matches("<AUDIO>")) {
String[] temp = reader.readLine().split("=");
En... |
bcd25a80-5abe-4b0e-a110-90e2f80d3ff0 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Funcao other = (Funcao) obj;
if (this.IdFuncao != other.IdFuncao && (this.IdFuncao == null || !this.IdFun... |
6acab079-6718-4084-9a23-9ec587fe174b | 0 | public void setReorderLevel(int reorderLevel) {
this.reorderLevel = reorderLevel;
} |
fd809346-413d-48cc-bf47-643feadeafee | 0 | public int getCapacity() {
return CAPACITY;
} |
abdd1187-dc66-4f7f-8ee8-c6b84be33c88 | 7 | private void updateNeighbors(long[] l) {
if((this.sectionID == 1) || (this.sectionID == 2)) {
for(int i=0; i<height; i++) submesh[0][i].setTemp(l[i]);
for(int i=0; i<height; i++) submesh[width-1][i].setTemp(l[i+height]);
} else if(this.sectionID == 3) {
for(int i=0; i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.