method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1cd51a49-ab40-4f41-bc81-7d08e2e6d40c | 2 | public static void load(String configFilename) throws UnsupportedEncodingException, IOException, ClassNotFoundException, SQLException {
Application.configFilename = configFilename;
InputStream inStream = new FileInputStream(Application.configFilename);
properties = new Properties();
properties.load(new InputSt... |
0091125d-2001-4fd7-bbba-662a4f945c24 | 2 | public BTPosition<T> checkPosition(Position<T> p)
throws InvalidPositionException {
if (p == null || !(p instanceof BTPosition)) {
throw new InvalidPositionException("Position is invalid");
}
return (BTPosition<T>) p;
} |
c0b85d95-474a-4c37-83df-1510c3761d15 | 6 | private List <String> readFile(String filePath){
List <String> res = new ArrayList <String> ();
BufferedReader buffReader = null;
try{
buffReader = new BufferedReader (new FileReader(filePath));
String line = buffReader.readLine();
boolean needConcat = false;
while(line != null){
if(needConcat){
... |
cee474b0-cb09-45af-99bd-d43c35b8274d | 4 | void inBounds(){
if(posX < 0 || posX > screenWidth){ reset(); }
if(posY < 0 || posY > screenHeight){ reset(); }
} |
4842c4de-0e57-48fd-86b6-f8f419a6b8b0 | 4 | public boolean equals(Object o) {
if (o == null)
return false;
if (this == o)
return true;
if (!(o instanceof SamplePrincipal))
return false;
SamplePrincipal that = (SamplePrincipal)o;
if (this.getName().equals(that.getName()))
return true;
return false;
} |
ddfcd9a4-139b-47de-bf01-5669469c486c | 5 | public void run(){
long previousUpdate = 0;
while (true){
long timeElapsed = System.currentTimeMillis() - previousUpdate;
if (timeElapsed > UPDATE_INTERVAL){
synchronized (key) {
player.step(everything);
for(Entity e : this.entities){
if(e instanceof Enemy){
e.step(everything);... |
6bcf3103-8dae-4d23-8a42-ef037a565759 | 6 | public static void main(String[] args) {
//new file that we are getting data from
Scanner inFile = null;
try {
// Create a scanner to read the file, file name is parameter
inFile = new Scanner(new File(System.getProperty("user.dir") + "/src/Files/prog349f.dat"));
} catch (FileNotFoundException e) {
Sys... |
991a4c58-e5ab-4fcb-b6f5-5887ac808aed | 7 | private static void printIds(ComponentVersionBI comp) throws IOException {
// Ids
int nid = comp.getNid();
UUID primUuid = comp.getPrimordialUuid();
List<UUID> uuids = comp.getUUIDs();
Collection<? extends IdBI> ids = comp.getAllIds();
System.out.println("Nid: " + nid + " and primUuid: "
+ primUuid.to... |
3c5061fa-4046-46a1-aeed-fc722464eb51 | 0 | public OutlinerDocument getOutlinerDocument() {
return (OutlinerDocument) super.getDocument();
} |
59be231c-8ce0-4911-bc5d-d0693d9f2299 | 5 | public static void update(RenderingEngine renderingEngine)
{
if(canvass.getParent().getHeight() != canvass.getHeight() || canvass.getParent().getWidth() != canvass.getWidth())
{
try {
Display.setDisplayMode(new DisplayMode(canvass.getParent().getWidth(), canvass.getParent().getHeight()));
glViewport(0, ... |
53e390a4-57cb-4ff8-878b-2ccb84c27f59 | 9 | private boolean getGameInformation(NetworkStream toServer) {
try {
toServer.getChannel().write(new RequestEntityPacket(toServer, 0).getDataBuffer());
TCP_Packet shouldBeSyncMapPacket = null;
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < MAX_WAIT) {
toServer.upd... |
87be0cdf-b3c8-4223-858c-cd31cf6dbac0 | 7 | public User startSystem(String email, String name, String username,
String password) {
try {
sql.Query.initDB();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (!TextVerifier.verifyN... |
cbde03f6-5d7a-4114-a765-6f97aa8590a5 | 1 | public static void handleMode(String params) {
String errorMessage = "Nesprávná syntaxe příkazu: /mode #kanál mód";
String match = "#\\w+ .+";
if ( !params.matches(match) ) {
appendError(errorMessage);
return;
}
String[] parts = params.split(" ", 2);
... |
c7d8a873-6c3c-4b47-b749-8ce3704278e9 | 8 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ServletContext ctx = this.getServletContext();
HttpSession session = request.getSession();
RequestDispatcher dispatcher = null;
String command = request.getParameter("command");
System.out.pr... |
a7fcb776-5efe-4900-8c3c-6f212884924d | 6 | private Tile selectFieldType( int colorValue, int x, int y )
{
Color color = new Color(colorValue);
if ( floorColorValue.equals(color) )
{
return new Floor();
} else if ( wallColorValue.equals(color) )
{
return new Wall();
} else if ( openDoorColorValue.equals(color) )
{
return new Door(true);
... |
b5897af9-c82e-42b2-87e3-4a5b3c3ced7a | 9 | @SuppressWarnings("unchecked")
private void setInputFile() {
int returnVal = fileChooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
kwa.createProgressBar();
params = new ParameterSet(); // Resets all parameters
// TODO Reset the GUI to match the newly reset parame... |
f6e13c89-7d9f-490c-92fa-d2b83b08ebc3 | 2 | public void testPropertyCompareToDayOfYear() {
DateTime test1 = new DateTime(TEST_TIME1);
DateTime test2 = new DateTime(TEST_TIME2);
assertEquals(true, test1.dayOfYear().compareTo(test2) < 0);
assertEquals(true, test2.dayOfYear().compareTo(test1) > 0);
assertEquals(true, test1.da... |
46eb899f-4314-430f-8cfa-72019710bb54 | 3 | protected Element createBlockElement(Document document, TMState block,
Automaton container) {
Element be = createElement(document, BLOCK_NAME, null, null);
be.setAttribute(STATE_ID_NAME, "" + block.getID());
if (block.getName() != null) be.setAttribute(STATE_NAME_NAME, "" + block.getName());
be.appendChild(c... |
2b5829ed-040a-4d5e-9778-a69ed3ed0480 | 8 | public static void generate(int n) {
if(n==1) { oneprime(); }
if(n==2) { twoprime(); }
if(n==3) { threeprime(); }
if(n==4) { fourprime(); }
if(n==5) { fiveprime(); }
if(n==6) { sixprime(); }
if(n==7) { sevenprime(); }
if(n==8) { eightprime(); }
} |
58ca38c8-706a-4251-8730-ee36016ba572 | 7 | private void pollKeyboard() {
// if (input.isKeyDown(KeyEvent.VK_ADD)) backgroundMusic.setGainLevel(backgroundMusic.getGainLevel() + 0.7f);
// if (input.isKeyDown(KeyEvent.VK_SUBTRACT)) backgroundMusic.setGainLevel(backgroundMusic.getGainLevel() - 0.7f);
if (input.isKeyReleased()) {
if... |
d577d55e-414e-45c2-8f15-6f598f945562 | 5 | public int binarySearch(int searchElement) {
int low = 0;
int high = data.length -1;
int middle = (low+high) / 2;
int location = -1;
do{
System.out.print(""+remainingElements(low,high));
for(int i = 0; i < middle; i++) {
... |
7723b09b-1917-4a7e-87c0-9e45c35077e5 | 7 | public ChunkPosition getNearestInstance(World par1World, int par2, int par3, int par4)
{
this.worldObj = par1World;
this.rand.setSeed(par1World.getSeed());
long var5 = this.rand.nextLong();
long var7 = this.rand.nextLong();
long var9 = (long)(par2 >> 4) * var5;
long v... |
597a82e5-ed6d-4375-8e5f-13c7ddeba633 | 1 | @Override
public void rollbackTrans() throws Exception {
try {
oConexionMySQL.rollback();
} catch (SQLException e) {
throw new Exception("Mysql.rollbackTrans: Error en rollback: " + e.getMessage());
}
} |
4bfa8e3d-877a-45a5-a15d-9519e4db1cba | 9 | protected String getPairValueFromXML(XPath xpath, String path, Document doc) {
if (doc == null || xpath == null || path == null) {
return "";
}
try {
XPathExpression expr = xpath.compile(path);
Object res = expr.evaluate(doc, XPathConstants.NODESET);
... |
a308b568-e920-4c7e-b22a-0f1cb1affa0f | 7 | public static void main(String[] args) {
/* Get all abundant numbers */
List<Integer> abundantNumbers = new ArrayList<Integer>();
for (int i = 1; i <= 28123; i++) {
if (isAbundant(i))
abundantNumbers.add(i);
}
/* Get all of the numbers which are sums of all of the abundant numbers */
Set<Integer> ab... |
6126e47d-9a34-4f39-864f-58ceb56058d8 | 7 | protected synchronized void executeQuieries() {
if (!m_queries.isEmpty())
{
String query = null;
Statement statement = null;
Connection connection = getConnection();
try {
if (connection == null) {
Utilities.outputError("Could not connect to database.");
return;
}
sta... |
19cf0709-b6c3-4be2-80ee-eff1f9bf1630 | 3 | int syncHeader(byte syncmode) throws BitstreamException
{
boolean sync;
int headerstring;
// read additional 2 bytes
int bytesRead = readBytes(syncbuf, 0, 3);
if (bytesRead!=3) throw newBitstreamException(STREAM_EOF, null);
headerstring = ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF0... |
b09d2622-6c73-432f-b962-73ca2f9804f9 | 3 | public boolean isect(Coord c, Coord s) {
return ((x >= c.x) && (y >= c.y) && (x < c.x + s.x) && (y < c.y + s.y));
} |
a1c84d0a-cec2-410c-a886-820fbaf97c18 | 5 | public void selectionSortA(T[] arreglo,int tamaño){
int tmp;
for(int i=0;i<tamaño;i++){
tmp=i;
for(int j=i+1;j<tamaño;j++){
try {
if((Integer)arreglo[j]<(Integer)arreglo[tmp]){
tmp=j;
}
... |
ce581bb7-612e-4faa-8e14-292d70132278 | 0 | public void setFecha(int fecha) {
this.fecha = fecha;
} |
3a85f196-942b-4f45-907d-51527bd4fa90 | 5 | public static boolean compare(Player player, EnumSkill skill) {
if (inGamePlayers != null && player != null && skill != null) {
EnumSkill skills = inGamePlayers.get(player.getName());
if (skills != null) {
if (skills.equals(skill)) {
return true;
}
}
}
return false;
} |
bf582b3f-886a-4c99-acb6-0bb58c856a9e | 1 | @Override
public void valueChanged(ListSelectionEvent event) {
if (!event.getValueIsAdjusting()) {// to prevent duplicate selection same element in list click
Planner.getFlight(((JList) event.getSource()).getSelectedIndex());
}
} |
0a88ff7a-e39f-4adb-88ad-7003e12a7d7b | 1 | public JsonUrlEvent(String text, String value) {
this.text = text;
if (!value.startsWith("http://")) value = "http://" + value;
this.value = value;
} |
e1746508-9208-4284-8c60-c6fbb23e9dc9 | 2 | public static void studentMainMenu() throws IOException, Exception {
InputStreamReader in = new InputStreamReader(System.in);
BufferedReader keyboard = new BufferedReader(in);
int choice = 0;
while (choice!=2) {
System.out.println("~~~~~Student~~~~~");
System.out.... |
d1a85dc9-7262-448f-80e7-bf2643c6e923 | 5 | protected void preDraw(Graphics2D G, Camera camera) {
saveTransform = G.getTransform();
Point2D.Float relativeHeading = null;
if (m_showHeading && (m_heading != null)) {
relativeHeading = new Point2D.Float.Float(
m_heading.x - x,
m_heading.y - y);
// absolute drawing in the screen coordinate sys... |
abfde7f0-6077-4513-8183-59fd8a8a8ad5 | 3 | protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String, Object> args) {
try {
return ctor.newInstance(args);
} catch (Throwable ex) {
Logger.getLogger(ConfigurationSerialization.class.getName()).log(
... |
236cde87-c7d9-4d94-bfc8-acaabf31a935 | 4 | public static void main(String args[]) {
try {
// Quaqua Look and Feel
javax.swing.UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
// Liquid Look and Feel
com.birosoft.liquid.LiquidLookAndFeel.setLiquidDecorations(true, "panther");
} ca... |
9d5643a4-14b8-4ac8-b5c2-d368418bf985 | 1 | public Teacher setCWWH(Time aCWWH) {
this.currentWeekWorkedHours = aCWWH == null ? new Time() : aCWWH;
return this;
} |
a4baff41-aed5-46ae-b979-2a13188c8a2f | 4 | public void setBaseTile(String baseTileType){
if(baseTileType.equals("DesertTile1")){
isPassable = true;
addTileGraphic("DesertTile1",0,0);
}else if(baseTileType.equals("DesertTile2")){
isPassable = true;
addTileGraphic("DesertTile2",0,0);
}else if(baseTileType.equals("DesertTile3")){
isPassable = ... |
2b22c4c8-2efc-492b-a5da-b91bd6d0b897 | 8 | @Test
public void FBMasiva() {
try {
gateway.init();
// log.debug("Sleeping for "+sleepTime+" secs due to ESPHORA reconnection problem");
// int sleepMillis = sleepTime * 1000;
// Thread.sleep(sleepMillis);
log.debug("Generando Lote Facturas B iva no discriminado");
List<FB> facturasB = new ArrayL... |
2d8dde7d-3ca8-4d06-8203-0a3b477bf27a | 6 | public static void changer(){
try {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = chooser.showOpenDialog(new JFrame());
if (returnVal == JFileChooser.APPROVE_OPTION && chooser.getSelectedFile().isDirectory()) {
String lien =cho... |
44421a39-87b1-47e1-a89c-cecd9203d813 | 4 | public void parsePhrase()
{
swpPhr1 = new String[3];
conPhr1 = new String[3];
nrPhr1_9 = new String[10];
nrPhr1_19 = new String[10];
nrPhr1_90 = new String[8];
nrPhr1_900 = new String[9];
nrPhr1_9000 = new String[9];
swpPhr2 = new String[3];
conPhr2 = new String[3];
nrPhr... |
667a39c8-7e6f-4e27-a757-b71c2c07bccc | 6 | public int run(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Usage: <input_file> <output>");
return 2;
}
Job job = new Job(getConf(), "SimplePageRank");
job.setJarByClass(PageRankTool.class);
job.setMapperClass(PageRankMap... |
de878b88-e6d2-43af-b9d3-cdf5d80774b1 | 4 | private void startXmlDefault(String name, Attributes attrs) {
// decide on which default object is to be modified
// then call the method which modifies it
if (name.equals("slidedefault")) {
overwriteSlideDefault(attrs);
} else if (name.equals("textdefault")) {
overwriteTextDefault(attrs);
} else if (na... |
ae2f5627-ffe1-4bf8-8b28-159fc205fb8d | 5 | public boolean knightMove(int startRow, int startCol, int endRow, int endCol) //NEED TO FIX, maybe the rest below are bugged too
{
Piece piece = checker[startRow][startCol];
Piece endTile = checker[endRow][endCol];
int horizAbs = Math.abs(endRow-startRow);
int vertAbs = Math.abs(endCol-startCol);
if(en... |
d89b40c7-2548-4767-aa17-344faf5a011d | 9 | private void drawFastJuliaPolarAntialiasedBruteForce(int image_size) {
double size = fractal.getSize();
double xcenter = fractal.getXCenter();
double ycenter = fractal.getYCenter();
double start;
double center = Math.log(size);
double f, sf, cf, r, sf2, cf2, r2;
... |
191373cd-e610-4f1a-a78a-8ffa7041b11d | 3 | @Override
public E get()
{
// double checking
if (value == null)
{
synchronized (this)
{
if (value == null)
{
try {
this.wait();
} catch (InterruptedException e) {
}
}
}
}
return value;
} |
e4af68af-50e4-4b16-9a18-9ec71d1a2a64 | 7 | private ArrayList<Point> checkLine(int sX, int sY, int dX, int dY, int type) {
ArrayList<Point> ret = new ArrayList<Point>();
for (int i = 0; i < 2; i++) {
int cX = sX + dX;
int cY = sY + dY;
while (cX >= 0 && cX < _nX && cY >= 0 && cY < _nY &&
_state[cY][cX] != null && compTypes(type, _state[cY][c... |
c99541e1-d0b9-47f9-94b7-170931c55aea | 9 | public void paint(LedGraphics lg) {
if(menu || --sleepCounter >= 0) {
drawMenu(lg);
return;
}
switch(modus) {
case 1: case 2: case 3: case 4: case 5:
TesterLedFramework.getInstance().paint(lg);
break;
case 6:
BoardSnake.getInstance().paint(lg);
break;
case 7:
HeliShooterBoard.getInst... |
35ee66d1-d0d6-4420-afd3-ee6dc93c5e91 | 3 | public static <T> ArrayList<T> leerObjetos( String nombreArchivo) throws FileNotFoundException, IOException, ClassNotFoundException
{
ObjectInputStream objectInput;
ArrayList<T> lista = new ArrayList<T>();
FileInputStream fileInput = new FileInputStream( nombreArchivo);
// Se comprueba si ek archivo es vaco... |
c0e46989-7f2a-4084-a24d-f380434c0bdf | 9 | public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> res = new ArrayList<Integer>();
if (root==null) return res;
TreeNode pre = null;
TreeNode cur = root;
Stack<TreeNode> s = new Stack<TreeNode>();
s.push(root);
while (!s.isEmpty())
{
cur = s.pop();
if((cur.right=... |
4d7e3148-5b8b-46a6-84a9-acfc2dd7eb66 | 6 | private int nextLesserThan8Bits(int bitsToGet) {
byte b;
byte next;
int l = data.length - 1;
int bp = this.bytePointer;
if (fillOrder == 1) {
b = data[bp];
if (bp == l) {
next = 0x00;
} else {
next = data[bp + 1];
}
} else if (fillOrder == 2) {
b = flipTable[data[bp] & 0xff];
if (... |
2082fd72-84c4-4e41-9777-1f89ebfd4fce | 6 | public Value merge(final Value v, final Value w) {
SourceValue dv = (SourceValue) v;
SourceValue dw = (SourceValue) w;
if (dv.insns instanceof SmallSet && dw.insns instanceof SmallSet) {
Set s = ((SmallSet) dv.insns).union((SmallSet) dw.insns);
if (s == dv.insns && dv.siz... |
616362c3-61de-460c-9623-bf86fc04eacb | 7 | public static void minimalDuplicationLength(String[] args) {
if (args.length != 1) {
System.out.println("Please call with exactly 1 argument");
return;
}
final String ID = args[0];
ExecutorService exec = Executors.newFixedThreadPool(Runtime
.getRuntime().availableProcessors());
System.out.println("... |
1b9b93c5-9e0f-4652-b0dc-827e6639ec8b | 4 | private void parseFile() {
byte[] saveFileContent = FileUtil.readFile(savegame);
if(saveFileContent == null)
return;
this.saveFileAdapter = new SaveFileAdapterAndroid(saveFileContent);
try {
this.saveFileAdapter.decrypt();
} catch(Exception e) {
... |
c1504045-bcf2-48cb-a1c5-a0aff55eb415 | 2 | private boolean containsWall(List<Element> elements) {
for (Element e : elements)
if (e instanceof Wall)
return true;
return false;
} |
21950aa1-b45a-408d-8305-ea6dcaed0b29 | 4 | private void listen() {
try {
int buffLen = GlobalConfig.MAX_BYTES_IN_PACKAGE;
byte[] buff = new byte[buffLen];
DatagramPacket received = new DatagramPacket(buff, buffLen);
while(!shuttingDown) {
socket.receive(received);
lastDatagram = received;
interpretDatagram(received);
}
... |
1468ee0a-5dee-47c0-b46c-51582d19fd17 | 5 | public void testChronology() {
int iterations = iIterations;
long seed = iSeed;
String modeStr;
if (iMode == GREGORIAN_MODE) {
modeStr = "Gregorian";
} else {
modeStr = "Julian";
}
System.out.println("\nTesting " + modeStr + " chronology o... |
f2434c55-ab3f-4139-98b1-21e2893f82fd | 2 | static double[][] cofactor(double[][] A){
double[][] B = new double[A.length][A.length];
for(int i = 0; i < A.length; i++){
for(int j = 0; j < A.length; j++){
B[i][j] = Math.pow(-1,i+j)*det(minor(A,i,j));
}
}
return B;
} |
d5446221-4434-421e-a163-9da5ee785052 | 5 | public String readLine() throws IOException {
final StringBuilder lineBuilder = new StringBuilder(lengthOfLastLine);
final StringBuilder eol = new StringBuilder(2);
int status = reader.read(characterBuffer, 0, 1);
if (status == -1) {
lastLineByteCount = 0;
return null;
}
while (status != -1) {
f... |
13604955-b6aa-46a7-bcb5-bd83299a83a0 | 0 | public int getDepartmentId() {
return departmentId;
} |
029d1438-cfb2-4f34-b667-6a4a68f967e5 | 7 | @Override
public boolean equals(final Object other) {
if (this == other) {
return true;
}
if (!(other instanceof Transaction)) {
return false;
}
Transaction trans = (Transaction) other;
return this.state == trans.state && this.amount == trans.amount
&& this.clientEmail.equals(trans.clientEmai... |
df5d339b-32ad-41bb-b7f7-d649677b8bb6 | 0 | @Override
public String getMobile() {
return super.getMobile();
} |
f7e02283-6a3a-4e27-a0f8-3fb13c4c4efa | 1 | private static void renderRewards(int lines){
int x = Game.PLAYER.getCameraX();
int y = Game.PLAYER.getCameraY();
Item[] rewards = selectedQuest.getReward();
lines++;
Font.renderColored("Belohnungen:", x + Game.SCREEN_WIDTH/2-2*32 + 8, y + Game.SCREEN_HEIGHT/2+5*32 - 16 - lines* 16, 1, 0.2f, 0.2f, 0.2f)... |
156e141b-3668-4dd4-949d-3bdf34ac0750 | 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(); ... |
2baaf771-1f79-45e0-8cff-33dcc47c6742 | 8 | public void display()
{
if(Debug.imagePlayer) System.out.println("Imageplayer display called");
//Check if the host size has changed since instantiation/hiding
Boolean hostChanged = false;
if(inScrollPane)
hostChanged = (hostSize.width != scrollPanel.getWidth() ||
hostSize.height != scrollPanel.get... |
13971331-89e6-4b64-acae-a242c651ecc7 | 1 | @Override
@Before
public void setup () throws IOException {
String explicitPort = System.getProperty("org.newsclub.net.unix.testport");
if ( explicitPort != null )
this.port = new Integer(explicitPort);
else
this.port = 14842;
this.server = new ServerSock... |
e256f509-76f4-4c01-9564-85fd5c195b2c | 0 | @Override
public void setPostalCode(String postalCode) {
super.setPostalCode(postalCode);
} |
192db773-7730-40ad-a240-08075cec33f6 | 5 | public boolean allShipsSunk() {
int count1 = 0; // count how many ships' positions in sea field
int count2 = 0; // count how many times bomb hits the ship;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (!seaPosition[x + y * height].getValue()... |
e8669536-8b69-41a1-9af4-72bd739a469e | 4 | private boolean markeAlignements(boolean[][] marked) {
boolean markedAlignements = false;
for (int i = 0; i < marked.length; i++) {
for (int j = 0; j < marked[i].length; j++) {
if (horizontalAligned(i, j)) {
marked[i][j] = marked[i + 1][j] = marked[i + 2][j] = true;
markedAlignements = true;
... |
5e05981a-62d0-418e-90a8-4ee6ded0f7af | 2 | private boolean isSilentStart(String value) {
boolean result = false;
for (int i = 0; i < SILENT_START.length; i++) {
if (value.startsWith(SILENT_START[i])) {
result = true;
break;
}
}
return result;
} |
a75a6c0c-5be0-4239-a0c2-b0bec6c1e640 | 8 | public static SingleDockableContainer applyDockingAction(Dockable dockable, DockingActionEvent action) {
SingleDockableContainer dockableContainer;
switch(action.getActionType()) {
case DockingActionEvent.ACTION_ADD_DOCKABLE:
DockingActionAddDockableEvent addAction = (DockingActionAddDockableEvent) action;
... |
b1386118-cd94-4cb1-8305-735b314a8c0c | 3 | public static void main(String[] args) throws Exception
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sName = reader.readLine();
String sName2 = reader.readLine();
if (!sName.equals(sName2))
{
if (sName.length() == sName... |
cbdcd911-1101-471c-b320-5a3651d1100b | 1 | void enviarJugada(PartidaChip partida) {
try {
Socket cli = new Socket("192.168.1.204", 9001);
System.out.println("[]-->Enviando: " + partida.getMensaje()
+ " al servidor.");
// System.out.println(bean.getMensaje());
ObjectOutputStream flujo_objetos = new ObjectOutputStream(
cli.getOutputStrea... |
5066dfcf-7271-48b9-bb1b-f2fddafe7592 | 9 | public static void run(ArrayList<double[]> bows1, ArrayList<double[]> bows2 , ArrayList<Double> pairDesc,String distmean,String gamma,boolean bComptuteMeanDist,boolean norm_L2) {
ArrayList<ArrayList<double[]>> bows = new ArrayList<ArrayList<double[]>> ();
ArrayList<ArrayList<double[]>> bowsOut = new ArrayList<Array... |
32a7eb10-ea37-4964-872a-8b01dcb5477e | 0 | public void setSellers(List<IautosSellerInfo> sellers) {
this.sellers = sellers;
} |
738b275e-7eee-4a6a-bd39-e36e1e4eeff4 | 5 | private ListNode getNode(int index)
{
// stores current node
ListNode p;
// throw exception if invalid index
if(index < 0 || index > size())
throw new IndexOutOfBoundsException("getNode index: " + index + "; size: " + theSize);
// determine which end of this CircularLinkedList to start traversal
if(in... |
ce2eb4dc-e03e-4264-905e-7c212e17d2b2 | 2 | public <C extends StatefulContext> void callOnStateEntered(StateEnum state, C context) throws Exception {
Handler h = handlers.get(new HandlerType(EventType.STATE_ENTER, null, state));
if (h != null) {
ContextHandler<C> contextHandler = (ContextHandler<C>) h;
contextHandler.call(... |
5f0c719d-4996-49fe-99ff-6ab499034d72 | 9 | public static void main(String args[]) {
if (args.length > 0) {
if (args.length > 1 || args[0].equals("-help"))
Usage();
else
try {
port = Integer.parseInt(args[0]);
if (port < 1)
port = Constants.DEFAULT_PORT;
} catch (NumberFormatException e) {
Usage();
}
}
BufferedRea... |
7fa7a94a-a61f-4f18-a46d-2560cbace960 | 7 | public static void main(String[] args) throws Exception
{
int numInterations = 20;
TwoStateModel tsm = new TwoStateModel();
MarkovChainLink[] chain =
GenerateMarkovChainFromModel.generateMarkovChain(tsm, numInterations);
String[] emissions = new String[numInterations];
int x=0;
for( MarkovCha... |
5517ee50-2315-4ec2-ac3b-b2a30568cda9 | 1 | public boolean fromElement(Element element) {
boolean result = true;
doSql = X.getFirstChildText(element, C.doSql, null);
undoSql = X.getFirstChildText(element, C.undoSql, null);
result = !U.hasNull(doSql, undoSql);
if (!result) {
logger.error("Error parsing <sql>:" + element);
}
retur... |
d8a1f3e2-84ad-4484-ab50-d612dc3ed138 | 0 | public AprilonIrc getParent(){ return Parent; } |
9bd4fd47-30e0-4f72-b488-a432aefc6bf0 | 7 | public void method276(int i, int j)
{
Ground class30_sub3 = groundArray[0][j][i];
for(int l = 0; l < 3; l++)
{
Ground class30_sub3_1 = groundArray[l][j][i] = groundArray[l + 1][j][i];
if(class30_sub3_1 != null)
{
class30_sub3_1.anInt1307--;
for(int j1 = 0; j1 < class30_sub3_1.anInt1317; j1++)
... |
e779bd61-ac2c-4fe8-82f5-940859827c8e | 9 | public JSONObject toJSON() {
JSONObject obj = new JSONObject();
if (ktivMale.length() != 0) {
obj.accumulate("ktivmale", ktivMale);
}
if (!"".equals(pronunciation)) {
obj.accumulate("pronunciation", pronunciation.replaceAll("\n", ""));
}
if (!"".... |
d5478aef-8d68-4c7e-add0-a1867b632b91 | 0 | public Section(int id ){
this.id = id;
} |
249a0e70-a2e2-4dae-8800-2ada2ee7fc9d | 8 | private boolean readFeed()
{
try
{
// Set header values intial to the empty string
String title = "";
String link = "";
// First create a new XMLInputFactory
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
// Setup a new eventReader
InputStream in = read();
if(in != null)
{... |
9ee1df66-b529-4b6e-a4c2-90f0e49d6d22 | 8 | public void dealCards() {
List<Enums.Weapon> weaponCards = Enums.Weapon.toList();
List<Enums.RoomName> roomCards = Enums.RoomName.toList();
for (int i = 0; i < roomCards.size(); i++)
if (roomCards.get(i) == Enums.RoomName.SWIMMING_POOL) {
roomCards.remove(i);
break;
}
List<Enums.Character> charac... |
114918e7-b808-48bb-9d01-345b5f7260cb | 9 | public void broadcast(String message) {
String token;
// String user;
// user = "";
token = "";
StringTokenizer st = new StringTokenizer(message, " ");
//System.out.println("connie heard "+st.nextToken("\r\n"));
if (st.hasMoreTokens()) {
// user = st.nextToken();
}
if (st.... |
9b3d2917-253a-4fcb-a5a0-e7222cae4a80 | 5 | public void print() {
String nullString = "null";
if (root != null) {
int treeDepth = root.depth();
List[] levels = new List[treeDepth];
for(int i = 0; i < levels.length; i++){
levels[i] = new ArrayList<Node>();
}
levels = getLevelsList(levels);
//Actually print everything.
for(int i = ... |
746a9db6-1255-4442-a267-b41ffe839811 | 8 | public void startMovingToTarget(float maxVelocity)
{
// LET ITS POSITIONG GET UPDATED
movingToTarget = true;
// CALCULATE THE ANGLE OF THE TRAJECTORY TO THE TARGET
float diffX = targetX - x;
float diffY = targetY - y;
float tanResult = diffY/diffX;
... |
6d22947c-9be1-49f8-b86b-c236a0857bcc | 0 | public String toString()
{
return myText;
} |
5fd272c8-fd44-42a4-93d1-442135c784eb | 8 | private void drawShapes(Graphics gx) {
//FastVector tmp = m_plot.getShapes();
if (m_shapes != null) {
FastVector stmp;
int x1, y1, x2, y2;
for (int noa = 0; noa < m_shapes.size(); noa++) {
stmp = (FastVector)m_shapes.elementAt(noa);
if (((Double)stmp.elementAt(0)).intValue() == 1) {
//t... |
29f66965-f8aa-4966-b19e-875040c5c164 | 3 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if(command.getName().equals("bulka"))
{
if(args.length < 2)
return false;
if(args[0].equals("build"))
return build(args);
}
return fa... |
11368a32-668f-4f56-b0ac-246de36edced | 9 | public void run() {
String inputLine = null;
while (!halted) {
try {
inputLine = in.readLine();
if (inputLine == null) {
if (DEBUG) {
System.out.println("No input, closing");
}
halt();
} else {
if (DEBUG) {
System.out.println(inputLine);
}
Console.processInco... |
3362c73b-d0d8-4864-b5cd-6fb5e8dac5ca | 5 | public void setSelected(boolean selected) {
this.isSelected = selected;
if (GeoLocationPanel.selectedPanel != this && isSelected()) {
if (GeoLocationPanel.selectedPanel != null)
GeoLocationPanel.selectedPanel.toggleSelection();
GeoLocationPanel.selectedPanel = this;
} else if (GeoLocationPanel.selec... |
027cdb27-6b4b-49f8-b06c-c92d1c0d3a6f | 4 | private static Connection connect() throws SQLException, ClassNotFoundException {
if (dbConnection != null && !dbConnection.isClosed()) {
return dbConnection;
}
log.debug("Opening database connection...");
try {
Class.forName(dbProperties.getProperty("derby.driver"));
dbCo... |
22d82b0b-7017-4946-8e2a-10b81cb22b43 | 1 | public void addToGoldCarried(int val){
iGoldCarried += val;
if(iGoldCarried < 0) iGoldCarried = 0;
} |
c83b2d08-819a-4fc0-9e3f-f306358a74e3 | 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... |
75b4943b-918d-4a45-bcb0-1f136abc613c | 2 | private boolean validTargetDistance(Sprite s){
boolean returnVal = false;
if(s != null && distanceBetween(this, s) < TURRET_REACH) returnVal = true;
return returnVal;
} |
175052da-7cfa-4b4c-94df-8c9f1be29841 | 8 | static BitOps bitOps(Object x){
Class xc = x.getClass();
if(xc == Long.class)
return LONG_BITOPS;
else if(xc == Integer.class)
return LONG_BITOPS;
else if(xc == BigInt.class)
return BIGINT_BITOPS;
else if(xc == BigInteger.class)
return BIGINT_BITOPS;
else if(xc == Double.class || xc == Float.class || xc ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.