method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b977cae9-3708-43be-8246-055b0817e1cd | 4 | private void checkDisplayCollision() {
int futureX = this.getLocation().x - moveRichtungX;
int futureY = this.getLocation().y - moveRichtungY;
if (futureX > 0)
futureX += moveRichtungX;
if (futureY > 0)
futureY += moveRichtungY;
if (this.getLocation().x + getLevelWidth() - moveRichtungX < Start
.ge... |
a9857cbe-7bf1-4105-98a8-4c66bcd096c9 | 4 | private boolean canMoveDiagonal(Grid grid, Position pos) {
for (Element element : grid.getElementsOnGrid()) {
if (element instanceof Player
&& ((Player) element).getLightTrail().getPositions().contains(new Position(pos.getxCoordinate(), pos.getyCoordinate() - 1))
&& ((Player) element).getLightTrail().get... |
f57b1684-3e2c-4759-b33b-dd26ebe1bc2b | 6 | public void getKnightGraph(mxAnalysisGraph aGraph, int xDim, int yDim)
{
if (xDim < 3 || yDim < 3)
{
throw new IllegalArgumentException();
}
int numVertices = xDim * yDim;
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
Object[] vertices = new Object[numVertices];
fo... |
1e079514-ebc7-4b03-af87-88502ae31435 | 0 | public double value() {return value;} |
61eb9bd7-1984-45c3-ae99-cff7b8e62702 | 6 | private void setChars(char [][] board)
{
for(int x = 1; x < board.length; x++)
{
for(int y = 1; y < board[x].length; y++)
{
//matches each index to their corresponding char in the sym array and replaces them
//based on the char number generated earlier
if(board[x][y] == '1')
board[x][y] = sy... |
3c00672f-ac23-42f6-9c3c-a082312cafbe | 0 | public void drawGround(Graphics2D gI)
{
gI.setColor(new Color(10, 170, 10));
gI.fillRect(0, 0, Chunk.getPixelLength(), Chunk.getPixelLength());
} |
17bd93dd-fef5-4c08-9cb5-08d49c91f3e6 | 4 | protected void write(String event, int resID, double clock)
{
if (!record_) {
return;
}
// Write into a results file
FileWriter fwriter = null;
try
{
fwriter = new FileWriter(super.get_name(), true);
}
catch (Exception ex)
... |
02479811-6229-41e1-acd1-de4853eae947 | 9 | public void keyReleased(KeyEvent e) {
// Si se presiona la tecla P, se pausa y despausa el juego
if (e.getKeyCode() == KeyEvent.VK_P) {
if(!gameover & inicia){
pausa =! pausa;
}
}
// Si se presiona la tecla S, suena o deja de sonar la musi... |
a93fbe14-2114-4b18-a0ac-2ebc119dee77 | 5 | public static RepNotification UPDATE_REPONSE(OVNotification ovNotification) throws SQLException {
RepNotification rep = new RepNotification();
Connection connexion = GET_CONNECTION();
try {
Statement statement = connexion.createStatement();
int resultat = statement.exe... |
ca3690de-9229-4aeb-89c3-4139b4c06d93 | 1 | public void dieHero(Hero hero)
{
if (heroes.remove(hero)) {
deadHeroes.add(hero);
}
} |
4bea9160-9515-43b5-98d8-1e108ec81453 | 6 | public static void formatTriangles(byte data[], int id) {
if (data == null) {
ModelHeader modelHeader = Model.modelHeaderCache[id] = new ModelHeader();
modelHeader.vertexCount = 0;
modelHeader.triangleCount = 0;
modelHeader.texturedTriangleCount = 0;
return;
}
Stream buffer = new Stream(data);
bu... |
461c16f3-6b62-411e-a9e8-c494289a5a2b | 1 | public void delete(String whereString){
StringBuffer sql = new StringBuffer("");
sql.append("Delete from `SubSection`");
if (whereString.trim() != "") {
sql.append(" where " + whereString);
}
SQLHelper sQLHelper = new SQLHelper();
sQLHelper.sqlConnect();
... |
d8431504-2777-4def-9c3d-7dfa9349c101 | 0 | public static void changeSelectionToNode(JoeTree tree, OutlineLayoutManager layout) {
Node selectedNode = tree.getOldestInSelection();
// Update Selection
tree.clearSelection();
tree.addNodeToSelection(selectedNode);
// Record State
tree.setEditingNode(selectedNode);
tree.setCursorPosition(0);
tree.... |
b3185b24-b20a-45d0-92e6-a3dc633f001d | 4 | public void endElement(String uri, String localName,
String qName)
throws SAXException {
if(qName.equals("hits")) {
inHits = false;
}
if(qName.equals("score")) {
inScore = false;
}
if(qName.equals("color")) {
inColor = false;
}
if(qName.equals("brickConfiguration"))... |
353b5773-950a-4659-a084-126ba6e1490e | 9 | public void makeStep() {
if(Utils.DEBUG) {
curAli.checkCons();
if(curDist != distCalc.dist(curAli))
throw new Error("Inconsistency in distance calculation");
if(curPi != logPi(curDist))
throw new Error("Inconsistency in likelihood calculation: "+logPi(curDist));
}
int type = Utils.generator.next... |
865174b8-86d7-4574-8dcf-9c1a6b3551be | 7 | @Override
public void setStructure(boolean[][] adjMatrix) throws RuntimeException {
if( adjMatrix.length != nodeIndexing.getNodesNumber() || adjMatrix[0].length != nodeIndexing.getNodesNumber())
throw new IllegalArgumentException("Error: the adjacency matrix must be an NxN matrix where N is the number of nodes... |
16824309-d761-4155-b9de-0ff1e27ed784 | 6 | @EventHandler
public void BlazeHarm(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.getBlazeConfig().getDouble("Blaze.Harm.DodgeCha... |
055cfbb4-2218-43a4-8960-a664216f4c4b | 8 | private void declaration_list(){
tokenActual = analizadorLexico.consumirToken();
if(tokenActual!=null){
if(tokenActual.obtenerLexema().equals("void") || tokenActual.obtenerLexema().equals("int") || tokenActual.obtenerLexema().equals("char")){
tokenActual = analizadorLexico.co... |
20732423-3bb4-42b6-9b41-5e75d1341208 | 0 | public void setCanvas(PersistentCanvas canvas) {
this.canvas = canvas;
} |
0b35b918-d33a-4bae-8922-6a4c6b2a7834 | 5 | public static int maxPathSum(int[][] grid) {
int path[][] = new int[grid.length][grid[0].length];
int col, row;
row = grid.length;
col = grid[0].length;
path[0][0] = grid[0][0];
for (int i = 1; i < row; i++) {
path[i][0] = path[i-1][0] + grid[i][0];
}
for (int j = 1; j < col; j++) {... |
6e9d3733-f58e-4aa5-893d-027553b2dace | 0 | @Test
public void testValueOf() {
UserAgent userAgent = UserAgent.parseUserAgentString("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)");
UserAgent retrievedUserAgent = UserAgent.valueOf(userAgent.getId());
assertEquals(userAgent, retrievedUserAgent);
} |
051caf63-05bd-4e48-88f0-e654a1b210af | 0 | public E pop() {
final E returnValue = (E) stack.get(stack.getSize()-1);
stack.delete(stack.getSize()-1);
return returnValue;
} |
a66fcf07-100e-42ab-9172-ad81091a8c74 | 4 | public static SpriteID getAbilitySprite(AbilityType type) {
SpriteID sprite = null;
switch (type) {
case abil_tar_heal:
sprite = AbilitySprite.heal;
break;
case abil_aim_fire:
sprite = AbilitySprite.fire;
break;
... |
545dabe4-fbac-4372-b542-79a7a9c65c75 | 2 | public Vector splitAsciiTo(int split,String msg)
{
Vector blocks=new Vector();
String ascii=this.return_ascii(msg);
int i=0;
System.out.println();
while(true)
{
//System.out.println(i);
if(i+split<ascii.length())
blocks.addElement(ascii.substring((int)i,(int)(i+split)));
else
{
bloc... |
b126e6fc-6262-46b6-a2ce-3dcec9346775 | 6 | @Override
public Object clone() {
Object clonedObject;
try {
clonedObject = super.clone();
TransactionRecord t = (TransactionRecord)clonedObject;
if (account != null)
account.addReference();
if (transferAccount != null)
... |
6014bea2-325d-49ae-8082-df2d4e851c85 | 1 | @Override
protected void parseInternal(Method method, Map<String, Integer> paramIndexes,
Map<String, Integer> batchParamIndexes) throws DaoGenerateException {
super.parseInternal(method, paramIndexes, batchParamIndexes);
// 解析Vkey的相关表达式级参数信息
if (StringUtils.isNotEmpty(vkey)) {// 对于单个缓存对象,可以允许不设置vkey
Expre... |
98e99c85-a9d6-4a94-a93c-fb050b651283 | 5 | public Main() {
setIconImage(Toolkit.getDefaultToolkit().getImage(Main.class.getResource("/net/lotusdev/medusa/client/res/keyboard.png")));
setTitle("Medusa Logger (v" + getVersion() + ")");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 488, 317);
JMenuBar menuBar = new JMenuBar();
... |
c66a78d1-303e-433f-8871-1d3b1bd4b9ec | 1 | @Override
public void writeToData(DataOut dataOut) throws IOException {
dataOut.writeInt(classes.size());
for(Class c : classes) {
dataOut.writeUTF(c.getName());
}
} |
c4377603-984b-4acc-b147-b853251a1f99 | 4 | @Override
public boolean parseField(String name, String value){
if (super.parseField(name, value)){
return true;
}
if (name != null && value != null){
PeripheralFieldHandler handler = EnumUtils.lookup(PeripheralFieldHandler.class, name);
if (handler != null){
return handler.handle(device, value);... |
99d1f27c-f2f6-45b8-bd18-2e74fd169b0a | 2 | public K getMin(){
K minKey = null;
Double minValue = Double.valueOf(Double.MAX_VALUE);
for (Map.Entry<K, Double> entry : map.entrySet()){
//if this value is less than the minValue found so far
if (entry.getValue().compareTo(minValue)<0){
minValue = entry.... |
1dcb5483-b083-406a-8b87-d9141ac1ec74 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TracksInPlaylistsEntityPK that = (TracksInPlaylistsEntityPK) o;
if (playlistId != that.playlistId) return false;
if (trackId != that.trackId) r... |
2a4cdff2-dd27-47a6-8046-1513497f4af5 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Device)) return false;
Device device = (Device) o;
if (id != device.id) return false;
if (name != null ? !name.equals(device.name) : device.name != null) return false;
if (own... |
05d0297d-cee4-4db3-9787-bf600636fdaf | 4 | public void repaint(Graphics g, int x, int y) {
painted.set(true);
Graphics2D g2d = (Graphics2D) g;
Composite previousComposite = g2d.getComposite();
int i = 0;
long timeBetween = System.currentTimeMillis() - lastLoop;
final Iterator<LogEntry> iterator = logEntries.iterator();
while (iterator.hasNext())... |
bf26159f-0914-4412-9133-721b39aaa73b | 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 fe... |
c613ef06-59a2-47cc-bedf-0f73195cd585 | 7 | public void saveModel() {
try {
if (m_fileChooser == null) {
// i.e. after de-serialization
m_fileChooser =
new JFileChooser(new File(System.getProperty("user.dir")));
ExtensionFileFilter ef = new ExtensionFileFilter("model", "Serialized weka clusterer");
m_fileChooser... |
59f5b5b4-cdee-47b3-91c8-ca316572a704 | 1 | public void workWeek() {
for (int i=0; i<5; i++)
{
this.makeShake();
}
this.earnPaycheck();
this.setEffMult(1);
} |
76383c9b-07b7-4a8f-bc3c-82d630f80a7f | 7 | public void increaseRope(int x , int y) {
if (ropelength < 125){
ropelength ++;
}
x += 1;
y += 2;
switch (ropelength) {
case 1: getWorld().addObject(rope, x, y); getWorld().addObject(ropeman, x, y+3); break;
case 25: y+= 2; getWorld().addObject... |
7d5aba5d-d45d-40b5-b231-e54d73982c6f | 0 | public Vector getInfo()
{
return v;
} |
102ed3e6-c188-4890-83db-8ebc24322b7f | 4 | public String[] getUserNames() {
ArrayList < Client > tclients = new ArrayList < Client > ();
tclients.addAll(clients);
for (int i = 0; i < channels.size(); i++) {
ArrayList < Client > clients = channels.get(i).getUsers();
for (Client c: clients) {
i... |
5f1bd7f4-72c2-420f-b43d-de659a745330 | 8 | private boolean editTypeWorkFrame(){
boolean ret = false;
String name;
int id;
if (jTableTypeWork.getSelectedRow() == -1 ){
// значит ничего не выбрали
SMS.message(this, "Вы ничего не выбрали для редактирования!");
return ret;
}
... |
62e80553-15fe-4252-a501-2591a6650306 | 5 | public boolean validMove(String world, int x, int y, int moveTileType, int currentTileType, int orgUID){
if ((lookup.invalidMoveCost != moveCost(moveTileType, orgUID)) && // If he has enough energy to move off current tile
(org.getEnergy(orgUID)>=moveCost(currentTileType, orgUID)) && // ... |
bb5f7fbc-969e-48db-a996-1dd56d69f69d | 3 | public static IPv6Network getByAddress(String address, int mask) throws NetworkException {
if ((mask < 0) || (mask > 128)) {
throw new InvalidAddressException(String.format("'%d' is not a valid IPv6 mask.", mask));
}
try {
return new IPv6Network(new BigInteger(Inet6Addres... |
8682ffea-5c4e-4597-aecd-bb1c72252837 | 2 | public List<String> purge() {
Iterator<TaskItem<R,C>> items = iterator();
List<String> results = new ArrayList<String>();
while(items.hasNext()) {
TaskItem<R,C> item = items.next();
// Leave completed tasks for results reporting:
if(!item.future.isDone()) {
results.add("Cancelling ... |
ee283a1e-f1ad-406b-b4df-5eb6b0eea2ce | 7 | public static String encrypt(String input, String key){
int inputLength = input.length();
char[] out = new char[inputLength];
int code = key.hashCode();
Character[] mapping = randomizeArray(getMasterMapping(), code);
for(int i = 0; i < inputLength; i++){
char x = input.charAt(i);
if(x < 32 && x != 9 && ... |
c9dfa8b5-241c-4429-9803-b0719b73bf86 | 3 | public TreeLinkNode connectNextLine(TreeLinkNode first) {
TreeLinkNode nextPreHead = new TreeLinkNode(0);
TreeLinkNode next = nextPreHead;
while (first != null) {
if (first.left != null) {
next.next = first.left;
next = next.next;
}
... |
c1bd3caf-34ed-4e60-ad45-e98b5256b566 | 8 | private void doDecode() {
File file = null;
showMessage("uncompressing");
try {
int retval = ourChooser.showOpenDialog(null);
if (retval != JFileChooser.APPROVE_OPTION) {
return;
}
file = ourChooser.getSelectedFile();
St... |
b0b94a1f-4f6e-4ee4-ad6d-06b65332fc67 | 6 | public CommunicationProtocol(InetAddress inetAddress, int port, UserManagement userManagement, String analyticsServerRef, String billingServerRef, Registry registry) {
this.inetAddress = inetAddress;
this.tcpPort = port;
this.userManagement = userManagement;
this.analyticsServerRef = analyticsServerRef;
this.... |
6ebc4c47-6375-4856-a337-c059d704947d | 8 | protected Class loadClassByDelegation(String name)
throws ClassNotFoundException
{
/* The swing components must be loaded by a system
* class loader.
* javax.swing.UIManager loads a (concrete) subclass
* of LookAndFeel by a system class loader and cast
* an instan... |
e6e5514b-1849-4481-85f5-df8fe275e4eb | 8 | public PogNode chooseNeighborWeighted(TreeQualifier qualifier, Random generator, double beta) {
Node editedNode = null;
boolean isAdded = false;
if (addableList.isEmpty() && removableList.isEmpty()) { // this is a null node; choose a node to add from the whole dataset
isAdded = true;... |
af3903e6-7cb7-40c8-9ccf-7ffb20e65c37 | 4 | public static void insertSort2(int[] array, int index) {
System.out.println("index == " + index);
if (index > 1) {
insertSort2(array, index - 1);
}
int i = index - 1;
int key = array[index];
while (i >= 0 && array[i] > key) {
array[i + 1] = array[i];
i--;
}
if (i != index - 1) {
array[i + 1]... |
707a7804-4746-4707-b346-c18f3b7d6c5b | 5 | private String extrahiereRichtung(Befehlszeile befehlszeile)
{
// Ist der Befehl ein Shortcut?
// o,n,s,w
String richtung = translateShortcut(befehlszeile.getZeile());
if(richtung != null)
return richtung;
// Ist der Befehl eine lange Richtung ?
// gehe …
if(befehlszeile.beginntMit(TextVerwalter.BEFE... |
f35728bc-98e4-4104-abb7-57432c13c031 | 1 | private void calculateNext() {
addPoints(next_point, point_vector, next_point);
if (!isPointLegal(next_point)) {
addPoints(starting_point, starting_point_vector, starting_point);
clonePoints(starting_point, next_point);
}
} |
7e9d1644-3be0-4822-a43c-b500ca0ff239 | 0 | public static Configuration getConfiguration() {
return configuration;
} |
6502ed25-2a8a-4f9c-885c-ce3d02a72899 | 9 | public String done ()
// count territory and return result string
// notifies BoardInterface
{
if (Pos.haschildren()) return null;
clearmarks();
getinformation();
int i, j;
int tb = 0, tw = 0, sb = 0, sw = 0;
P.getterritory();
for (i = 0; i < S; i++)
for (j = 0; j < S; j++)
{
if (P.territory(... |
a83e44a0-c6f6-4b14-ad8b-63e179ad6945 | 0 | public WindowMenuItem(String text, OutlinerDocument doc) {
super(text);
this.doc = doc;
group.add(this);
} |
78ce0d6a-b442-4d36-b8f5-d271fe74f928 | 2 | @Test
public void resolve() {
int n = 2000000;
long sum = 0;
Primes.isPrime(n);
for (int p : Primes.primes) {
if (p < n) {
sum += p;
}
}
print(sum);
} |
40c6b85a-ef4d-4313-af38-8d52c15e77ed | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(sprung)
return super.okMessage(myHost,msg);
if(!super.okMessage(myHost,msg))
return false;
if((msg.amITarget(affected))
&&(!msg.amISource(invoker())))
{
if((msg.targetMinor()==CMMsg.TYP_ENTER)
||(msg.targetMino... |
788a8249-023e-43a5-8bf5-d8ec2e22628b | 7 | @Override
public String toString(){
Date d = new Date();
d.setTime(gameActiveMs);
String res = "";
res += "Game: " + gameName + "\n";
res += "Id: " + matchId + "\n";
res += "Mode: " + gameMode + "\n";
res += "Active: " + d.toString(... |
d82ef23f-0648-4d25-a897-08e9f1c57537 | 9 | private IDAReturnValue EIDAStar(State state, long stateId, int gScore, int threshold,
Cost cost, ArrayList<Action> solution) {
// Probes the transposition table.
if (transTable.containsKey(stateId)) {
TransEntry entry = transTable.get(stateId);
... |
5290d626-971c-4c38-a250-a61d4d225c32 | 7 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VacationEntry other = (VacationEntry) obj;
if (days != other.days)
return false;
if (startDate == null)
{
if (other.startDate != null)... |
1553a633-2cab-45b9-88ad-5d6fddb65c22 | 9 | private static void sortBlock(File[] files, int start, int end, File[] mergeTemp) {
final int length = end - start + 1;
if (length < 8) {
for (int i = end; i > start; --i) {
for (int j = end; j > start; --j) {
if (compareFiles(files[j - 1], files[j]) > 0) {
final File temp = files[j];
... |
8a0377be-bcc3-4851-b1ca-2e3fe696f1a3 | 2 | private void travelTree(TreeNode node, List<Integer> result) {
TreeNode left = node.left;
TreeNode right = node.right;
//travel left
if(null != left) travelTree(left, result);
//record
result.add(node.val);
//travel right
if(null != right) travelTree(righ... |
a1416222-b9ed-4ce6-bd77-bc6b0c072c58 | 9 | public static int solution(final String s) {
// If it's empty then it's nested properly.
if (s.length() == 0) {
return 1;
}
// If not even then it can't be nested properly.
if (s.length() % 2 != 0) {
return 0;
}
char c;
Stack<Cha... |
f800297e-925c-4f25-ad2f-c326baf230e3 | 4 | public StreetConfig(SSGlobals glob) throws FileNotFoundException
{
fGlobals = glob;
fStreets = new HashMap<String, StreetTemplate>();
try
{
parse();
}
catch (ParserConfigurationException e)
{
throw new FileNotFoundException("Die Strassen-Konfigurationsdatei konnte nicht gefunden werden");
}
cat... |
e16f343e-366b-4ba3-bee3-9d113b6f948e | 9 | private static boolean isAssertionField(Exprent exprent, String classname, String key, boolean throwInIf) {
if (throwInIf) {
if (exprent.type == Exprent.EXPRENT_FUNCTION) {
FunctionExprent fparam = (FunctionExprent)exprent;
if (fparam.getFuncType() == FunctionExprent.FUNCTION_BOOL_NOT &&
... |
cc855f7c-fcdc-4bda-b2d0-9a720866352a | 0 | public int getSellerType() {
return sellerType;
} |
d04c168a-a33d-4553-a78d-7f5db9ecebfa | 0 | public Cli()
{
console = new OSConsole("Batch Sequencer");
console.setCommandListener(this);
console.login();
} |
0af270f9-c831-460d-8655-3dd6a42123fa | 3 | public static Integer getGirlToBoyRashiDistance(Rashi boyRashi, Rashi girlRashi) {
int boyNumber = boyRashi.ordinal() + 1;
int girlNumber = girlRashi.ordinal() + 1;
int distance = 0;
if (boyNumber > girlNumber) {
distance = boyNumber - (girlNumber - 1);
}
if (boyNumber < girlNumber) {
distance = (boy... |
c3e98a9d-f3c9-40af-8329-32467f71eae1 | 5 | private int no_Between (ABObject o1, ABObject o2)
{
double minX = o1.getMaxX();
double maxX = o2.getMinX();
int no = 0;
for (int i = 0; i < shelters.size(); i++)
{
ABObject o = shelters.get(i);
double _minX = o.getMinX();
double _maxX = o.getMaxX();
if (_minX <= maxX && _minX >= minX && _maxX <= ... |
0e81b57c-63cd-4bd7-a9fa-8359f0f2dee4 | 7 | private void start() throws FileNotFoundException, IOException, InterruptedException, ExecutionException {
BufferedReader brWatson = new BufferedReader(new FileReader(new File(this.inputWatson)));
String bufferedHeader = brWatson.readLine().substring(1);
for (int i = 0;;) {
List<Sequ... |
a5627b61-0eae-4376-9f54-917f4a86fd03 | 9 | public static void main(String[] args) {
int i, n;
double x, y;
System.out.println("Derivada numerica con Polinomio de Lagrange "
+ "CON 2 o 3 PUNTOS CONOCIDOS");
do {
do {
System.out.println("Escriba el numero de puntos conocidos");
... |
f812eba5-8f58-420b-a30e-20cb9af9ada4 | 4 | public void setStatus(Boolean newStatus) throws IOException {
if (status==newStatus) return;
System.out.println("Switching "+channel+" to: "+(newStatus?"ON":"OFF"));
switch (channel) {
case 'A' : switch_a(newStatus); break;
case 'B' : switch_b(newStatus); break;
}
status=newStatus;
} |
01d19c06-bd80-45eb-b6c7-02e001e0f554 | 4 | private void deleteCase4(RBTreeNode<K,V> node) {
//If sibling's tree has longer black paths
if(nodeColor(node.parent) == Color.RED &&
nodeColor(node.sibling()) == Color.BLACK &&
nodeColor(node.sibling().left) == Color.BLACK &&
nodeColor(node.sibling().righ... |
6ee5429e-c5d4-4315-8b6e-63a7566b203a | 5 | static void SPCMacro (RG2ROM program, String destination)
throws IllegalArgumentException
{
int length = program.command.length; //May or may not fit in the available 60 lines of space.
final int x_base = 127;
final int y_base = 98; //97.5 teleports into the ground below the torches.
final int z_base = -21... |
52c9d370-1135-4b7f-8515-a2776b064d89 | 8 | public void movimiento() {
int mov = (int) (Math.random() * (4 - 1 + 1) + 1);
// 1 es X positivo
// 2 es X negativo
// 3 es Y positivo
// 4 es Y negativoç
switch (mov) {
case 1:
if (x == Mundo.mundo_X - 1) {
x = 0;
... |
6ba29256-92b1-4e91-87c0-be03585b87df | 3 | public void visitLabel(final Label label) {
mv.visitLabel(label);
if (constructor && branches != null) {
List frame = (List) branches.get(label);
if (frame != null) {
stackFrame = frame;
branches.remove(label);
}
}
} |
83afbfce-f814-4583-ac95-1ed07c1a2b8a | 7 | private String[] loadConfig() {
String[] defaults = new String[] {
"ip=localhost", "port=9190", "heartbeat=1000", "pass=UNSET", "debug=false"
};
String[] data = new String[defaults.length];
try {
File folder = getDataFolder();
if(!folder.exists()) {
folder.mkdir();
}
File file ... |
b612cb6f-3bcc-43e5-9de8-fb5dcdb9aea5 | 9 | @Override
public void actionPerformed(ActionEvent arg0) {
String s = arg0.getActionCommand();// message from the clicked button
switch (s) {
case "Add New Employee":
addEmployee();
break;
case "View Current Employees":
case "Back to Employee List":
goToEmployeeListMenu();
break;
case "Save and ... |
5847ca5e-00e5-48b8-a4a5-239c297e1293 | 3 | @Override
public void run()
{
while (true)
{
lock.lock();
Socket client;
try
{
client = socket.accept();
log.debug("new client: " + client.getInetAddress().toString());
handleConnection(client);
}
catch (IOException e)
{
e.printStackTrace();
}
try
{
await.awai... |
3cc48935-d14f-4685-9c75-a28359032315 | 0 | public GlassSword(){
this.name = Constants.GLASS_SWORD;
this.attackScore = 12;
this.attackSpeed = 14;
this.money = 410;
} |
77a2ad0f-a31f-4ce8-8e1e-3dc8f02ae60b | 1 | public final void addBad(Opponent opp) {
bad[badPointer] = opp;
badPointer++;
if (badPointer == bad.length) {
badPointer = 0;
}
} |
3f4d0678-6878-4dd5-9853-fc8fe088d0a5 | 3 | public static Vector Half(Vector Vec, boolean X, boolean Y, boolean Z) {
if (X) {Vec.setX(Vec.getX()*0.5);}
if (Y) {Vec.setY(Vec.getY()*0.5);}
if (Z) {Vec.setZ(Vec.getZ()*0.5);}
return Vec;
} |
2a417ba9-5b50-4199-8c36-18966383fc62 | 3 | public void dumpRegion(String line) {
String parens = "{\010{}\010}<\010<>\010>[\010[]\010]`\010`'\010'"
.substring(options * 6, options * 6 + 6);
pw.print(parens.substring(0, 3));
Enumeration enum_ = childBPs.elements();
int cur = startPos;
BreakPoint child = (BreakPoint) enum_.nextElement();
if... |
8e5e25f3-f62f-4025-939c-19660c8d3584 | 1 | public boolean isMoving() {
return currAction == Action.MOVE || currAction == Action.MOVE_COMMITTED;
} |
67fc6a77-0fa0-407f-90b7-84813b0d2981 | 4 | public boolean hasChanged() {
if (!file.exists()) {
if (exists) {
exists = false;
return true;
}
return false;
}
if (!exists) {
exists = true;
this.timestamp = file.lastModified();
return true;
}
long current = file.lastModified();
if (current != timestamp) {
time... |
a7a5d19f-e12c-49d5-8c94-92fb0b84ce2b | 2 | public void put(int key,int value){
int hash = getHashCode(key);
if(elements[hash]==null){
elements[hash] = new LinkedNode(key,value);
}
else{
LinkedNode node = (LinkedNode)elements[hash];
if(node.put(key,value)==false) {
return;
... |
d70840c5-a1c3-42d3-8fe9-943e4cd6e7ca | 9 | public boolean outputFile(){
try {
this.outputFile = new File(outputFileName);
this.outputWritter = new BufferedWriter(new FileWriter(this.path + outputFile));
while (this.inputReader.ready()) {
String sLine = this.inputReader.readLine();
if (!sLine.equals(null) && sLine.length() >= 1) {
if ... |
891591c7-3d9f-4dbb-9485-a928920d08c0 | 2 | public static BufferedImage buildHitmap(ArrayList<Entity> props) {
BufferedImage hitmap = new BufferedImage(800, 600, BufferedImage.TYPE_BYTE_BINARY);
PathQuad.size = new Dimension(800, 600);
Graphics2D g = hitmap.createGraphics();
for(int x = 0; x<props.size(); x++) {
if(props.get(x).isSolid())
g.fil... |
402f3ba2-6820-4a67-8161-370b7f23909b | 2 | public static void writeStandardOutput() {
if (writingStandardOutput)
return;
try {
out.close();
}
catch (Exception e) {
}
outputFileName = null;
outputErrorCount = 0;
out = standardOutput;
writingStandardOutput = true;
} |
8ee3ff14-6b50-4605-896b-03987dacb221 | 8 | static int getDendrogramSize(int n) {
if (n < 2) {
return 0;
}
int cn = 2;
int cs = 50;
while (cn < n) {
cn++;
if (3 <= cn && cn <= 5) {
cs += 50;
}
if (6 <= cn && cn <= 10) {
cs += 30;
... |
fc521b74-93d7-46e0-a7dd-9b2d0df92e5a | 6 | public static void upload(){
readProjectDbInfo();
if(!Check.NULLCheck(projectName)||!Check.NULLCheck(dbconS)||!Check.NULLCheck(un)
||!Check.NULLCheck(pwd)||!Check.NULLCheck(data_db_name)||!Check.NULLCheck(channel))
return;
SFTPMultiThread.multiThreadUpload(projectNa... |
9d80ec6f-424c-4ea3-90a3-0cd1bd8c675e | 3 | public static void main(String[] args) {
ObjectOutputStream objectWriter = null;
ObjectInputStream objectReader = null;
try {
objectWriter = new ObjectOutputStream(new FileOutputStream(
"student.dat"));
objectWriter.writeObject(new Student(1, "A", "a"));
objectWriter.writeObject(new Student(2, "B", ... |
532114e1-238c-4f17-91ad-20200fcb3988 | 4 | public void reload(List<String> list) {
setEnabled(false);
// Clear out all menu items
for (int i = getMenuComponentCount() - 1; i >= 0; i--) {
remove(0);
}
// Copy from Prefs into Menu
JMenuItem mi;
for (String f : list) {
if (f == null) { // Stop on first missing
break;
}
// Drop from l... |
3649846a-7078-4e12-81f1-b4ad3a9e59d0 | 7 | public int sendMultipleQueueMessage(int priority, int receiver, int context,
String content, List<Integer> queues) {
int status = -1;
if (messageBroker == null) {
log.error("There is no broker connecting to server");
} else {
if (messageSenderBroker == null) {
messageSenderBroker = messageBrok... |
0d6343e7-1496-4737-a6ce-8fd758848981 | 7 | public void loadConfiguration(){
File fichier_language = new File(getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
Language.options().header("Supports unicode characters ! \n<3, [*], [**], [p], [v], [+], [++]");
Language.a... |
26f221d3-b8a4-4564-90c0-59e04ea94492 | 6 | public static double asinh(double a) {
boolean negative = false;
if (a < 0) {
negative = true;
a = -a;
}
double absAsinh;
if (a > 0.167) {
absAsinh = FastMath.log(FastMath.sqrt(a * a + 1) + a);
} else {
final double a2 = a * a;
if (a > 0.097) {
absAsinh = a
* (1 - a2
* (F_1... |
41413cd5-3cf0-4474-9ccc-64d9cdb51ddc | 8 | @Override
public void keyPressed(KeyEvent ke) {
if(ke.getKeyChar() == 'c') {
lastTool = curTool;
curTool = 2;
} else if(ke.getKeyChar() == 'l') {
lastTool = curTool;
curTool = 3;
} else if(ke.getKeyChar() == 'f') {
lastTool = curTool;
curTool = 1;
} else if(ke.getKeyChar() == 'd') {
lastTo... |
5c30ec02-9f90-4307-9e4f-401ee04988de | 6 | public static void main(String[] args) {
int c = 0;
double check = 0;
outerloop:
for(int a = 1; a < 1000; a++)
{
for(int b = 1; b < 1000; b++)
{
check = Math.sqrt((a * a) + (b * b));
c = (int) Math.sqrt((a * a) + (b * b));
if(check == c)
{
if(a + b + c == 1000 && a < b && b < c)
... |
ed75727d-a1ca-4d8a-868a-f733b6289807 | 2 | public static void main(String[] pArgs) {
try {
TableViewColumn[] columns =
{
new DefaultTableViewColumn(
"Name",
Row.class.getDeclaredMethod("getName", null),
Row.class.getDeclaredMethod("setName", new Class[] {String.class})),
new DefaultTableV... |
af72daa7-e243-4e36-a5f6-8fb6bd52e9c9 | 0 | public void setTrainNumber(TrainNumber value) {
this._trainNumber = value;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.