method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2a686387-78e5-4ed9-8885-300ccf0849f0 | 3 | public String changeMatchValue(Character c) {
if (Pattern.matches(this.getMatchSring(), c + "")) {
this.setMatchValue(this.getMatchSring());
}
if (Pattern.matches(this.getMatchNum(), c + "")) {
this.setMatchValue(this.getMatchNum());
}
if (Pattern.matches(... |
9a34c9c3-6e3f-4a6b-b8e5-3f941b67fd27 | 6 | public void read() {
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
String[] contact = line.split(splitBy);
int i = 0;
while (i < contact.length) {
... |
8f817f22-034c-49be-8863-f67fe01b76d1 | 6 | public void removeBalance(){
boolean state=false;
double monto;
if(!activo.validateTipo(Usuario.LIMITADO)){
do{
System.out.print("Ingrese el Numero de la Cuenta: ");
int num = scan.nextInt();
if(num==-1){
break;
... |
f74af0b6-65f7-402b-ba98-4661a059038a | 3 | public String getDefaultName() {
switch (typecode) {
case TC_LONG:
return "l";
case TC_FLOAT:
return "f";
case TC_DOUBLE:
return "d";
default:
return "local";
}
} |
967ee0e2-6f2f-4f4b-8f7d-0d228fa3e6e8 | 2 | public static Orders getInstance(){
if(uniqueInstance == null){
synchronized (Orders.class) {
if(uniqueInstance == null){
uniqueInstance = new Orders();
}
}
}
return uniqueInstance;
} |
350b71f8-a9a4-42b4-8a3b-f75a9a3294d7 | 1 | public void updateType() {
Type subType = Type.tSuperType(subExpressions[0].getType())
.intersection(Type.tArray(type));
if (!(subType instanceof ArrayType))
updateParentType(Type.tError);
else
updateParentType(((ArrayType) subType).getElementType());
} |
781e486a-1987-4005-8f6d-2cc21c8239b0 | 9 | @Override
public void buildModel(Dataset dataset)
{
smoothParam = Math.log(1.0 / dataset.trainCount);
HashMap<Integer, Integer> classInstCount = new HashMap<Integer, Integer>();
HashMap<Integer, Double> classTotalFeatureCount = new HashMap<Integer, Double>();
HashMap<Integer, Double> featureCount = new HashM... |
99a90eaf-dcfd-4cae-911b-2e8c46bf80e1 | 1 | public int getPointsPerComplex() {
return pointsPerComplex > -1 ? pointsPerComplex : (NumOfParams * 2 + 1);
} |
cbf887ae-caf6-41ad-9626-bf9eea7996c2 | 3 | public int[] Ordenamiento(int[] arreglo, String ordenamiento){
int indice, indice2;
int auxiliar;
for (indice = 0; indice < arreglo.length-1; indice++) {
for (indice2 = 0; indice2 < (((arreglo.length)- indice)); indice2++) {
if(arreglo[indice2+1] < arreglo[in... |
31236cc8-5543-4902-9435-9cb53405c24d | 6 | public void display() {
for (int i = 0; i < y; i++) {
// draw the north edge
for (int j = 0; j < x; j++) {
System.out.print((maze[j][i] & 1) == 0 ? "+---" : "+ ");
}
System.out.println("+");
// draw the west edge
for (int j = 0; j < x; j++) {
System.out.print((maze[j][i] & 8) == 0 ? "| "... |
654aefa8-6b2b-4769-84cb-e2d48dabec78 | 4 | @Override
public void save() throws IOException
{
try
{
MessageDigest sha = MessageDigest.getInstance("SHA-1");
//
}
catch (Exception ex)
{
throw new IOException("Failed to rehash: "+ex.getMessage());
}
backend.... |
039748d2-e0e3-4d11-8920-31dd4d4d7020 | 2 | public boolean isConstant() {
for (int i = 0; i < subExpressions.length; i++)
if (!subExpressions[i].isConstant())
return false;
return true;
} |
be4d1207-3804-4481-8856-f3e52ebe7938 | 7 | @Test
public void testAttributes(){
Iterator<Pair<?>> i = info.namedValues.iterator();
Double val = null;
Label label = null;
Boolean[] attExist = {false,false,false,false};
while(i.hasNext()){
pair = i.next();
label = pair.getLabel();
switch (label){
case temp:
val = (Double) pair.second(); ... |
d8753495-d3ca-412f-b487-049b6903bfc2 | 9 | @Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (this.getClass() != o.getClass()) {
return false;
}
User ob = (User) o;
if (this.id != ob.userId()) {
return false;
}
if (!this.username... |
d15862ee-a419-470e-94bb-7ffefd2aae5e | 8 | public void testDeadlockDetectionPolicy2() {
BlockingQueue<Runnable> queue = new SynchronousQueue<>();
ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, queue);
RejectedExecutionHandler handler = Util.parseRejectionPolicy(
"progress_check=period... |
9d5600f6-6f22-409b-b5cb-826df96e4dea | 5 | public static void main(String[] args) {
Integer[] states = {0, 1, 2, 3};//,3,4};
double[] distribution = /*{0.3,0.2,0.5};//*/ {0.025, 0.025, 0.9, 0.05};//, 0.4, 0.1};
int k = 0;
double[] d_moyenne = new double[4];
double[] d_moyenne_temps = new double[4];
final int TAILL... |
d73fb944-304a-4a26-b6bd-d56edb0a9a7a | 6 | public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = ... |
f523d9c2-906e-46fd-88ff-c3f3951aabd5 | 3 | public boolean removeEdge(E e) {
Vertex a = e.getVertexA();
Vertex b = e.getVertexB();
// Achtung: Modifikationen sind notwendig, wenn bei ungerichteten
// Graphen eine Kante {a, b} nur einmal existiert und sowohl in
// der Nachbarliste von a als auch in der von b abgelegt wurde
int aId = a.get... |
a7a7393d-b9a0-4178-aace-955296adddd0 | 0 | public World(String name) {
this.name = name;
blockTypes.put(new Color(255, 255, 255), new Blocks.Air());
blockTypes.put(new Color(94, 75, 9), new Blocks.Dirt());
} |
8e1c0680-ee8a-4b0c-8c2a-da3fdffe316a | 6 | public Keyword continuePartialStrategiesProofs(Keyword lastmove) {
{ IncrementalPartialMatch self = this;
{ ControlFrame frame = self.controlFrame;
Keyword result = null;
if (lastmove == Logic.KWD_DOWN) {
self.setDynamicCutoff();
}
else if (lastmove == Logic.KWD_UP_... |
e5d3d94e-a7b3-4375-a2e7-0efa6956e71b | 9 | @Test
public void testWinningGame() {
// regions
@SuppressWarnings("deprecation")
Region region1 = new Region(565, 425, 0, 0);
@SuppressWarnings("deprecation")
Region region2 = new Region(605, 425, 0, 0);
@SuppressWarnings("deprecation")
Region region3 = new Region(520, 510, 0, 0);
@SuppressWarnings("d... |
b5ad6613-4592-4d08-9238-bc004de5ceb3 | 6 | public static Character getGrade() {
if(numberOfGamesCompleted() == 0) return 'F'; // No need to calculate further
float average = getTotalScore() / (float) numberOfGamesCompleted();
PVU.log(ScoreHandler.class, "Total score is " + getTotalScore() + ", average is " + average + ". Games completed... |
89ae923a-087b-465d-98a3-1a8e1c678b3b | 4 | @Override
public void itemStateChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.DESELECTED) {
oldValue = e.getItem().toString();
} else if (e.getStateChange() == ItemEvent.SELECTED) {
newValue = e.getItem().toString();
Swing... |
eaacc6bc-3ce9-4c80-ade6-f4f4a758d08e | 1 | public static void main(String[] args) {
System.out.println("abcdefg".split(":")[0]);
String string = "{\"validateMessagesShowId\":\"_validatorMessage\",\"status\":true,\"httpstatus\":200,\"data\":{\"orderCacheDTO\":{\"requestId\":5833520282124486629,\"userId\":3500042946533,\"number\":0,\"tourFlag\":\"... |
e7bdb4bd-4356-4c77-a831-eb9e9dde1ddd | 7 | protected String shorthandHexColors(String line) {
// shorthand hex codes
int indexOfhash = line.indexOf("#");
if (line.length() >= 7 && indexOfhash != -1 && indexOfhash + 7 <= line.length()) {
// should of picked up colours and maybe some #id lines with this if statement, now we make sure to only affect colou... |
60967524-d222-457c-bff0-a4f421c8bc51 | 7 | private void down()
{
boolean sel = false;
int debut = 0, fin = 0;
for (int i = 0; i < listDroite.getSize() + 1; i++) {
if (droite.isSelectedIndex(i) && !sel) {
debut = i;
sel = true;
} else if (!droite.isSelectedIndex(i) && sel) {
... |
72bbe470-8791-4a0c-bea5-6180d3ae6d81 | 6 | private String getTextValue(Element ele, String tagName) {
if (ele == null) {
return null;
}
String textVal = null;
NodeList nl = ele.getElementsByTagName(tagName);
if (nl != null && nl.getLength() > 0) {
Element el = (Element) nl.item(0);
if (el == null) {
... |
d8546e02-ce08-46c3-bbe6-978faa698195 | 5 | public boolean imageUpdate(Image image, int infoFlgs, int x, int y,
int width, int height)
{
if (mDisposed)
{
return false;
}
mOffScreenImage = null;
if ((infoFlgs & ERROR) != 0)
{
mErrorText = "Error loading image";
}
else if ((infoFlgs & ABORT) != 0)
{
mErrorText = "Image was aborted be... |
3425666c-f363-427f-9299-41e7141f40c1 | 8 | private static MessageType decodeMessageType(byte messageType) {
switch(messageType) {
case Packet.MESSAGE_TYPE_APPLICATION:
return MessageType.APPLICATION;
case Packet.MESSAGE_TYPE_PING:
return MessageType.PING;
case Packet.MESSAGE_TYPE_PING_RESPONSE:
return MessageType.PING_RESPONSE;
case Pa... |
e287cf68-0daa-4f93-b467-e93100bd9d29 | 2 | public static ArrayList<Book> SearchbyTitle(String title, FakeDateBase fakeDateBase){
ArrayList<Book> result = new ArrayList<Book>();
for (Book book : fakeDateBase.getBooks()) {
if(book.getTitle().equals(title))
result.add(book);
}
return result;
} |
0df4d80c-e865-4e5d-8ee7-7663dd1d62c0 | 7 | private void AFC() throws Exception{
if(IA()){
CPA cpa = generate_CPA();
assignCPA(cpa);
}
while(!done){
Message msg = Mailer.receive_msg(ID);
switch (msg.type()){
case "Stop" :
done=true;
break;
case "FC_CPA":
ForwardCheck(msg);
break;
case "Not_OK":
Proces... |
2fec3f9d-ad65-4165-939e-e2eaab13a986 | 4 | public static String getGroupSuffix(final String name) {
try {
String s = "";
if (MonsterIRC.getHookManager() != null) {
if (MonsterIRC.getHookManager().getChatHook() != null) {
if (MonsterIRC
.getHookManager()
... |
89b3d4eb-cf54-4c62-9d65-c3baeeba8144 | 6 | public AudioDevice createAudioDevice() throws JavaLayerException
{
AudioDevice device = null;
AudioDeviceFactory[] factories = getFactoriesPriority();
if (factories==null)
throw new JavaLayerException(this+": no factories registered");
JavaLayerException lastEx = null;
for (int i=0; (device==null) &... |
16a2160d-3dbb-4407-82b8-7b9a9a00f47c | 3 | void store(Connection connection, ValueList list) {
list.append(types.size());
ValueList nestedList = connection.createList();
for (String eName : types.keySet()) {
ElementType type = types.get(eName);
list.append(eName);
list.append(type.type);
Do... |
eacd861b-9e65-4899-b1a9-c2cf4df09b9f | 1 | public static void main(String[] args) {
String directory = "./";
String name = directory;
for (String arg : args) {
name = name + arg;
}
File dir = new File(name);
dir.mkdir();
} |
b09b9cdc-3ff9-444b-8c98-488173a4b00c | 9 | private void overrideItemPickup(final Player player, final Item item) {
new BukkitRunnable() {
@Override
public void run() {
PlayerInventory inv = player.getInventory();
ItemStack pickup = item.getItemStack();
boolean dosound = false;
... |
c98ce13c-d42b-4d40-bcb3-7153ce32f0a6 | 0 | public GrammarTypeTestAction(GrammarEnvironment environment) {
super("Test for Grammar Type", null);
this.environment = environment;
this.frame = Universe.frameForEnvironment(environment);
} |
231403bd-6225-4aba-9277-b509c9279db2 | 0 | public MementoIF getMemento() {
return m;
} |
0d9bc01c-6d5b-4c26-9ede-0b673029e5f7 | 3 | public static Model loadDSM(String filename) throws IOException {
File file = new File(filename);
byte[] fileData = new byte[(int) file.length()];
DataInputStream dis = new DataInputStream(new FileInputStream(file));
dis.readFully(fileData);
dis.close();
ByteBuffer buffer = ByteBuffer.wrap(fileData);
buf... |
aa809ff3-c7ba-4978-9e34-cfb5044e1e0e | 5 | public String generate() {
boolean nextCharVowel = false;
StringBuilder bui = new StringBuilder();
char nextChar;
if (this.length % 2 == 1) {
nextCharVowel = true;
}
for (int i = 1; i <= this.length; i++) {
if (nextCharVowel) {
nextChar = getRandomVowel();
} else {
nextChar = getRandomCon... |
a643b1a3-7793-469a-b940-8d731e13fa07 | 5 | private void handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
String path = request.getPathInfo();
System.out.println(request.toString());
ApiController<?, ?> controllerFactory = controllers.get(path);
if (controllerFactory == null) {
controllerFactory... |
0c672543-357c-4860-b320-15c87165914d | 4 | @Override
public ValueType returnedType(ValueType... types) throws Exception {
// Check the number of argument
if (types.length == 1) {
// if array
if (types[0] == ValueType.NONE) {
return ValueType.NONE;
}
// If numerical
if (types[0].isNumeric()) {
return ValueType.DOUBLE;
}
// if ... |
4e396bf9-ef26-4a5f-b479-019081d18457 | 6 | @SuppressWarnings("deprecation")
public List<Action> nextRound() {
List<Decider> threads = new ArrayList<Decider>();
for(Actor a : model.actors) {
Decider d = new Decider(a);
threads.add(d);
d.start();
}
List<Action> actions = new ArrayList<Action>();
for(Decider d : threads) {
// Keep in mind t... |
e62ed0bc-2c47-449e-828b-ad65e0a1800b | 0 | public void setOperator(@SuppressWarnings("rawtypes") Operator operator) {
this.operator = operator;
} |
64d828d6-fc56-4e08-b45a-4210e4d4df1d | 6 | @Override
public Record getConversionOf(Record record) throws Exception {
Record out = record;
Double x, y, z;
AttributeValue attrOutX = this.getOutParam("colX", out);
AttributeValue attrOutY = this.getOutParam("colY", out);
AttributeValue attrOutZ = this.getOutParam("colZ... |
fd4b34f1-3838-47a8-b286-f6ac96025287 | 7 | protected String getShowableMoney(InventoryList list)
{
final StringBuilder msg=new StringBuilder("");
if(list.moneyItems.size()>0)
{
msg.append(L("\n\r^HMoney:^N\n\r"));
Item I=null;
for(final Enumeration e=list.moneyItems.keys();e.hasMoreElements();)
{
final String key=(String)e.nextElement();
... |
1c5c8816-88bb-4cd8-b5dd-bfb1ea7d594a | 3 | public void updateNPCMovement(stream str) {
if (direction == -1) {
// don't have to update the npc position, because the npc is just standing
if (updateRequired) {
// tell client there's an update block appended at the end
str.writeBits(1, 1);
str.writeBits(2, 0);
} else {
str.writeBits(1, 0)... |
e23b2141-9a5d-4ef7-a342-9accd007aca0 | 0 | public TestConnectDB() {
super();
// TODO Auto-generated constructor stub
} |
f6545b7d-1e10-461e-80c9-ee4d1eb73757 | 5 | private void setupEventListener() {
// menuitem event listener
undoMenuItem.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK));
redoMenuItem.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK));
cutMenuItem... |
054301d4-983e-4bfb-90c2-4c1b4fc3b300 | 0 | public Consumer(BlockingQueue<String> queue) {
this.queue = queue;
} |
ead6a018-88c9-4b0e-8223-d1426ebbd7db | 5 | /* */ public void login(String userName, String password) {
/* */ try {
/* 85 */ String parameters = "user=" + URLEncoder.encode(userName, "UTF-8") + "&password=" + URLEncoder.encode(password, "UTF-8") + "&version=" + 12;
/* 86 */ String result = Util.excutePost("https://login.minecraft.net/... |
cbf3a531-90be-432b-9e25-b03b3b599808 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Outlet other = (Outlet) obj;
if (!Objects.equals(this.Outlet, other.Outlet)) {
return false;
... |
6aff5407-2957-4a72-83af-d913c4303e41 | 5 | private static void drawColors(Color[] colors, Graphics g, int x1, int y1, int x2, int y2, int direction) {
for (int a = 0; a < colors.length; a++) {
g.setColor(colors[colors.length - a - 1]);
if (direction == SwingConstants.SOUTH) {
g.drawLine(x1, y1 - a, x2, y2 - a);
... |
93c469de-7d93-4024-9ebc-b1e1e77028ad | 0 | public long getIdleTimeout() {
return idleTimeout;
} |
6faee8e5-fc65-470f-b769-e2558a09f9c8 | 8 | boolean oneAway(String s1,String s2){
int oneAway=0;
boolean nAway=false;
HashMap<String,Integer> s1Map=new HashMap<String,Integer>();
HashMap<String,Integer> s2Map=new HashMap<String,Integer>();
for(int i=0;i<s1.length();i++){
String v=Character.toString(s1.charAt(i));
if(s1Map.containsK... |
5aff3900-b565-4fe6-ae82-04d3606c152b | 3 | public void forEachDockContainer(DockContainerProcessor processor) {
for (DockLayoutNode child : mChildren) {
if (child instanceof DockContainer) {
processor.processDockContainer((DockContainer) child);
} else if (child instanceof DockLayout) {
((DockLayout) child).forEachDockContainer(processor);
}
... |
38a17516-bb52-481c-8f21-587d62a850d9 | 8 | public static void main(String[] args) {
String base = "results50";
int replications = 50;
FileLogger result = new FileLogger(new File(base + ".data"));
for (int i = 0; i < replications; i++) {
Statistics.reset();
Simulation sim = new Simulation(1, 1, 2, ... |
116100fd-cf13-4bc1-bfb7-924454f92631 | 4 | private void rebuildColourMap() {
ArrayList<Integer> tempMap = new ArrayList<Integer>();
tempMap.add(Integer.valueOf(0));
for (ImageBean i : this.imageBeans) {
int[] pixels = i.getPixels();
for (int x : pixels) {
if (!tempMap.contains(Integer.valueOf(x))) {
tempMap.add(Integer.valueOf(x));
}
... |
761d96fc-e9e9-4e76-a71f-df69fa95ec03 | 7 | private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... |
c8613b55-6b16-49f7-9f54-4fb0f5562a85 | 4 | private void initializeArrayField(JimpleBody new_body, SootField f, String type, Local local2, Value prev_val) {
if( type!= null && type.equals("int")){
Stmt assStmt = Jimple.v().newAssignStmt( prev_val,
Jimple.v().newInstanceFieldRef(local2, f.makeRef()));
SootMethod m = Scene.v().getMethod("<java.uti... |
5d9e244a-1191-4c88-aaf7-0af26dfbb553 | 4 | @Test
public void test_mult_matrix() {
int a = 2;
int b = 3;
int c = 4;
Matrix m1 = new MatrixList(a, b);
Matrix m2 = new MatrixList(b, c);
Matrix m3 = new MatrixList(a, c);
for (int i = 1; i <= a; i++) {
for (int j = 1; j <= b; j++)
m1.insert(i, j, (double) (2 * i - j));
}
for (int i = 1; i... |
5932fe62-d43f-4f2e-8bc0-d4805157dea2 | 5 | public static boolean printScriptsToStandardOut(File pBaseDirectory, List<String> pScriptPathList){
boolean lSuccess = true;
for(String lPath : pScriptPathList){
String lFileContents;
try {
File lPatchFile = new File(lPath);
if(!lPatchFile.isAbsolute()){
//... |
a8f7aff2-66ac-4c27-af71-bf8c264e9f6f | 4 | public String createForum(String name, User admin) {
if (!admin.hasPermission(Permissions.CREATE_FORUM) || name.equals(""))
return null;
for (int i = 0; i < forums.size(); i++) {
if (forums.get(i).getName().equals(name))
return null;
}
Forum newForum = new Forum(name, admin);
forums.add(newForum);
... |
119c3b30-ba9a-4fdf-b7a9-692885581a2d | 8 | public static long getBigEndian8Int(InputStream inStream) throws IOException, FileError {
long value1 = inStream.read();
long value2 = inStream.read();
long value3 = inStream.read();
long value4 = inStream.read();
long value5 = inStream.read();
int value6 = inStream.read(... |
3a3e54e7-d26f-47b6-95ee-133754169ce7 | 7 | public void commandInterface() {
System.out.println("+++++++++++++++");
System.out.println("Welcome in mail");
System.out.println("+++++++++++++++");
System.out.println("Enter an instruction or enter help");
String input = "";
Scanner in = new Scanner(System.in);
// Enter a loop to parse all input.
... |
8ce9e483-89bf-48af-a739-a8e116d7ec05 | 1 | @Override
public int attack(double agility, double luck) {
if(random.nextInt(100) < luck)
{
System.out.println("I just decreased my enemies agility in half!");
return random.nextInt((int) agility) * 4;
}
return 0;
} |
a817cdeb-a453-4832-8420-ec9f90f242cc | 2 | public void visitAll(IVisitor visitor) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
visitor.visit(i, j, get(i, j));
}
}
} |
c77de3d5-1fc9-4f82-b941-94c116bf9c1c | 4 | private void initOperations() {
/** these operators consider the left hand arguments as deeper in
* the stack than the right hand arguments, thus the right-hand is
* is the top of the stack and is popped first.
*
* Operation details in PostScript Language Reference Manual:
... |
0bc5973f-432c-44fa-b018-a35beacb5c2d | 1 | public void changeWeigthBP() {
for (int i = 0; i < getOrganisms().size(); i++) {
getOrganisms().get(i).getNet().ajustmentWeigth();
}
} |
f0bdda7c-cc95-46a2-ab9e-b61d288845b7 | 5 | public boolean getMethodLayout() {
int[][] dim = new int[columns][rows];
int cur = 0;
for (int i = 0; i < columns; i++) {
int[] row = new int[rows];
for (int j = 0; j < rows; j++) {
try {
row[j] = Integer.pa... |
f5187344-953c-418d-a8c7-6e2c9f279ea3 | 6 | public void close(){
try{
if(in!=null && !in_dontclose) in.close();
in=null;
}
catch(Exception ee){}
out_close();
try{
if(out_ext!=null && !out_ext_dontclose) out_ext.close();
out_ext=null;
}
catch(Exception ee){}
} |
88362743-79a6-469b-8648-2730357b2d04 | 1 | @Override
public void sendEndGameInfo(boolean isWin) {
if (isWin) {
this.updateMessageArea(constants.GameWon());
} else {
this.updateMessageArea(constants.GameLost());
}
this.enableClicks = false;
} |
f5e2a47f-eef7-492c-a117-65a8fec4ca72 | 1 | public static void main(String[] args){
String host;
int port;
String platform = null; //default name
boolean main = false; //'normal'-container
host = "localhost";
port = -1; //default-port 1099
//Runtime runtime = emptyPlatform(containerList);
Runtime runtime = Runtime.instance();
Pro... |
e31755df-4103-4de8-a212-2ca75e99c3e7 | 1 | public void CloseConnection() {
try {
pm.server.Log("Closing connection");
writer.close();
reader.close();
client.close();
} catch (IOException e) {
e.printStackTrace();
}
} |
68f43c73-e853-4eb0-8cbc-28b650dfebf9 | 4 | public static HantoBasePiece makeHantoPiece
(final HantoPieceType pieceId, final HantoPlayerColor pieceColor) {
HantoBasePiece piece = null;
switch (pieceId) {
case BUTTERFLY:
piece = new HantoBasePiece(pieceColor, pieceId, butterflyMoveType, butterflyMoveDist);
break;
case SPARROW:
piece = new HantoB... |
4d0b3aae-a7eb-4749-bd1c-e00f37c22c22 | 0 | public void changeFlyingAbility(FlyingAbility flyingAbility) {
this.flyingAbility = flyingAbility;
} |
f2feda74-735f-4ebd-b427-25cbf96b6e09 | 0 | public void setSuccessor(int i, ProcessedCell c){
getCell(i).setNextCell(c);
} |
620cb6cf-3c5c-46ac-84ed-57df8bfcf705 | 9 | public static double applySusanPixelMask(int x, int y, Mask mask,
Image img, ChannelType color) {
boolean ignoreByX = x < mask.getWidth() / 2
|| x > img.getWidth() - mask.getWidth() / 2;
boolean ignoreByY = y < mask.getHeight() / 2
|| y > img.getHeight() - mask.getHeight() / 2;
if (ignoreByX || ignoreB... |
0fd69f09-91ae-4800-ab4b-0ad6b3b72171 | 9 | private static void setLogLevel(String level) {
Level logLevel = Level.INFO;
Level oldlevel = LOG.getLogger(PACKAGE_ROOT).getLevel();
switch (loglevels.valueOf(level)) {
case all : logLevel = Level.ALL;break;
case info : logLevel = Level.INFO;break;
case warn : logLevel = Level.WARN;break;
case debug ... |
7a8d7bf9-9048-4a9d-92c5-370413bf6843 | 4 | @SuppressWarnings("unchecked")
public static void printList(AbstractList list, int depth)
{
final Iterator i = list.iterator();
Object o = null;
for (int k = 0; k < depth; k++)
System.out.print(" ");
System.out.println("List: ");
while (i.hasNext() && (o = i.nex... |
555bac06-95d5-4d57-8bb7-c18249a7e9f5 | 6 | private void setDataComboBoxModel(NombreTablas tabla) throws SQLException {
String table = "";
if (tabla == NombreTablas.GRUPOS) {
table = "grupo";
} else if(tabla == NombreTablas.ORIGENES) {
table = "origen";
}
String query = "S... |
2da878ec-270a-4eab-a4da-f686711fe9e0 | 4 | @SuppressWarnings({ "rawtypes", "unchecked" })
public static final Map<String, String> readProperties(String pathname, boolean inClassPath) {
InputStream inputStream = null;
try {
inputStream = new FileInputStream(getFile(pathname, inClassPath));
Properties prop = new Properties();
prop.load(inputStream);... |
091129f2-f2a4-43ec-a3c4-1a548b7378c4 | 2 | @EventHandler(priority = EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event) {
if(plugin.isEnabled() == true){
Block block = event.getBlock();
Player player = event.getPlayer();
if(!event.isCancelled())
blockCheckQuest(player, block, "blockplace", 1);
... |
23e86ac0-4d56-4c8d-9a01-77db0654a18f | 2 | public int compare(GeneticAIPlayer p1, GeneticAIPlayer p2) {
if (p1.score > p2.score)
return 1;
else {
return (p1.score == p2.score) ? 0 : -1;
}
} |
4744c68f-124f-47f6-a8e5-8367165807a6 | 3 | private void btnEliminarEventoSocialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarEventoSocialActionPerformed
// TODO add your handling code here:
/*Obtenemos el prov seleccionado de la tabla:*/
int idEventoQueSeEliminara = obtenerIdEventoAeliminar(); //o usar ob... |
9dace78f-b302-43ef-bde9-745724d1cfde | 1 | @Test
public void jsonTransformEquality() throws InvalidJSONException, JSONException {
Implique i1 = new Implique("i1", Implique.EtatImplique.URGENCE_ABSOLUE);
Implique i2;
i2 = new Implique(i1.toJSON());
assertTrue((i1.getUniqueID() == i2.getUniqueID()) && (i1.getEtat() == i2.getEtat()));
} |
8a54cbf7-dae9-4e1c-bca3-09d270a5cf69 | 5 | public void findClassByWildCard(String wildCard) {
if (fileIndexer.getIndex().isEmpty()) {
JOptionPane.showMessageDialog(null, "Load index file first");
}
if (!wildCard.contains(".") && wildCard.endsWith("*")) {
String className = wildCard.substring(0, wildCard.length() ... |
fb3ea6be-cd45-43a1-81ca-0729c9ce39cd | 1 | protected Object fireReceiveQueryEvent(ReceiveQueryEvent evt) throws Exception {
if (receiveQuery != null) {
return receiveQuery.OnReceiveQueryEvent(evt);
}
else {
return null;
}
} |
b481bc78-b6aa-46a9-a864-616e57764f12 | 6 | public Date getFromOpenDate () {
Date fromOpenDate = null;
for (ReceptionsFilter filter: filters) {
if (filter instanceof OpenDateReceptionsFilter) {
OpenDateReceptionsFilter openDateFilter = (OpenDateReceptionsFilter) filter;
Date filterFromOpenDate = openD... |
ff3c5093-6d65-4b29-816d-4c705ba89917 | 2 | public static GameData initGameData() {
JSONObject json;
try {
json = JSONUtils.readFile(JSONUtils.pathGame);
} catch (FileNotFoundException e) {
return currentGame;
}
currentGame = new GameData(
Utils.numToInt(json.get(KEY_NUM_CONTEST)));
// TODO: Combine?
try {
GameData.getCurrentGame().fr... |
5966764b-138d-4c5c-9f0b-da1658b1606a | 6 | public void configure(Configuration conf) throws ConfigurationException {
conf.addConfigurable(this);
ruleFile = conf.getProperty("onDemandTCPOutputConnector.rule");
if(ruleFile == null)
throw new ConfigurationException("onDemandTCPOutputConnector.rule not specified");
String portString = conf.getPr... |
fcfda1f3-e33a-4a8a-9404-e456f32a1b90 | 5 | public boolean insideGreenZone(double x, double y){
if (x > this.greenX1*30.48 && x < this.greenX2*30.48 && y> this.greenY1*30.48 && y < this.greenY2*30.48){
return true;
} else if (Math.sqrt(Math.pow((x - this.finishX*30.48), 2) + Math.pow((y - this.finishY*30.48), 2)) <= 100.0){
return true;
}
else {
... |
34b4a807-1423-4b6e-9a8b-1fcfe16995b3 | 5 | public void fillSelected(int number) {
if (grid.value(selectedRow, selectedColumn) == number) {
return;
}
containsValue[selectedRow][selectedColumn] = true;
grid.fill(selectedRow, selectedColumn, number);
label[selectedRow][selectedColumn].setText(
"" ... |
78694716-82f6-4b30-9972-c88ee00dfcca | 8 | short[] findX1(){
while(temperature > minTemp){
short t1Index = (short) random.nextInt(path.length);
boolean equilibrium = false;
int i = 0;
double pastLength = 0;
int numChanges = 0;
while(!equilibrium && i < LIMIT){
// visualizer.highlightLoose(0, path[x1.fromIndex], path[x1.toIndex]);
// vi... |
d777737a-b5ad-41e9-a269-2096217c8125 | 5 | Point intersect(Line other) {
// using: http://de.wikipedia.org/wiki/Schnittpunkt#Schnittpunkt_zweier_Strecken
double a1 = this.p2.x - this.p1.x;
double b1 = other.p2.x - other.p1.x;
double c1 = other.p1.x - this.p1.x;
double a2 = this.p2.y - this.p1.y;
double b2 = other... |
d3856210-5574-414c-b59d-33426b7e5de8 | 1 | public void subtractCountdownToNextWave(double refreshrate) {
countdownToNextWave -= refreshrate;
if (countdownToNextWave < 0)
countdownToNextWave = 0;
} |
9379acd1-4900-42d9-8f35-41a92f5046f1 | 6 | @Override
public void mousePressed(MouseEvent e) {
if(myCardList.size() > 0){
if(myCardGap > 0) clickedCard = e.getY() / myCardGap;
else clickedCard = 0;
if(clickedCard >= myCardList.size()) clickedCard = myCardList.size() - 1;
if(thi... |
7eb7bf98-1b75-4733-a049-c9f10ff37d4f | 9 | public void doJerkStuff() {
double time = 0;
//calculate acceleration
ArrayList<Segment> p = pathSegments.s;
// for (int i = 1; i < p.size(); i++) {
// double dv = p.get(i).vel - p.get(i - 1).vel;
// double dt = p.get(i).time - p.get(i - 1).vel;
// p.get(i... |
5c2bfefd-8489-4031-997e-3518e9a83d6c | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TMasterOutletPK other = (TMasterOutletPK) obj;
if (!Objects.equals(this.mslsoutCode, other.mslsoutCode)) ... |
dc58a471-674d-493e-b236-09aebeeb02c9 | 5 | @Override
public List<Message> draft(final String key, final Object... arguments) {
if (this.base.isString(key))
return super.draft(this.base.getString(key), arguments);
if (!this.base.isList(key)) return Collections.emptyList();
final List<Message> messages = new ArrayList<Mes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.