method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e56b1dca-fe14-4701-b2e3-977538848e1d | 9 | public int getScore(String s, int boardSize) {
switch (s.length()) {
case 0:
case 1:
case 2:
return 0;
case 3:
return boardSize <= 4 ? 1 : 0;
case 4:
return 1;
case 5:
return 2;
case 6:
return 3;
case 7:
return 5;
... |
2a87126b-e897-42c6-8659-f09f3ca18a9f | 9 | @Override
protected void Poll()
{
//if the robot re-oriented itself, cached sine and cosine values need to be re-calculated
double rotation = m_robot.GetTransformedData().GetRotation() + m_rotation;
if (Math.abs(rotation - m_cacheNetRotation) > PhysicsModel.EPSILON)
{
m_cacheNetRotation = rotation;
m_ca... |
9dfa89d4-9648-40bb-bd3d-0483a4e7485a | 4 | public static void main(String[] args) {
int i;
float inputs06[] = {
20, 22, 21, 24, 24, 23, 25, 26, 20, 24,
26, 26, 25, 27, 28, 27, 29, 27, 25, 24
};
float inputs10[] = {
20, 22, 24, 25, 23, 26, 28, 26, 29, 27... |
4b99705e-376a-4cc4-8c3c-c1fdac79019e | 1 | @Override
public void actionPerformed(ActionEvent arg0) {
switch(arg0.getActionCommand()) {
case ButtonNames.NEWOBJBUTTON: {
new ObjCreateDialog(this).setVisible(true);
}
}
} |
bfc329ec-1e8e-46a0-8d3e-dfd69db2fcd7 | 2 | private void exitOnGLError(String errorMessage) {
int errorValue = GL11.glGetError();
if (errorValue != GL11.GL_NO_ERROR) {
String errorString = GLU.gluErrorString(errorValue);
System.err.println("ERROR - " + errorMessage + ": " + errorString);
if (Display.isCreated()) Display.destroy();
System.e... |
264b6728-f35f-4d06-a8d4-5e7fca7aae57 | 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... |
39083967-80d8-4dc6-afcb-969402faecb1 | 5 | private void setToBlack(byte[] buffer, int lineOffset, int bitOffset,
int numBits) {
int bitNum = (8 * lineOffset) + bitOffset;
int lastBit = bitNum + numBits;
int byteNum = bitNum >> 3;
// Handle bits in first byte
int shift = bitNum & 0x7;
if (shift > 0) {
int maskVal = 1 << (7 - shift);
byte v... |
2d1f583b-f18b-4025-a506-c0f676b215b8 | 0 | public void testBlackCount() {
List<AnswerCombination> combinations = generateAnswerCombinationList();
assertEquals(0, combinations.get(0).getBlackCount());
assertEquals(1, combinations.get(1).getBlackCount());
assertEquals(2, combinations.get(2).getBlackCount());
assertEquals(3, combinations.get(3)... |
35a112bb-1d7f-4119-9477-c5f9e91381ed | 3 | public void setTipo(PTipo node)
{
if(this._tipo_ != null)
{
this._tipo_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}... |
9d50c33b-ee00-4bf2-9ca7-e97daded83e1 | 3 | private void addValueElement(
final String element,
final String name,
final String desc,
final String value)
{
AttributesImpl att = new AttributesImpl();
if (name != null) {
att.addAttribute("", "name", "name", "", name);
}
if (desc != nul... |
1b526962-1fed-4d7c-be85-856683658665 | 7 | public static void rezeptAuswahlKommentar(List<Rezept> rezeptList, Marshaller marshaller , Rezepteseite rezepteseite) throws JAXBException, FileNotFoundException{
int rnr, rnr2;
// Rezeptauswahl, anschliessend kommentieren starten
// Menüaufbau
System.out.println();
System.out.println("Geben sie die Re... |
66dfc57e-9967-45f7-be87-8ed7a55a80f1 | 3 | @BeforeClass
public static void setUpBeforeClass() {
try {
String localTestProperty = System
.getProperty(BookStoreConstants.PROPERTY_KEY_LOCAL_TEST);
localTest = (localTestProperty != null) ? Boolean
.parseBoolean(localTestProperty) : localTest;
if (localTest) {
CertainBookStore store = new C... |
debc5eea-6c95-44e7-a24e-4d910feef4e8 | 8 | public void paint(Graphics g) {
// draw main backgdound
g.drawImage( Asset.boardlg.getImage() , Asset.boardlg.getPosition().getX(), Asset.boardlg.getPosition().getY(), this);
// draw bet backgroud
if ( game.getSetting().getGameState() == Setting.GAME_STATE.BET ) drawBet(g... |
e0575b8c-a91b-42d3-a41a-e82d55a44800 | 3 | public void step() {
for(int x = 0; x < xSize; x++) {
for(int y = 0; y < ySize; y++) {
grid[x][y].grow();
// YOU WILL NEED TO IMPLEMENT GROW() YOURSELF.
}
}
Collections.shuffle(agents);
for(int a = agents.size()-1; a >= 0; a--) {
Agent agent = agents.elementAt(a);
agent.act();
... |
54d42054-7a71-4ffc-bee7-f25a1ae02102 | 1 | public boolean setUserlistImageFrameWidth(int width) {
boolean ret = true;
if (width <= 0) {
this.userlistImgFrame_Width = UISizeInits.USERLIST_IMAGEFRAME.getWidth();
ret = false;
} else {
this.userlistImgFrame_Width = width;
}
setUserlistIm... |
459351b8-b9cd-4f35-8d0d-f88074381f54 | 3 | boolean contains(int x, int y) {
return y > y0 && y < (y0 + height) && x > x0 && x < (x0 + width);
} |
a0c03703-1405-4f76-9ac3-4501772753d2 | 7 | public void sendMessage(ChatMessage msg) { //permet de mettre en forme les messages et de les envoyer
try {
msg.setSender(username);
msg.setPassword(serverKeys.encrypt(clientUI.getPassword()).toString());
msg.setTimeStamp(simpleDate.format(new Date()).toString());
if (msg.getMessage().length() > 1 &&... |
27f6bf56-c712-4fcb-b078-b2d2e8681143 | 4 | public static void fizzbuzz(Integer n) {
for (int i = 1; i <= n; i++) {
if (i % 3 == 0) {
if (i % 5 == 0)
System.out.println("FizzBuzz");
else
System.out.println("Fizz");
} else if (i % 5 == 0) System.out.println("Bu... |
497a1945-6aed-4a5f-ae7b-f88b471c3417 | 3 | public String convertFromCell(HSSFCell cell){
Object data = null;
int dataType = cell.getCellType();
switch(dataType){
case HSSFCell.CELL_TYPE_NUMERIC:
data = cell.getNumericCellValue();
break;
case HSSFCell.CELL_TYPE_STRING:
... |
93efaa22-826e-4d42-b028-c9f5098ecec4 | 5 | @Override
public void mouseReleased(MouseEvent arg0) {
if (StorageUnitDisplayPanel.this.displayMode != DisplayMode.FULL) {
StorageUnitDisplayPanel.this.fireClick();
return;
}
int y = arg0.getY();
if (StorageUnitDisplayPanel.this.storageUnit != null) {
int height = StorageUnitDisplayPanel.this.... |
87f6c4b7-c847-4f55-961a-7971a4bf7523 | 8 | public void putAll( Map<? extends Double, ? extends V> map ) {
Iterator<? extends Entry<? extends Double,? extends V>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Double,? extends V> e = it.next();
this.put( e.getKey(), e.getValue() );
... |
05f842d4-7ac7-4521-b9ab-7e56a6e67084 | 4 | public static void removeCopy(int copyId){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedState... |
bcd22e52-ae80-4c20-990c-24f8c0dffaea | 7 | private void execSQLWrapper(String query) throws SPARULException {
try {
execSQL(query);
} catch (Exception e) {
String expMessage = e.toString();
// This means that VOS is probably down
if (expMessage.contains("Broken pipe") || expMessage.contains("Virtu... |
bfcac2f9-4bd5-4056-90c4-c1db248ba7c0 | 2 | public void passKeyReleasedInpute(ArrayList<KeyButtons> keyPressed)
{
switch (whatcha)
{
case PLAYING:
stage.handleReleasedKeys(keyPressed);
break;
case SELECTSTAGE:
stageSelector.handleReleasedKeys(keyPressed);
... |
7c55f8fc-c0f1-4110-9d9a-66865a999664 | 1 | public static void main(String[] args) {
FoneApiClient client = new FoneApiClient(
"http://foneapi_server/api/1.0/switch",
"****************************", "****************************");
CommandResponse response = client.dial(eDialDestinationType.number,
"5551234567",
"htt://your_server/location_of... |
ccb3885a-f17e-410a-814f-adf9d4f483ee | 4 | private void saveSong() {
try {
FileChooser f = new FileChooser();
f.setInitialDirectory(new File(System.getProperty("user.dir")));
f.setInitialFileName(controller.getNameTextField().getText()
+ ".txt");
f.getExtensionFilters().addAll(
... |
acb0c3ed-2409-4e8a-93e6-3806eb19066b | 5 | public void saveToFile() {
File f = location;
File dir = f.getParentFile();
if (!dir.isDirectory()) {
dir.mkdirs();
}
if (f.isFile()) {
f.delete();
}
try {
BufferedWriter output = new BufferedWriter(new FileWriter(f));
output.write("### Savefile used for the application. Version: 2\n");
... |
b8cc806c-ca48-4de2-8bed-2b6574bada13 | 5 | public V get(K key) {
int internalKey = generateKey(key);
int count = 0;
while (array[internalKey] != null && count < size) {
if (array[internalKey].getKey().equals(key)
&& array[internalKey].hashCode() == internalKey)
return array[internalKey].getValue();
internalKey++;
count++;
if (intern... |
57cdda2e-1c1e-431c-826e-36244b3f4afc | 0 | public boolean contains(String key) {
return get(key) != null;
} |
cd83a802-32a9-4957-9ae8-4bc67b5793e8 | 4 | public boolean isOutOfBounds(int x, int y, int xMin, int yMin, int xMax, int yMax)
{
if(x <= xMin || x >= xMax+xMin)
return true;
if(y <= yMin || y >= yMax+yMin)
return true;
return false;
} |
376238ee-ae0a-48b7-ae96-c6274f8ce322 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
f0b27157-ab60-49a7-b897-9780e219bbdd | 6 | private static void findPairIntersections() {
for (Pair p1 : values) {
Card[] c1 = p1.cards;
int i1 = p1.ordinal;
for (Pair p2 : values) {
int i2 = p1.ordinal;
Card[] c2 = p2.cards;
intersectsPair[i1][i2] = false;
if(c1[0] == c2[0]) intersectsPair[i1][i2] = true;
if(c1[0] == c2[1]) inters... |
29396d54-69ee-47df-9e4b-f20eda7acde0 | 7 | @Override
public int getValues(Component target, int tweenType, float[] returnValues) {
switch (tweenType) {
case X:
returnValues[0] = target.getX();
return 1;
case Y:
returnValues[0] = target.getY();
return 1;
case XY:
returnValues[0] = target.getX();
returnValues[1] = ta... |
3870a2d2-4751-466f-b4b6-58df7f166f20 | 7 | public void renderMeanForce(Graphics2D g) {
if (!showFMean)
return;
if (aQ == null || aQ.isEmpty())
return;
if (outOfView())
return;
float x = aQ.getQueue1().getAverage();
float y = aQ.getQueue2().getAverage();
if (Math.abs(x) <= ZERO && Math.abs(y) <= ZERO)
return;
g.setColor(getView().getBac... |
464887e4-f2ca-4a87-9a0d-2941d3628385 | 4 | public Map<String, String> getDirectoriesAndDestinations() {
final File sourceDirectory = new File(source.getDirectory());
// Scan for directories
final DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(sourceDirectory);
scanner.setIncludes(source.getIncludes().toAr... |
0a831a63-aeac-48aa-b532-ba5d83b8e96f | 2 | public void encryptOrDecrypt(String key, int mode, InputStream is,OutputStream os) throws Throwable {
DESKeySpec dks = new DESKeySpec(key.getBytes());
SecretKeyFactory skf = SecretKeyFactory.getInstance("DES");
SecretKey desKey = skf.generateSecret(dks);
Cipher cipher = Cipher.getInstance("DES"); // DES/ECB/PK... |
21b610e0-af33-47de-856a-a62fb98cb11a | 8 | private void ExecuteInternal() {
try {
Reset();
if(m_CurrentLM == null)
return;
long botY = PopScanbeam();
do {
InsertLocalMinimaIntoAEL(botY);
m_HorizJoins.clear();
ProcessHorizontals();
long topY = PopScanbeam();
ProcessIntersections(botY, topY);
ProcessEdgesAtTopOfScanbeam(t... |
4ea0f391-9039-420b-81dd-b770e903b17c | 1 | @Override
public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) {
if (argumentList.size() > 0) {
UserInterface.println("This command takes no arguments.");
HelpCommand.displayHelp(this);
return false;
}
return true;
} |
f94a22f8-dfba-4842-890e-947188d7b34c | 1 | public static ActionsFunction getActionsFunction() {
if (null == _actionsFunction) {
_actionsFunction = new SudokuActionsFunction();
}
return _actionsFunction;
} |
ccdf914e-8713-454a-ac35-606755f1fc80 | 8 | protected GameState findSetToTrue(GameState state, Card card)
{
//Check the hand
for(Card c : state.getPlayer(card.getFaction()).getHand())
{
if(c.equals(card))
{
state.getPlayer(card.getFaction()).removeFromHand(c);
c.setTrue(state.getTime());
state.getPlayer(card.getFaction()).addToHand(c);
... |
21dec899-1c68-4266-bce8-a328b4b544cd | 0 | public static Main getInstance() {
return instance;
} |
ff6bfaf0-1d27-4acc-b0d9-b7e15e20f603 | 8 | private void promoteUser(ChangeRolePacket r)
{
OperationStatusPacket opStat;
int flag = OperationStatusPacket.SUCCESS;
User sender = null;
User affected = null;
for (User u : users.keySet())
{
if(u.getID() == r.getSenderID())
{
... |
bfeeaeef-ef69-4d87-9d8d-a932392865c6 | 9 | private void handleKeyboardInput() {
final boolean leftPressed = Keyboard.isKeyDown(Keyboard.KEY_LEFT);
final boolean rightPressed = Keyboard.isKeyDown(Keyboard.KEY_RIGHT);
final boolean returnPressed = Keyboard.isKeyDown(Keyboard.KEY_RETURN);
if (!Commons.get().isKeyPressed()) {
if (leftPressed || rightPres... |
82d55083-c531-4e4f-8a34-e03b90eff52d | 3 | public Inventory solveFractional() {
int availableCapacity = capacity;
ArrayList<Double> amounts = new ArrayList<Double>();
if (availableCapacity <= 0) {
return new Inventory(this, amounts);
}
for (Item i : items) {
if (availableCapacity < i.getWeight()) {... |
691b6168-c2ef-484a-8cc5-e10b9a85bbd8 | 3 | public synchronized void addListener(final CycLeaseManagerListener cycLeaseManagerListener) {
//// Preconditions
if (cycLeaseManagerListener == null) {
throw new InvalidParameterException("cycLeaseManagerListener must not be null");
}
if (listeners.contains(cycLeaseManagerListener)) {
throw ... |
94e81cb8-e9d5-4a92-b2f3-4c7ea6ee1a23 | 2 | public void destroy ()
{
assert (!plugged);
if (handle != null) {
try {
handle.close();
} catch (IOException e) {
}
handle = null;
}
} |
f5d5dc06-ccdf-4c52-9eb1-ddac7adada60 | 1 | public void render()
{
gc.art.fill(width, height, 0, 0, 0xFF000000);
if (level != null)
level.render(gc.art);
} |
3f654a0d-46a2-473c-9c5e-a37088514e87 | 9 | private void update() {
for (turn = 1; turn <= MAXTURNS; turn++) {
while(isPaused) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
for (Ant ant : ants) {
if (ant.isAlive()) {
if (ant.getResting() > 0) {
ant.setResti... |
72d9cfde-aeda-4f48-a835-510e1f9648bf | 4 | public static void main(String[] args) {
String line = "";
String message = "";
int c;
try {
while ((c = System.in.read()) >= 0) {
switch (c) {
case '\n':
if (line.equals("go")) {
PlanetWars pw = new PlanetWars(message);
DoTurn(pw);
pw.FinishTurn();
message = "";
} e... |
064d5914-61e5-4329-b6e6-f5d646035fdb | 2 | public static byte[] toByteArray(Object o){
try{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
out = new ObjectOutputStream(bos);
out.writeObject(o);
byte[] yourBytes = bos.toByteArray();
try{
bos.close();
out.close();
}catch(Exception e){System.out.... |
43b23311-ae1a-435d-908d-4e3e5886b166 | 9 | public Set<TrapezoidLine> naiveMap(int height, int width) {
Set<TrapezoidLine> trapezoidMap = new HashSet<TrapezoidLine>();
// Add the borders of the window as temporary shapes
Shape border = new Shape();
Shape border2 = new Shape();
border.getPoints().add(new Point(0, 0));
border.getPoints().add(new Poi... |
dab94ff9-0493-4310-80f3-013f83c4f3f9 | 9 | public void execute(String[] args) throws Exception
{
processArguments(args);
if (objectName == null)
throw new CommandException("Missing object name");
MBeanServerConnection server = getMBeanServer();
MBeanInfo mbeanInfo = server.getMBeanInfo(objectName);
MBeanAttributeInfo[... |
951bf507-01c7-444a-9251-2ce117506bae | 8 | public Capabilities getCapabilities() {
Capabilities result;
Capabilities classes;
Iterator iter;
Capability capab;
if (getFilter() == null)
result = super.getCapabilities();
else
result = getFilter().getCapabilities();
// only nominal and numeric classes allowed
... |
b8e4444c-9826-4697-93a9-4e974fdd441f | 1 | public static CustomButton doPathBrowseButton(final JTextArea textToUpdate) {
final JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
final CustomButton a = new CustomButton("browse");
a.addActionListener(new ActionListener() {
@Override
public void actionPerfor... |
365e3c8e-c3df-4a61-b2ad-3e656d21de79 | 4 | public static int[][] createInverseLookupTable(int[] chars) {
int[][] tables = new int[256][];
for (int i = 0; i < 256; i++) {
int c = chars[i];
if (c > -1) {
int high = (c >>> 8) & 0xFF;
int low = c & 0xFF;
int[] table = tables[hig... |
2af55af4-d646-4034-b986-42a91dc6bd82 | 9 | public void start() {
running = true;
t = new Thread(new Runnable() {
@Override
public void run() {
try {
serverSocket = new ServerSocket(10188);
} catch (IOException e) {
System.err.println("Could not listen on port: 10188 (is it in use?.");
e.printStackTrace();
}
try {
c... |
3956475c-8ad3-4194-9867-49a26a5b348e | 4 | public void encode_ascii(String encoded_string) throws IOException
{
File op = new File("output.txt");
n=0;
BufferedWriter bw = new BufferedWriter(new FileWriter(op));
String temp=String.valueOf(encoded_string.charAt(0));
for(int i=1;i<encoded_string.length();i++)
... |
0683dad2-5bcb-4a42-9257-f2ce6dc70e47 | 5 | @Override
public void execute(MapleClient c, MessageCallback mc, String[] splitted) {
if (splitted[0].equals("startProfiling")) {
CPUSampler sampler = CPUSampler.getInstance();
sampler.addIncluded("net.sf.odinms");
sampler.start();
} else if (splitted[0].equals("stopProfiling")) {
CPUSampler sampler = ... |
b45ab579-7c9c-4468-9d46-4356fef07bec | 4 | public void setPlayers(ArrayList<Player> players, boolean resetGame) {
if (players.size() <= 0) {
players.add(new HumanPlayer());
players.get(0).setName("Nope. Nope. Nope.");
}
if (resetGame || players.size() != this.players.size()) {
this.players = players;
... |
018b2370-b3c5-4d5c-9289-d289d41ab5f0 | 1 | private void declarationList()
{
while (have(NonTerminal.DECLARATION_LIST))
{
declaration();
}
} |
b4d25668-3f30-4138-9013-44cc43e31e64 | 0 | public static Element createProductionElement(Document document,
Production production) {
Element pe = createElement(document, PRODUCTION_NAME, null, null);
pe.appendChild(createElement(document, PRODUCTION_LEFT_NAME, null,
production.getLHS()));
pe.appendChild(createElement(document, PRODUCTION_RIGHT_NAME... |
1ce42d0c-906d-4517-a90f-4bb74e9c98f6 | 6 | private void testConflict(final ChangedFile c) {
if (this.checkedInFiles.isEmpty()) {
readCache();
}
final String filename;
{
final int offset = c.s.lastIndexOf('/');
if (offset < 0) {
filename = c.s;
} else {
filename = c.s.substring(offset + 1);
}
}
final String filenameRemove = thi... |
390e90c5-0e76-4468-9539-6a1c638e1b36 | 9 | public static void main(final String[] args) {
try {
// load mysql jdbc driver
Class.forName("com.mysql.jdbc.Driver");
// Setup the connection with the DB
Importer.connect = DriverManager.getConnection("jdbc:mysql://localhost/" + props.getString(Importer.MOVIEDB_KEY) + "?user="
+ props.getString(Im... |
8019c3c4-4ce6-46bd-9715-4fc0769df35b | 6 | private LinkedList<Actor> removeDuplicateActors(LinkedList<Actor> actors) {
if (((actors.get(2).getName().equals(actors.get(1).getName())) && (actors
.get(2).getBirthday().equals(actors.get(1).getBirthday())))
|| ((actors.get(2).getName().equals(actors.get(0).getName())) && (actors
.get(2).getBirthday().equals... |
b36cd7ac-ed07-4afc-8a5a-d9f30a6ca2a3 | 6 | @Override
public void mouseClicked(final MouseEvent e) {
this.e = e;
player.setActivityTimer(1000);
//if(player.getActivityTimer()==0){
new Thread(new Runnable(){
@Override
public void run() {
ToiletOverlay overlay = (ToiletOverlay)((JLabel) e.getSource()).getParent();
ov... |
38caccd3-0e6f-4b3b-9540-14a260eb74dc | 3 | @Test
public void testInsertAndDeleteOfArrays() throws Exception
{
PersistenceManager pm = new PersistenceManager(driver,database,login,password);
for(int x = 0;x<10;x++)
{
//insert 10 objects
for(int t = 0;t<10;t++)
{
ObjectArrayContainingObject aco = new ObjectArrayContainingObject();
aco.se... |
c337ccbd-3b5f-4cc4-9b7d-aba02117d4df | 7 | public static void main(String[] args){
//Local var declaration
Scanner sc = new Scanner(System.in);
String src,dst;
if(args.length < 2){
//User inout interface
System.out.println("==============================================");
System.out.p... |
b0a5e5b9-57fd-4f4d-9ab3-63b9b0405ef7 | 9 | public void mouseReleased(MouseEvent e)
{
removeMouseMotionListener(this);
if (creationLien && enabled) {
creationLien = false;
ZElement cibleLien = chercheElement(e.getX(), e.getY());
if (cibleLien != null) {
lienTemp.setElement(cibleLien, Consta... |
3b15f4e9-33ae-4d2a-aa76-c2b5b0a3a996 | 6 | private static void initializePhiGrid() {
// Defines the phis across the grid
scalePhisHere = new ArrayList<ArrayList<Double>> ();
int numGridLines = getNumGridlines();
double scaleNormalizer = Math.pow(2, Settings.startLevel/2.0);
double i1 = Settings.getMinimumRange();
// Loop across the gridline... |
6604f07f-7544-4c5d-9672-8bd6af26e1ab | 6 | public String toString()
{
int i, spaces;
boolean longParam = false;
StringBuilder buf = new StringBuilder(100);
buf.append(" ");
buf.append(arg);
spaces = 20 - arg.length();
if (spaces <= 0)
{
sp... |
71e56333-3957-4a13-b5e6-ee8fd7185bb8 | 1 | public void removeAllListeners() {
Object[] listenerArray = listeners.getListenerList();
for (int i = 0, size = listenerArray.length; i < size; i += 2) {
listeners.remove((Class)listenerArray[i],
(EventListener)listenerArray[i+1]);
}
} |
f9f7c949-042a-44ee-b3a1-ba682b45c604 | 7 | public boolean isFine( String n, int w, int h )
{
if ( !n.equals( name ) )
return false;
switch ( compare )
{
case 0:
return ( w == width && h == height );
case 1:
return ( w <= width && h <= height );
case 2:
... |
d6853ed1-85c4-4a73-87c6-3d41bb69b84e | 0 | public void removeClassPath(String path) {
int index = paths.indexOf(path);
paths.remove(index);
} |
3230d010-2f95-4892-9e11-969481110b62 | 1 | public static void readXML() throws Exception {
puzzleHighscores = new Vector<SlidingPuzzleHighscore>();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new File("highscore.xml"... |
7ee93633-f62f-44e3-bd65-674abb4b0fe7 | 0 | private JobConf jobConf(HadoopContext hadoopContext) {
JobConf jobconf = new JobConf();
jobconf.setJobName("stackoverflow");
jobconf.setUser("hduser");
jobconf.setMapperClass(StackoverflowCommentsToCsv.Map.class);
jobconf.setNumReduceTasks(0);
jobconf.setOutputValueClass(... |
e8a8550f-8102-4acb-b76d-7e38fb7cf9ff | 7 | public void play() throws PlayWaveException{
//FileInputStream inputStream;
try {
waveStream = new FileInputStream(filename);
} catch (FileNotFoundException e) {
return;
}
AudioInputStream audioInputStream = null;
try {
audioInputStream = AudioSystem.getAudioInputStream(thi... |
8e575c65-be43-4334-b9cd-01e823daae42 | 3 | public void saveChunk(World var1, Chunk var2) throws IOException {
var1.checkSessionLock();
File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
if(var3.exists()) {
WorldInfo var4 = var1.getWorldInfo();
var4.setSizeOnDisk(var4.getSizeOnDisk() - var3.length());
}
... |
07c8f7e7-05cb-4379-83b1-5ac241c79268 | 7 | public static boolean validate(String name, String pass, PersonBean bean) {
boolean status = false;
PreparedStatement pst = null;
ResultSet rs = null;
Connection conn=null;
try {
conn=ConnectionPool.getConnectionFromPool();
pst = conn
.prepareStatement("select * from person w... |
07a5329f-f9dc-4060-b6af-286c7d716100 | 3 | @Override
public void keyPressed(KeyEvent e) {
//Implement send on enter press
if (e.getKeyCode() == KeyEvent.VK_ENTER && !txtField.getText().equals("")) {
send();
}
//Implement message last sent text field population
//can be used to re-send last message with a spelling correction
if (e.getKeyCode() ==... |
fb3e4c66-e333-4eef-8e9a-344d8ae64e35 | 6 | static private void insertGetString (ClassWriter cw, String classNameInternal, ArrayList<Field> fields) {
int maxStack = 6;
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "getString", "(Ljava/lang/Object;I)Ljava/lang/String;", null, null);
mv.visitCode();
mv.visitVarInsn(ILOAD, 2);
if (!fields.isEmpty()) {
... |
be2fdaa5-8fb2-43f8-ae68-51e0841fde18 | 9 | final void method2136(int i, int i_0_, byte i_1_) {
anInt6224++;
if (aClass61_6222 != null) {
if (i_1_ >= -42)
method2149(-65);
((Class286) this).aHa_Sub2_3684.method3738(-15039, 1);
if ((i & 0x80) != 0)
((Class286) this).aHa_Sub2_3684.method3771((byte) -122, null);
else if ((0x1 & i_0_) != 1)... |
5cc2eeac-67e7-4994-910f-4f7e3bcfd28b | 6 | @EventHandler
public void CreeperNightVision(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getCreeperConfig().getDouble("Creeper.... |
3a304b86-2df6-4337-b87a-c8535d0eadc5 | 4 | @Test
@DatabaseSetup(value="classpath:databaseEntries.xml", type=DatabaseOperation.CLEAN_INSERT)
public void testListLecturers() {
List<LecturerImpl> lect_list = lecturerJdbcDaoSupportObject.listLecturers();
assertEquals(2, lect_list.size());
for(LecturerImpl l : lect_list){
String fn = l.getFirstN... |
7b29c74c-3360-4dab-88c3-ed9defea511f | 8 | public void calc() {
if(operator== "+") {
firstNum += secondNum;
System.out.println("firstNum plus secondNum is: " + firstNum); }
if(operator == "-"){
firstNum -= secondNum;
System.out.println("firstNum minus secondNum is: " + firstNum);}
if(operator == "*") {
firstNum *= secondNum;
Syst... |
a327c1a6-ca7a-45cc-8494-f16f9bbb80cc | 5 | private void err(String prefix, String message, Throwable throwable)
{
String log = buildMessage(prefix, message);
System.err.println(log);
if (outputStream != null)
{
try
{
outputStream.write((log + "\r\n").getBytes());
}
catch (IOException e)
{
// TODO Auto-generated catch block
... |
ddcec104-9c5a-43d6-94b1-d4573843c805 | 8 | public static Object asType(Object typeKey, Object value)
{
if (value==null) {
return null;
}
if (typeKey==null) {
return value;
}
// Check if the provided value is already of the target type
if (typeKey instanceof Class && ((Class)typeKey)!=Object.class)
{
if (((Class)typeKey).isInstance(valu... |
6e45e40a-a3e9-49ea-a44b-e66f3a8ec1e6 | 4 | public TreeColumn overColumn(int x) {
if (x >= 0 && !mColumns.isEmpty()) {
int divider = getColumnDividerWidth();
int count = mColumns.size() - 1;
int pos = 0;
for (int i = 0; i < count; i++) {
TreeColumn column = mColumns.get(i);
pos += column.getWidth() + divider;
if (x < pos) {
return ... |
345a0d10-d373-4b69-bd2d-5cc55eb2ae5f | 9 | private int computeEdgeParameters(DynamicGraph dynamicGraph, List<Date> sortedDates) {
AttributeModel attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel();
AttributeColumn overlapColumn = attributeModel.getEdgeTable().addColumn("overlapd", AttributeType.DYNAMIC_DOUBLE);
in... |
0f567a74-aa42-40ec-8351-9bda419f783d | 6 | @Override
public void propertyChange(PropertyChangeEvent evt) {
if (programExit)
if (evt.getPropertyName().equals("state")&& (evt.getNewValue()).toString().equals("DONE")){
System.exit(0);
}
if (makeNewDocument)
if (evt.getPropertyName().equals("state")&& (evt.getNewValue()).toString().equals("D... |
259f6cf3-22f5-4814-8c90-232d368b29d8 | 7 | public void drawPoint(Chimera3DLVertex vertex[]) {
Chimera3DMatrix mat = matrixWorld.mod(matrixCamera).mod(matrixProjection).mod(matrixViewPort);
Chimera3DVector dest = new Chimera3DVector();
for(int i = 0; i < vertex.length; ++i) {
mat.transformVectorPosition(dest, vertex[i].pos);
... |
f1802a68-ece6-47c7-9e02-0e50cbc9ccc7 | 1 | */
public void convertDragRowsToSelf(List<Row> list) {
Row[] rows = mModel.getDragRows();
rows[0].getOwner().removeRows(rows);
for (Row element : rows) {
mModel.collectRowsAndSetOwner(list, element, false);
}
} |
d12fe1c9-c714-4033-9725-cf005428c998 | 6 | private void generateField() {
field = new MinefieldCell[rows][cols];
for (int i = 0; i < rows; i++)
for (int j = 0; j < cols; j++)
field[i][j] = new MinefieldCell();
for (int i = 0; i < mines; i++) {
int row = (int) (Math.random() * rows);
int col = (int) (Math.random() * cols);
while (field[... |
7b1d81ba-f1f3-4e18-bf2a-0e74401bffde | 3 | public static boolean checkUpdatesMain() {
//Nastavi številko za najnovejšo verzijo iz strežnika
double version=0;
try {
URL url=new URL("http://"+Main.ip+"/d0941e68da8f38151ff86a61fc59f7c5cf9fcaa2/computer/mainVersion.html");
BufferedReader in=new BufferedReader(new Inpu... |
bcaf8385-a8ba-46cf-ae24-bb827c16f428 | 9 | @Override
public MinesweeperTile[] getSurroundingTiles() {
ArrayList<MinesweeperTile> surrondingList = new ArrayList<MinesweeperTile>(8);
for (int x = xPos - 1 ; x <= xPos + 1; x++) {
for (int y = yPos - 1 ; y <= yPos + 1; y++) {
if (x >= 0 && y >= 0 && x < board.amountOfTiles.width && y < board.amountOfTi... |
5dab5f0a-ad46-410b-9d0d-ff47eef39acb | 9 | public static void Update(){
room.Update();
boolean change_room = false;
//OFFSCREEN LEFT
if (room.player.x+room.player.rb/2 < 0){
change_room = true;
room.player.x = room.MAP_WIDTH*Tile.WIDTH - 16;
int x = (int)coordinates.getX();
x--; if (x < 0) x = world_width-1;
coordinates.setLocatio... |
4d249c98-1c77-406c-b8d6-be2bdc213a73 | 2 | public void update(){
for(int i = 0; i < particles.size(); i++){
Particle p = particles.get(i);
p.update();
if (p.isDead()){
particles.remove(i);
i--;
}
}
} |
7f70c502-8564-401f-b27c-0544a2d0a4c4 | 6 | public void toggleSquare(int x, int y) {
//first check we are are allowed to make a move
if (!checkValidMove(x, y)) return;
Square square = board.getSquare(x, y);
if (square.isRevealed()) {
//do nothing
return;
}
if (square.isFlagged())
minesUnflagged++;
//toggle flag and notify listener
... |
1c5d5944-26ca-4630-98e9-7e43c3df3cbf | 5 | private void scheduleSchemaForProcessing(URL schemaLocation) {
if (cache.hasSchema(schemaLocation)) {
return; //schema has already been compiled before, or on another thread
}
for (ProcessingEntry it : schemasToCompile) {
if (it.schemaLocation.toString().equals(schemaLoc... |
ee14a905-5e66-458b-8c30-33c45bae0748 | 3 | public Menu()
{
// Elements of the bar:
JMenu menuFile = new JMenu("File");
add(menuFile);
JMenu menuHelp = new JMenu("Help");
add(menuHelp);
// Elements of File:
JMenuItem fileConnect = new JMenuItem("Connect");
fileConnect.addActionListener(new ActionListener()
{
@Override
... |
cadc00ee-7a2c-4061-9df8-80b78757fdc0 | 1 | private static boolean method517(char arg0) {
return !Censor.isLetter(arg0) && !Censor.isDigit(arg0);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.