method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cb43735e-1a37-49c9-8cbb-44e981383539 | 3 | public static void estimateAP(MAC_samples ap_readings)
{
double Max = 0;
double sum1 = 0;
double sum2 =0;
double X,Y;
Graphics g = MainWindow.panelCanvas.getGraphics();
if (ap_readings.getSampleCount() < 10)
{
//the Maximum signal level
X= ap_readings.getS_X(0);//getSampleArr().get(0).getX();
... |
133626b2-da9a-409c-a1bc-4fcc786dd938 | 9 | int insertKeyRehash(byte val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look until FREE slot or we start to loop
... |
3a51539e-d576-493e-9372-c37209d6d126 | 9 | public int verschilInJaren(Datum datum) throws Exception{
try {
int jaren=0;
int mnd1 = this.maand*100 + this.dag;
int mnd2 = datum.maand*100 + datum.dag;
if (datum.kleinerDan(this)){
//if (this.compareTo(datum)){
jaren = this.jaar - datum.jaar;
if ((this.jaar!=datum.jaar) && (mnd1<mnd2))... |
c7997fe5-b81b-44da-a240-ae0d09243aab | 5 | @Override
protected Object getColumnValue(SoldItem item, int columnIndex) {
switch (columnIndex) {
case 0:
return item.getId();
case 1:
return item.getName();
case 2:
return item.getPrice();
case 3:
return item.getQuantity();
case 4:
return item.getSum();
}
throw new IllegalArgumentExcep... |
96d3f4b1-9514-4401-947d-ad8f672c20d1 | 0 | public T getFirst() { return first; } |
d79ebde0-d182-4974-8023-48ecc06e7e7c | 4 | public boolean isSolved() {
for (int f = 0; f < 6; f++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
if (!getColor(f, x, y).equals(TileColor.get(f)))
return false;
}
}
}
return true;
} |
251294d6-16c0-4db8-9798-2b581ce6d6f2 | 1 | public Expression simplify() {
for (int i = 0; i < subExpressions.length; i++) {
subExpressions[i] = subExpressions[i].simplify();
subExpressions[i].parent = this;
}
return this;
} |
b1313346-33c4-4b2a-a855-b6fe105bafed | 2 | @Override
public Result<Boolean> delete(@NotNull String username) {
UsersDAO dao = new UsersDAO(getDBConnection());
try {
if (!dao.deleteUser(username)) return new Result<>(false, ExceptionMessages.NO_SUCH_USER_FOUND);
return new Result<>(true, ExceptionMessages.OK);
... |
af08fac2-759f-4bf4-9200-8b095f83adf5 | 9 | private void initListeners() {
textField.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
changed();
}
public void removeUpdate(DocumentEvent e) {
changed();
}
public void changedUpdate(DocumentEvent e) {
changed();
}
public ... |
9f53b73e-8901-4964-9426-cff0f9881d57 | 9 | public void serialEvent(SerialPortEvent spe) {
if (spe.getEventType() == SerialPortEvent.DATA_AVAILABLE) {//If one byte of data came in
while (!sendingData) {
try {
if (sendingData) {
break;
}
byte charVal = (byte) input.read();
if (charVal != -1 && (System.currentTimeMillis() - sta... |
0f2672ca-d449-4de7-9b25-002a8ca44fb9 | 9 | public int[] searchRange(int[] nums, int target) {
int low = 0, high = nums.length-1;
int tar = -1;
while (low <= high) {
int mid = (low+high)/2;
if (nums[mid] == target) {
tar = mid;
break;
}
if (nums[mid] > target)... |
31f1006e-bcc4-478c-bcf0-6acec4f34077 | 1 | @Override
public void run() {
if (this.ID != null) {
psearch (this.ID);
}
this._view.init();
} |
af5c22b3-b1a5-4211-88a6-d1535babb986 | 3 | private static boolean trackCut(double[] upper, double[] under, int position, int deep) {
if(upper[position] <= under[position]){
return false;
}
for (int i = (position-1); i > (position - deep); i--) {
if (upper[i] < under[i]) {
return true;
}... |
59e0658d-58a0-4032-ae28-da6aca394852 | 1 | private String toByteString(byte b) {
String s = "" + Integer.toBinaryString(b & 0xFF);
while(s.length() < 8)
s = "0" + s;
return s;
} |
340533b5-94a6-4a79-98e5-9d82669ea401 | 5 | private void createInstances(){
this.instances.clear();
for(Class<Plugin> plugin : this.classes){
Plugin tmp = null;
try {
if(!plugin.isInterface() && !Modifier.isAbstract(plugin.getModifiers()))
tmp = plugin.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
e.pr... |
b575ed2e-83a6-42ec-b565-3234a4d2212d | 4 | public static float getFloat() {
float x = 0.0F;
while (true) {
String str = readRealString();
if (str == null) {
errorMessage("Floating point number not found.",
"Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE);
}
... |
10bb15e6-6199-4deb-a388-3f2ef89aa139 | 0 | public void update(Point p) {
((GeneralPath) shape).lineTo(p.x, p.y);
canvas.repaint();
} |
172cd120-97cb-4c27-8034-8f9d5485ee86 | 3 | @Override
public JsonElement serialize(RoleSchool t, Type type, JsonSerializationContext jsc) {
final JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("id", t.getId());
if(t instanceof Student){
Student student = (Student) t;
jsonObject.addProp... |
946ee815-c6e0-437e-9b88-5993a6c3dec1 | 5 | public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
/*
2
0 2 10
5 3 5
*/
ArrayList<LinkedList<Integer>> arrList;
LinkedList<Integer> list;
Scanner ... |
9ddf269d-30ca-4380-bee3-9ed4b246381d | 6 | public Board() {
_x = this.getRandomNum();
_y = this.getRandomNum();
_turnLocations = new ArrayList<Integer>();
_board = new Tile[20][20];
Tile t = new Tile('_');
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 20; j++) {
if (! ((i < _y && j > (19 - _x)) || (i > (19 - _y) && j < _x))) {
_boar... |
0189ebf4-67ab-4903-bc30-1e35f4b468ad | 9 | public boolean hasCycles() {
// check for cycles
boolean[] bDone = new boolean[m_nNodes];
for (int iNode = 0; iNode < m_nNodes; iNode++) {
// find a node for which all parents are 'done'
boolean bFound = false;
for (int iNode2 = 0; !bFound && iNode2 < m_nNodes; iNode2++) {
if (!bDone[iNode2]... |
a9d489ca-5e0d-4d64-bea9-c620c3092abb | 1 | public static void readRandomParts(){
Object obj = read("misc/randData");
if(obj == null)
return;
JSONObject data = (JSONObject) obj;
DataTag d = new DataTag(data);
Loading.readRandomParts(d);
} |
7defa620-7028-499c-9b06-b76d7f598a76 | 7 | public static int trap(int[] A) {
if (A.length <= 2) return 0;
int[] lm = new int[A.length];
int max = A[0];
for (int i = 1; i < A.length; i++) {
lm[i] = max;
if (max < A[i]) max = A[i];
}
max = A[A.length - 1];
int res = 0;
for (int i = A.length - 2; i > 0; i--) {
int high = A[i];
int min =... |
ff0663d8-6203-4964-a1ca-d776726cf9b6 | 1 | private static void loadSVGs(URL[] URLs) {
for (int i = 0; i < 13; i++) {
universe.loadSVG(URLs[i]);
}
} |
c9441251-88cd-49b9-a364-4291e5ca224e | 2 | public static Bank unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof Bank)
return (Bank)obj;
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
_BankStub stub = new _Bank... |
7dbebadd-f115-4a66-b1dd-3073c62cfc5a | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if(msg.amISource(mob)
&&(msg.targetMinor()==CMMsg.TYP_WEAPONATTACK)
&&(mob.location()!=null)
&&(msg.target() instanceof MOB... |
46e43d44-5a4f-40c0-9a46-df2fb457317e | 1 | public ReceiveMessageEvent(Object source, ConnectionInfo info, String methodName, Object params) {
super(source);
if (info == null) throw new IllegalArgumentException("info is null.");
this.connectionInfo = info;
this.methodName = methodName;
this.params = params;
} |
fee6ac16-42b4-422e-9c36-bedbcf6f72f8 | 6 | private static void displayMenu(Set<Employee> employees) throws IOException {
//Any initial number different from 1, 2, 3, 4 and 0
int input = 6;
while ( input != 0 ) {
System.out.println("Enter 1 if you want to read data from the file.");
System.out.println("Enter 2 if... |
bbb5fab5-a5cd-4ca7-bb26-75eb4fc14440 | 7 | @Override
public void run() {
Calendar cal = Calendar.getInstance();
if(currentPallet == null) {
currentPallet = model.getNextPalletToProduce();
if(currentPallet == null) {
view.insertToProductionBox(sdf.format(cal.getTime()) + " - No orders to produce");
return;
}
}
String message =... |
9a4afb82-0b6a-431f-a018-aa6d5a4e793b | 5 | public static String join(String glue, List<?> s) {
try {
if (s == null) {
return "";
}
int k = s.size();
if (k == 0) {
return null;
}
StringBuilder out = new StringBuilder();
out.append(s.get(0).toString());
for (int x = 1; x < k; ++x) {
out.append(glue).append(s.get(x).toString(... |
802bc97e-23b0-4845-b287-a78cca752926 | 7 | private void setRegister(int register, byte val) {
// any time we write to a PPU register, the bottom 5 bits of PPUSTATUS reflect that value
_ppu_status = (byte)((_ppu_status&0xE0)|(val & 0x1F));
switch (register) {
case 0:
setPPUCTRL(val);
break; // ... |
a01213a5-d776-41fb-b356-2a641441fe58 | 6 | public void addItem(){
int x;
int y;
String s = (String)JOptionPane.showInputDialog(
mainWindow,
"Give x and y coordinates\n"
+ "Seperated by /",
"Add item",
JOptionPane.PLAIN_MESSAGE,
null,null,"");
if ((s != nul... |
de0e13ea-67b3-4e67-972c-5257a3966bf2 | 9 | public void extractFeature(List<Article> artList, boolean isTraining) {
final int SENT_LEN_MAX_CUTOFF = 10;
final int SENT_LEN_MIN_CUTTOFF = 3;
String fileName = new Date().getTime()
+ "-pos-tag-compare-feature.data";
PrintWriter out = null;
try {
out = new PrintWriter(new FileWriter("features/" + file... |
279500c3-3a77-475d-93be-df16b04389d2 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ArtifactType other = (ArtifactType) obj;
if (artifactType != other.artifactType)
... |
a0d7659d-af81-4ba7-bac7-71f6d9f745b7 | 8 | private static Map<Class<? extends Entity>, Integer> getEntitiesConf(
List<AnimalQuantite> animalsList2) {
Map<Class<? extends Entity>, Integer> entitiesConf = new HashMap<>();
for (AnimalQuantite animalQuantite : animalsList2) {
Class<? extends Entity> entityClass = null;
... |
514772d4-a205-4afe-9673-ec1bef7768bd | 0 | @Override
public String toString() {
return "OffrirPK{" + "vis_matricule=" + vis_matricule + ", rap_num=" + rap_num + ", med_depotLegal=" + med_depotLegal + '}';
} |
ccd95c16-67d7-4e94-9469-e38741cb5e38 | 7 | public static double jauTf2d(char s, int ihour, int imin, double sec) throws JSOFAIllegalParameter
{
double days;
/* Compute the interval. */
days = ( s == '-' ? -1.0 : 1.0 ) *
( 60.0 * ( 60.0 * ( (double) abs(ihour) ) +
( (double) abs(imin) ) ) +
... |
08d59c25-b77e-45a9-af76-855fe7293ed9 | 9 | private static char[] getReplacementChars( char ch ) {
char[] replacement = null;
if( ch == '"' ) {
replacement = QUOT_CHARS;
} else if( ch == '\\' ) {
replacement = BS_CHARS;
} else if( ch == '\n' ) {
replacement = LF_CHARS;
} else if( ch == '\r' ) {
replacement = CR_CHARS;
... |
88d971a3-ae4c-482d-a53f-76dd638cd87b | 6 | public void updateEntities()
{
Game.log(EnumLogWeight.LOW, "World: Updating World");
Entity paramEntity;
for (int i = 0; i < this.loadedEntityList.size(); i++)
{
paramEntity = this.loadedEntityList.get(i);
if (paramEntity.isAlive)
... |
6d9237b7-d382-45ad-9e74-e84f41ea0dd6 | 7 | public void handleModifiers() {
if (!dateStrModifier.isEmpty()) {
if (dateStrModifier.contains("circa")) {
notBefore = Calendar.getInstance();
notBefore.setTime(date.getTime());
notBefore.add(Calendar.YEAR, -3);
notAfter = Calendar.getInstance();
notAfter.setTime(date.getTime());
notAfter.a... |
1816197d-8bf4-4837-9c49-804d44643ec4 | 8 | private Object[][] createButs(List<Student> students, List<Timeslot> timeslots){
Object[][] rowData = new Object[students.size()][timeslots.size() + 1];
for (int i = 0; i < students.size(); ++i) {
Student s = students.get(i);
rowData[i][0] = new JLabel("" + s.getStudentNum());
for (int t = 0; t < timeslots... |
6c0bf306-e6a6-4112-a03f-4ecf5bb1c4df | 5 | public static void PrintBoard(int[] f) {
String XorO;
System.out.print(" ------------- \n");
for (int i = 0; i < 9; i++)
{
System.out.print(" | ");
if (f[i] == 1)
{
XorO = "X";
System.out.print(XorO);
}
else if (f[i] == 2)
{
XorO = "O";
System.out.print(XorO);
}
else
{
System.out.p... |
b0c3aab2-f3fc-48aa-9cdc-a3a0ac81377e | 9 | public static double [] lowerSolve(double [][] matrix, double [] vector, double diag){
int dimension, i;
double [] out = new double [vector.length];
if(matrix.length<matrix[0].length)
dimension = matrix.length;
else
dimension=matrix[0].length;
if ( vector.length < dimension ){
System.out.println("err... |
1526067a-e5bb-4f16-aa4e-639748e4ba2e | 1 | public void start()
{
if(isRunning)
return;
run();
} |
5b2197f2-d1f9-4e9b-a686-67f7a3fb0cad | 6 | public static Map loadProperties(String file) throws IOException {
Map map = new HashMap();
BufferedReader reader = null;
UnicodeReader r = new UnicodeReader(new FileInputStream(file), null);
try {
reader = new BufferedReader(r);
String line;
while( (line=reader.re... |
eb38168b-b904-4fb7-aaa5-5c9ee51f02a4 | 0 | public void setCallType(int callType) {
this.callType = callType;
} |
8b7a6822-b8fe-45b7-94d8-b1a207a32152 | 0 | @Override
public void fight() throws Throwable {
hello.fight();
} |
8153c2e0-3c47-41dd-9ec9-b6b5cb88a9f0 | 5 | public void spawnNPC() {
if (grabEnemyPerFrame > 0) grabEnemyPerFrame--;
if (spawnModifier < (60 * 60)) spawnModifier += growthRate;
// Spawn Enemy per frame in growth rate
if (grabEnemyPerFrame <= 0) {
NPC n = new NPC(Math.random() * ImageManager.board.getWidth(), 0... |
5933180c-207e-4da7-828c-3d5c835041da | 3 | public void drawUpdate(Renderer r) {
if (down && hover) {
drawClicked(r);
down = false;
return;
}
if (hover) {
drawSelected(r);
hover = false;
return;
}
draw(r);
} |
e2acae95-5c05-4f6c-8c46-799df6390c6d | 8 | private static void newGame() throws IOException {
Scanner scan = new Scanner(System.in);
String nameInput = "";
int jobSelector;
String ans = "n";
boolean loop = true;
Player p = null;
//If the player enters 'Y' or 'y' then it exits out of character creation
... |
f01f9509-c679-4f38-9b54-d32e3f1baf3b | 2 | public static void printNetworkInterfaces() {
try {
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets)) {
printNetworkInterfaceInfo(netint);
}
} catch (SocketException e) {
System.out.println("Failed to get network inte... |
a1fa245a-c40a-4017-b11c-aac54e59e9b7 | 5 | @Override
public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isPet)
{
if (player == null)
return null;
// Retrieve the attacker.
final L2Character originalAttacker = (isPet ? player.getPet() : player);
// Make all mobs found in a radius 2k aggressive towards attacker.
for (L... |
d18bed63-d74d-4875-bcc4-593e96778b81 | 3 | public static Production[] getNonUnitProductionsOnVariable(String variable,
Grammar grammar) {
ArrayList list = new ArrayList();
ProductionChecker pc = new ProductionChecker();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
if (variable.equals(productio... |
72f35664-b01c-4775-b064-ca6bf7913e2a | 5 | public void writeToFile(String fileName, LinkedList<Data> results) {
try {
FileWriter fw = new FileWriter(fileName);
String lineOut = "Iter,";
for (int i = 0; i < simulations.length; i++) {
lineOut += simulations[i] + ",";
}
fw.write(li... |
8c1f6e13-90d6-4d3e-beb0-baf986c14941 | 0 | @MyAnnotation(address = "tianjing" , world = "hubei")
@Deprecated
@SuppressWarnings("unchecked")
public void output()
{
System.out.println("This is OUTPUT!");
} |
1c0a2668-288e-43ef-85b3-0ba2b5c39ef2 | 1 | public static boolean isServerRunning() {
return server != null && server.isRunning;
} |
31957877-57f7-4b55-8e5c-57508284aa6e | 5 | @Override
public List<Artist> getArtists() throws RemoteException {
List<Artist> artists = new ArrayList<Artist>();
File file = new File(path.concat(artistsSERFile));
if (file.exists()){
try{
FileInputStream fileInputStream = new FileInputStream(path.concat(artist... |
ad70e80a-822d-4adf-a552-3cc8ed91564b | 1 | public static void main(String[] args) {
Generator g = new Generator();
Thread t = new Thread(g);
t.start();
g.addListener(new EventListener1());
g.addListener(new EventListener2());
try {
t.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
cf253cf7-8531-404f-a8b8-2fb2eb9991e9 | 0 | public void setBuiltOn(Date builtOn) {
this.builtOn = builtOn;
} |
c3a8a617-d112-4976-8e72-5beac856ca6a | 6 | public final Pino etsiPolku(int alkuX, int alkuY, int loppuX, int loppuY) {
kaymattomatNoodit = new AvlPuu();
kaydytNoodit = new LinkedList<T>();
kaymattomatNoodit.insert(noodit[alkuX][alkuY]);
valmis = false;
T valittu;
while (!valmis) {
/** H... |
f2b9ac46-dfc1-424f-ad5b-7c606870f7e9 | 1 | public void occupy(Mob<? extends Mob> tenant) {
occupant = tenant;
} |
474ec65b-2ce8-42ea-a331-085474b53ac9 | 0 | public HeroClass getbossoldclass() {
return oldclass;
} |
4a3dd794-45ce-4204-a6aa-18397a138cf0 | 4 | @Override
public int willingnessToMoveHere(Hero hero, Player player, float distance,
int day) {
float moveRatio = hero.getMovePoints()/(distance+1);
if (hero == this) {
return -100;
}
if (hero.getColor() == getColor()) {
return -100;
/*float stat1 = getLevel()+2;
float stat2 = hero.getLeve... |
e79238d6-1e9a-408e-be7e-5d3c97f0a3eb | 3 | private int FindTileRow(int mouseY)
{
for (int i = 0; i < tileRow; i++)
{
if(mouseY > i * tileHeight && mouseY < (i + 1) * tileHeight)
{
return i;
}
}
return -1;
} |
aadc5157-d594-476a-a19c-3dd67fe2f9f6 | 5 | private int[] runFinder(int x, int y, PixImage image){
short initialRed = image.getRed(x,y);
short initialGreen = image.getGreen(x,y);
short initialBlue = image.getBlue(x,y);
int runLength = 0;
short red = initialRed;
short green = initialGreen;
short blue = initialBlue;
do{
runLen... |
4e9a3772-0b46-421d-a3b6-5d466c8b9c0a | 5 | @Override
public void keyPressed(int k) {
if(k == KeyEvent.VK_ENTER) {
select();
}
if(k == KeyEvent.VK_UP) {
currentChoice--;
if(currentChoice == -1) {
currentChoice = options.length - 1;
}
}
if(k == KeyEvent.VK_DOWN) {
currentChoice++;
if(currentChoice == options.length) {
currentC... |
e94c1bb2-b264-4a08-a19f-7fdc245645cb | 4 | @Test
public void testBatchCreateScanForm() throws EasyPostException, InterruptedException {
// create and buy shipments
Shipment shipment1 = createDefaultShipmentDomestic();
Shipment shipment2 = createDefaultShipmentDomestic();
List<String> buyCarriers = new ArrayList<String>();
buyCarriers.add("... |
4a4a19c4-276a-4ddd-9cdd-71c760f18b57 | 9 | public String convert(String s, int nRows) {
if (nRows == 1) {
return s;
}
char[][] table = new char[nRows][s.length()];
int index = 0, col = 0, row = 0;
boolean goDown = true, goUp = false;
while (index < s.length()) {
table[row][col] = s.charAt(index);
if (goDown) {
row++;
if (row == nRow... |
1d8ffaa5-bed1-4a21-9a4d-4edaf426c4c5 | 5 | private void newGame(int type1, int type2) {
switch (type1) {
case Player.RANDOM_PLAYER:
playerX = new RandomPlayer();
break;
case Player.MINIMAX_PLAYER:
playerX = new MiniMax();
break;
default:
playerX = new Human();
break;
}
switch (type2) {
case Player.RANDOM_PLAYER:
playerO = new... |
3a58d21e-7266-4254-81f1-d136167346f8 | 8 | public boolean addTimeSlot(double startTime, double finishTime, PERangeList list) {
startTime = Math.max(startTime, currentTime());
if(finishTime <= startTime) {
return false;
}
Iterator<ProfileEntry> it = avail.itValuesFromPrec(startTime);
ProfileEntry last = it.next();
ProfileEn... |
5bf7859f-86b8-4267-ad65-e634de29db6d | 6 | public static void main(String[] args) throws Exception{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.fifa.com/worldcup/teams/index.html"); // countries
PrintWriter writer = new PrintWriter("/u/jeremiah/CountryStatsMessingAround.txt");
// gets clickable links to countries ... |
8b462be2-5ca8-4b57-8d35-33094eeeca7b | 6 | private void checkSelectedMenuItem() {
if (selectedButton == Button.RESUME.pos) {
stage.clear();
running = true;
} else if (selectedButton == Button.SOUND.pos) {
if (Settings.GLOBAL_SOUND) {
pauseButtons[selectedButton].setText("Lyd av");
... |
07a46888-f799-4e09-b46c-7b264dc21aa4 | 7 | public void register() {
if (!isStringValid(loginField.getText())) {
loginField.setStyle("-fx-background: rgb(255,0,0);");
errorLabel.textProperty().setValue("Логин не должен содержать русских букв!");
errorLabel.visibleProperty().setValue(true);
return;
}... |
7cec2db4-7ea8-4b57-aeae-34fa069c10ba | 5 | public static Object invokePrivateMethod(Object object, String methodName, Object... params)
throws NoSuchMethodException {
Class[] types = new Class[params.length];
for (int i = 0; i < params.length; i++) {
types[i] = params[i].getClass();
}
Class clazz = object.getClass();
Method method = null;
f... |
18cb9ccb-32d7-4f11-9cf2-9fe1d23c076a | 1 | public void setImgPath_UsertileImage(Path img) {
this.imgUsertile_Def = handleImage(img, UIResNumbers.USERTILE_IMAGEFRAME_DEF.getNum());
if (this.imgUsertile_Def == null) {
this.imgUsertile_Def = UIDefaultImagePaths.USERTILE_IMAGEFRAME_DEF.getPath();
deleteImage(UIResNumbers.USER... |
9fca84b0-0ab1-40b6-88d8-7b0df6f401ff | 6 | private void chooseFood() {
List<String> canAfford = Collections
.synchronizedList(new ArrayList<String>());
List<String> entrees = Collections
.synchronizedList(new ArrayList<String>());
entrees = menu.getItemList();
synchronized (entrees) {
for (String entree : entrees) {
if (menu.getPrice(entr... |
b96a3950-405a-4ec4-bdf8-c21fee804b94 | 6 | private static ValueReg readReg(CompileInfo ci, String p){
if(p.charAt(0)!='r' && p.charAt(0)!='R'){
makeDiagnostic(ci, Kind.ERROR, "expect.register");//$NON-NLS-1$
}
if(p.charAt(1)=='+' || p.charAt(1)=='-'){
makeDiagnostic(ci, Kind.ERROR, "expect.number.for.register");//$NON-NLS-1$
}
int reg = readIntN... |
befe5f79-b668-4ab2-8d7a-18497f33ce02 | 3 | public void gumbelMinProbabilityPlot(){
this.lastMethod = 5;
// Check for suffient data points
this.gumbelMinNumberOfParameters = 2;
if(this.numberOfDataPoints<3)throw new IllegalArgumentException("There must be at least three data points - preferably considerably more")... |
79aecede-3225-4fa1-a284-1c5d35c07980 | 1 | private RepositoryVm createRepositoryVm(Repository repository, String baseUrl, Release latestRelease) {
RepositoryVm repositoryVm = new RepositoryVm();
repositoryVm.setName(repository.getName());
repositoryVm.setDescription(repository.getDescription());
if (latestRelease != null) {
... |
a0bdd428-da2b-42db-b046-13a2afe0c356 | 9 | public boolean checkDoorDirection(BoardCell current, BoardCell door){
if(!door.isDoorway()){ return false; }
else{
int diff = calcIndex(current.row, current.column)-calcIndex(door.row, door.column);
//at this point we are guaranteed that door is actually a doorway, thus we are safe to cast as RoomCell
swit... |
091d16b1-7bf6-41d3-bcae-9c58f42c6e11 | 2 | @Override
public void handleEmptyEventQueue() {
// TODO Auto-generated method stub
super.handleEmptyEventQueue();
if (exec1xTraffic) {
TrafficExportImport.changeReabilityModel();
TrafficExportImport.readEvents("./Traffic/" + id_execution + "_traffic_"+ Tools.getNodeList().size() + ".txt");
//Tr... |
3c1124c1-9bf9-4c3a-bf5b-d8586bc94a12 | 6 | void setExampleWidgetFont () {
if (colorAndFontTable == null) return; // user cannot change color/font on this tab
Control [] controls = getExampleControls ();
if (!instance.startup) {
for (int i = 0; i < controls.length; i++) {
controls[i].setFont(font);
}
}
/* Set the font item's image and font to... |
201d6975-a074-46fa-9a7d-5aedb0ff0b81 | 6 | private void action() {
if(this.action!=null) {
switch(this.action.getNb()) {
case 1:
this.generer();
case 2:
this.getSaisie(false);
case 3:
this.getSaisieCryptanalyse();
case 4:
this.getSaisieCryptanalyseCle();
default:
this.getSaisie(true);
}
}
else {
if(!this.deco) {... |
08963285-4652-4010-babb-5431c8f2173a | 9 | public void renderMeanPosition(Graphics2D g) {
if (!movable || !visible)
return;
if (!showRMean)
return;
if (rQ == null || rQ.isEmpty())
return;
if (outOfView())
return;
int x = (int) rQ.getQueue1().getAverage();
int y = (int) rQ.getQueue2().getAverage();
if (x <= 0 && y <= 0)
return;
Str... |
317c3bde-501c-4193-b58a-a51929db7bcf | 9 | public String executeProcess(String url, String processID,
ProcessDescriptionType processDescription,
HashMap<String, Object> inputs) throws Exception {
org.n52.wps.client.ExecuteRequestBuilder executeBuilder = new org.n52.wps.client.ExecuteRequestBu... |
a8145f46-f514-434e-aebc-2b5a82007883 | 1 | public Message getMessage(){
Message msg = new Message("");
try{
Object temp = h.readObject();
Message xxxx = (Message) temp;
msg = xxxx;
}catch(Exception e){
System.out.println("Notification: A client has left");
}
return msg;
} |
6b65c392-4704-452f-9143-b69ec439e5c5 | 2 | public static void main(String[] args) {
if(args.length >= 1 && args[0] == "DEBUG") {
DEBUG = true;
}
Base64.encode("---");
// Word a = new Word(new String[]{"tietokone","tst2","tst33"},new String[]{"ans1","ans2"}); // "Original"
// Word b = new Word(new String[]{"tieetoone","sst2","tst3"}); // "input"... |
fb44e23b-a90e-4cdf-8a06-c3f9ff0eb5bc | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ... |
92899809-4e48-44d2-8a6b-ca38d76982eb | 1 | @Override
public void endSetup(Attributes atts) {
AbstractPreferencesPanel prefPanel = (AbstractPreferencesPanel) GUITreeLoader.getAncestorElementOfClass("com.organic.maynard.outliner.util.preferences.AbstractPreferencesPanel");
// Add it to the PreferenceList in the parent panel
prefPanel.addPreference(this)... |
959706ec-4cb9-49fd-aaf6-61412c1d531b | 9 | private static String extractTheAnswer(String htmlSource) {
String answer = "";
try {
Document xmlDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(htmlSource)));
xmlDocument.getDocumentElement().normalize();
// Get a list of <pod>
NodeLis... |
32a9b975-fa05-4e5f-bd65-4df8f8ef4f3b | 1 | public static void remove(String regionName) // remove from
// config.yml AND
// from all players
{
// remove from config.yml
Spectacles.getInstance().getConfig().getConfigurationSection("Regions")
.set(regionName, null);
Spectacles.getInstance().saveConfig();
... |
0def8971-af4b-44a3-a944-c80c6a01dedb | 7 | public ArrayList <Franchise> DBfranchisorRouter (Object sysObject,
String action){
//local container
ArrayList <Franchise> temp;
try{
if (sysObject instanceof String && "VIEWALL".equals(action)){
temp = queryDB.GetA... |
bb37f1e0-1ef3-4fbf-a75e-af48aa858512 | 2 | public void addEntry(OpponentEntry entryArg, double handStrength) {
for (OpponentEntry entry : entries) {
if (entry.equals(entryArg)) {
entry.update(handStrength);
return;
}
}
entries.add(new OpponentEntry(entryArg.getContext(), entryArg.getAction(), handStrength));
} |
daf29fc1-4150-45fc-ad11-1af0ae4d06a6 | 3 | public LinkedList<cliente> getListaCliente(){
LinkedList<cliente> ListaCliente = new LinkedList();
Conexionbd.conexion bd = new Conexionbd.conexion();
try{
bd.conectarBase();
//ResultSet rs = bd.sentencia.executeQuery("SELECT * FROM USUARIOS WHERE TIPO = 'C'");
... |
c29a4fa9-a876-4b37-a007-78474a2469bc | 0 | @Override
public String toString(){
return "item name : "+ this.name;
} |
c676a8fa-933a-45f7-9608-1b1579b167c5 | 2 | @Override
public void run() {
// These variables should sum up to 17 on every iteration
long updateDurationMillis = 0; // Measures both update AND render
long sleepDurationMillis = 0; // Measures sleep
while (running) {
long beforeUpdateRender = System.nanoTime();
long deltaMillis = updateDurationMillis ... |
a34b36a4-bd91-4973-a735-b5e4cdae2383 | 0 | public static void main(String[] args) {
// No object of Parcel is necessary
Contents c = contents();
Destination d = destination("Tasmania");
} |
4f3bdd45-d611-4b17-8e16-4225679ccc09 | 5 | public void listen()
{
for (;;)
{
try
{
Socket newSocket = this.sSock.accept();
DataOutputStream outputStream = new DataOutputStream(
newSocket.getOutputStream());
System.out.println("Connection from "
+ newSocket.getInetAddress().toString() + " !");
//Max # of players = 5
... |
63c36f3f-daf5-44e9-bb4a-698a18f31551 | 9 | public void doStep() {
W1 = nonRemainderSet(keys, "W1^0");
W2 = nonRemainderSet(notKeys, "W2^0");
ArrayList<String> splitz = new ArrayList<>();
splitz.addAll(W1);
splitz.retainAll(W2);
ArrayList<String[]> toAdd = new ArrayList<>();
//If has extra elements... |
746fc551-3f44-4d6e-871f-94a290fd10b9 | 8 | public void print() {
for (byte m = 0; m < 9; m++) {
for (byte n = 0; n < 9; n++) {
Cell c = cells[m][n];
byte val = c.getValue();
if (val > 0) {
System.out.print(c.getValue() + " ");
} else {
System.out.print("* ");
}
if (n == 2 || n == 5) {
System.out.print("| ");
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.