method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3b810c1c-1505-424c-8bd6-eba8cf6ebc3f | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=getTarget(mob,mob.location(),givenTarget,commands,Wearable.FILTER_ANY);
if(target==null)
{
return false;
}
if((!(target instanceof Item))
||(((((Item)target).material... |
b519cace-b5f5-47c1-a747-3c4f80ba0680 | 0 | public void setCreateDateGmt(Timestamp createDateGmt) {
this.createDateGmt = createDateGmt;
} |
5a5f9c95-2eb5-4f06-9b6b-16604ffd8e72 | 6 | public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Arguments: <server> <port>");
return;
}
try {
server = args[0];
port = Integer.parseInt(args[1]);
if (port < 0 || port > 65535) {
throw new NumberFormatException();
}
socket = new Socket(server... |
34957c6f-41fb-42b0-8a52-55252c8d623d | 7 | static double changes(double was, double is) {
if (was == 0)
return 1;
if (is == 0)
return -1;
if (was == -1e-7 || is == -1e-7
|| (int) (1e9 * ((is - was) / was)) == -9999 || was < 0
|| is < 0) {
// System.out.println("PERCENTAGE CHANGE ERROR VALUE: -1E-7");
return -1e-7;
}
return (is - w... |
5459313e-812d-425b-8798-912853d1bd78 | 2 | @Override
public int getHeight() {
int height = 0;
for (UiGlyph uiGlyph : this.uiGlyphs) {
if (height < uiGlyph.getGlyph().getHeight()) {
height = uiGlyph.getGlyph().getHeight();
}
}
return height + util.Constants.newLineGap;
} |
dfeb50c9-02f7-47f1-82b3-edfdb82447c1 | 0 | @AfterClass
public static void tearDownClass() {
} |
57a3d86e-9f1a-4bac-a02d-32d022a6aab7 | 7 | public static void startupWhynot() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Modul... |
05c752d3-f996-406e-b9e0-3ad0768e8d0f | 3 | public void FixCSV2(String filePath, boolean isFixHeader) throws FileNotFoundException, IOException{
FileManager fm = new FileManager();
fm.copy(filePath, "c:/temp",true);
File theFile = new File("c:/temp");
FileReader readerFile = new FileReader(theFile);
BufferedReader... |
811a4fc3-ab3f-48e3-b49a-4c7fac9b7502 | 2 | public void close()
{
try{
if (myInput != null) {
myInput.close();
}
}
catch (java.io.IOException ioe){
throw new RuntimeException("error closing bit stream " + ioe);
}
} |
60e129e3-e668-4dba-b47a-a1aff428c7f0 | 6 | @Override
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == resumeGameButton){
gui.setVisible(true);
this.dispose();
}
else if (ae.getSource() == saveGameButton){
Save s = new Save();
s.saveW... |
e516390f-a783-4a7e-9156-87f6f6dc3f7b | 2 | public void wallIn() {
if (mySpringies.getKey(JGEngine.KeyUp) & BoardSetup.wall_margin < mySpringies.pfHeight()/2) {
for (Wall w : myBoardSetup.getWalls()) {
w.remove();
}
BoardSetup.changeMargin(WALLCHANGE);
myBoardSetup.setWalls(myEnvForces.getWallMags(), myEnvForces.getWallMags());
mySpringies.c... |
70d755f8-a6b9-4e82-9357-18e34db607c1 | 9 | @Override public String getColumnName(int col) {
switch( col) {
case 0: return "Description";
case 1: return "Bid Size";
case 2: return "Bid";
case 3: return "Ask";
case 4: return "Ask Size";
case 5: return "Last";
case 6: return "Time";
case 7: return "Change";
case 8: return "Volume";
... |
ecc2420f-bde7-4a1a-b3c1-1d0710f1493f | 6 | @Override
public void parse() {
String filename = words[1];
String pathToMTL = object.getContextfolder() + filename;
InputStream fileInput = ResourceLoader.getResourceAsStream(pathToMTL);
if (fileInput == null) {
// Could not find the file in the jar.
try {
File file = new File(pathToMTL);
if (... |
370b1a9e-0580-4a69-9c2e-e699dddbf55c | 7 | public String constructLCS(String s, String t, int[][] matrix, int i, int j) {
StringBuilder sb = new StringBuilder();
if (i < 0 || j < 0) {
return "";
}
if (s.charAt(i) == t.charAt(j)) {
constructLCS(s, t, matrix, i - 1, j - 1);
sb.append(s.charAt(i));
} else {
if (i == 0 || j == 0) {
return... |
fed8868e-8bd6-4983-a5ef-de5778522fa6 | 3 | @Override
public void valueChanged(ListSelectionEvent e) {
if (subProcess != null) {
if (lstAllStocks.getSelectedValues().length > 0) {
btnAllToAssigned.setEnabled(true);
}
else {
btnAllToAssigned.setEnabled(false);
}
if (lstAssignedStocks.getSelectedValues().length > 0) {
btnA... |
ad013303-7f0f-459a-908e-c6e6c27fb968 | 0 | public static void main(String[] args) {
System.out.println(new OverrideToString());
BigInteger bi = new BigInteger("123938472394820384230984");
System.out.println(bi);
} |
9f557367-b76b-4272-bf55-5981dc63665d | 4 | private static void gangupLoop(int[][] board) {
boolean continueLoop = true;
int playerNumber = 1;
int turnNumber = 1;
int consecutiveConectionsRequired = 3;
int numberOfPlayers = 4;
GangupDataObject recievedDataObject;
while (continueLoop == true){
recievedDataObject = placePiece(board, playerNumber)... |
ae3210e4-6d9b-4815-904e-d193b6e81d94 | 6 | public static synchronized void deleteTexturesAndDisplayLists()
{
Iterator<?> iterator = displayLists.entrySet().iterator();
while (iterator.hasNext())
{
Entry<?, ?> entry = (Entry<?, ?>)iterator.next();
GL11.glDeleteLists(((Integer)entry.getKey()).intValue(), ((Inte... |
65512b22-0779-4c0c-8973-995f14c3cce0 | 2 | public int getReadyPlayersInMatch(String matchName){
try {
cs = con.prepareCall("{call returnReadyPlayersInMatch(?)}");
cs.setString(1, matchName);
ResultSet rs = cs.executeQuery();
if(rs.next()){
rs.last();
return rs.getRow();
}
rs = cs.executeQuery();
} catch (SQLException e)... |
c5939dbb-261a-4f64-b3d4-a140f28ef911 | 4 | private Animation GetStrikeAnimation(dir d){
Animation fm = null;
switch(d){
case down: fm = StrikeDown; break;
case left: fm=StrikeLeft; break;
case right: fm=StrikeRight; break;
case up: fm=StrikeUp; break;
}
return fm;
} |
f6375510-5f1d-41bf-b7b8-ec479548d0a5 | 4 | @Override
public Map<String, String> getParsedResults() {
if (!resultingMap.isEmpty()) {
return resultingMap;
}
String[] lines = stringBuilder.toString().split("\n");
for (String line : lines) {
line = line.trim();
if (line.startsWith("时间:")) {
parseStartAndEndTime(line.substring("时间:".length()));... |
7af9c2a9-5524-4986-a345-d47b92e66f8d | 2 | private void connect(String url, int port, DCStation station) {
try {
Socket s = new Socket(url, port);
NetworkConnection nc = new NetworkConnection(s, station);
station.setConnection(nc);
} catch (UnknownHostException e) {
System.out.println("Connection to host failed: The host with the address " + url... |
391bf2f5-5965-476d-8866-c7d3fd7da444 | 2 | String removeQuotes(String s) {
if (s.startsWith("\"")) s = s.substring(1);
if (s.endsWith("\"")) s = s.substring(0, s.length() - 1);
return s;
} |
217f405f-b027-44a7-b924-bb1507247368 | 4 | /* */ private static void blockLoad(BlockState blockState)
/* */ {
/* 141 */ blockState.update(true);
/* 142 */ BlockState state = blockState.getWorld().getBlockAt(blockState.getX(), blockState.getY(), blockState.getZ()).getState();
/* */
/* 144 */ if ((state instanceof Sign))
/* */ ... |
8054ca87-c17d-43ef-8071-cf91ad6dc375 | 2 | public Object cycListApiValue() {
if (isKeyword() || (!shouldQuote())) {
return this;
}
return CycList.makeCycList(CycObjectFactory.quote, this);
} |
7c9d312b-804e-403d-810c-859c1dc51093 | 6 | public static int binarySearchNonAsc(int[] array, int k) {
if(array==null || array.length==0) {
return -1;
}
int start = 0;
int end = array.length-1;
while(start <= end) {
// Attention: This is wrong way
// it fails if the sum of low and high
// is greater than the maximum positive
// i... |
4c3b6c20-d8c3-475f-961c-6af2c8f23a6e | 9 | * @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if pixels is null</li>
* <li>ERROR_INVALID_ARGUMENT - if x or y is out of bounds</li>
* <li>ERROR_INVALID_ARGUMENT - if getWidth is negative</li>
* </ul>
*/
pu... |
fd41c2c7-4eb4-42f2-baad-d6c672e08afc | 2 | public void removePush() {
if (stackMap == null)
/* already done or mapping didn't succeed */
return;
stackMap = null;
block.removePush();
Iterator iter = successors.keySet().iterator();
while (iter.hasNext()) {
FlowBlock succ = (FlowBlock) iter.next();
succ.removePush();
}
} |
665acfe9-f7dc-4819-87c9-d94801fa3a91 | 0 | public void clear() {
playerslocation.clear();
players.clear();
livingplayers.clear();
bossliving = false;
boss = null;
oldclass = null;
bossclass = null;
} |
74ddb067-d3a1-42c9-87e7-0a90a3bc8148 | 1 | @Test
public void testTimeStep_MEAN_MONTHLY_2year() throws Exception {
printDebug("----------------------------");
printDebug("MEAN_MONTHLY 2 year: " + this.toString());
printDebug("----------------------------");
CSTable t = DataIO.table(r, "obs");
Assert.assertNotNull(t);
... |
d7fa2dba-a941-4c7a-8f66-03946fa143e0 | 6 | public int pageout(Page og){
if((e_o_s!=0&&lacing_fill!=0)|| /* 'were done, now flush' case */
body_fill-body_returned>4096|| /* 'page nominal size' case */
lacing_fill>=255|| /* 'segment table full' case */
(lacing_fill!=0&&b_o_s==0)){ /* 'initial header page' case */
return flush(og);
}
... |
be66878f-4f03-4726-9929-67964ad19ad6 | 5 | public void loadall(){
int i = 0;
for(Applicant temp : candid){
String tName = temp.getName();
String tSchool = temp.getSchool();
String tDegree = temp.getDegree();
int tCat = temp.getCategory();
for(int j=0; j<4; j++... |
a9057f14-db27-465c-844e-71f910279e9f | 0 | public static void main(String[] args) {
Ex3 e = new Ex3();
D1.main(args);
} |
4a104539-a579-4ea4-b4ca-a6f1225ac508 | 4 | private List<Address> tryToReadAddresses() {
List<Address> addressList = null;
try {
FileInputStream fileInputStream = getFileInputStream();
ObjectInputStream objectInputStream = getObjectInputStream(fileInputStream);
addressList = getAddressList(objectInputStream);
... |
0e36c8c0-3039-48e4-992f-bf3ddcf06c8c | 9 | public static int countBankid(String eDatabase) throws SQLException{
Connection gCon = null; // general connection to MYSQL
Connection eCon = null; // connection to database
Statement eStatement = null; // statements for the eDatabase
ResultSet result = null;
int countbid = 0;
try{
... |
dfdc8af0-e2e5-4fef-bcb1-76eb4dd06065 | 5 | private Object getNextKnightMove(mxAnalysisGraph aGraph, int xDim, int yDim, int xCoord, int yCoord, ArrayList<Object> resultPath)
{
Object[] possibleMoves = getKnightMoveVertexes(aGraph, xDim, yDim, xCoord, yCoord);
//get the position with minimum possible moves
int minMoveNum = 9;
float biggestDistance = 0;
... |
eec6a86b-6e64-45ed-89eb-5fab2d096d35 | 0 | public void setDate( GregorianCalendar date ) {
this.date = date;
} |
479a57c5-d928-4829-ab3b-f6fbdb6d9bfe | 5 | private static final int decode4to3(final byte[] src, final int sOffset,
final byte[] dest, final int dOffset) {
if (src[sOffset + 2] == EQUALS_SIGN) { // Example: Dk==
final int outBuff = ((DECODABET[src[sOffset ]] & 0xFF) << 18)
| ((D... |
94ae8d72-b98c-4a96-b69a-501e41fea3e4 | 8 | public Connection createConnection() {
if (plugin.config.useMySQL) {
try {
Class.forName("com.mysql.jdbc.Driver");
cn = DriverManager.getConnection("jdbc:mysql://" + plugin.config.dbPath, plugin.config.dbUser, plugin.config.dbPassword);
cn.setAutoCommit(false);
return cn;
} catch (SQLException e... |
51fd7064-891d-4491-8129-36339d97ed1b | 5 | public void makeRed()
{
Tile activeTile;
redCheckers = new ArrayList<Checker>();
x_cord = 0;
y_cord = 250;
for(int i = 0; i < 12 ; i++)
{
redCheckers.add(new Checker(Checkers.RED, x_cord, y_cord));
activeTile = getTile(x_cord, y_cord)... |
692ca079-3b8a-456f-80b2-bbffd8d8eb35 | 0 | public SmallWorld() {
// Set up display.
super("Small World Agents [1.0]");
MenuBar menuBar = new MenuBar();
setMenuBar(menuBar);
Menu layoutMenu = new Menu("Layout");
menuBar.add(layoutMenu);
ringWorldMenuItem = new MenuItem("Ring World");
layoutMenu.add(ringWorldMen... |
6c019fc1-84c6-4bf3-827c-53bc728bd572 | 0 | @Override
public DataStructures getKit() {
return outData;
} |
6f99b2b2-c175-4678-af61-a99c0497a27f | 6 | void set(syVComp para) {
int oldmode = mode;
switch ((int) para.mode) {
case MODE_OFF:
mode = MODE_BIT_OFF;
break;
case MODE_PEAK:
mode = MODE_BIT_PEAK | MODE_BIT_ON;
break;
case MODE_RMS:
mode = MODE_BIT_RMS | MODE_BIT_ON;
break;
default:
//assert (false);
}
if (para.st... |
e94aba75-f985-4e45-88ab-d3e0a26af452 | 8 | public void addCell(Cell cell) {
if (strategy == TableStrategy.DRAW_NONE) {
return;
}
if (strategy == TableStrategy.DRAW_OUTSIDE) {
return;
}
if (strategy == TableStrategy.DRAW_HORIZONTAL || strategy == TableStrategy.DRAW_ALL) {
// Hlines
for (int c = cell.getMinCol(); c <= cell.getMaxCol(); c++... |
d295aa4c-5029-4712-9aa1-78d8ab4a25d1 | 7 | public final int getNextCharWithBoundChecks() {
if (this.currentPosition >= this.eofPosition) {
return -1;
}
this.currentCharacter = this.source[this.currentPosition++];
if (this.currentPosition >= this.eofPosition) {
this.unicodeAsBackSlash = false;
if (this.withoutUnicodePtr != 0) {
unicodeStore();
... |
f211e7d5-0f62-4f69-9d4c-c1131e003816 | 7 | private JButton createButton() {
JButton but = new JButton(" ");
but.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cell.open();
}
});
but.addMouseListener(new MouseListener() {
... |
302cc623-b230-4d98-923e-0a821905a498 | 3 | public int kargerRandomMinCut() {
int retval = 0;
while (graphMatrix.keySet().size() > 2) {
// printMergedNodes();
// Integer[] vertexArray = (Integer[])
// graphMatrix.keySet().toArray();
ArrayList<Integer> vertexArray = new ArrayList<Integer>(
graphMatrix.keySet());
int randomVertexIndex = (in... |
45de08f8-142f-4c39-8990-ec691ead4bb4 | 2 | @SuppressWarnings("unchecked")
private void checkValidFeedBackMove(VerifyMove verifyMove){
/**
* Legal Move should be (assume lastMoveId is wId)
* Case A: the game is not finished.
* 1 add(new SetTurn(bId))
* 2 add(new Set(CURRENTMOVE,GUESS))
* 3 add(new Set(FEEDBACKHISTORY,x+feedback)), ... |
2ad767c5-c57d-45da-94ac-df2ecdbbf49b | 5 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
ResultSet rs;
java.sql.Statement stmt;
Connection con;
try {
con = service.getConnection();
stm... |
d1133c4b-e4f2-4772-8bbb-f63595b7b501 | 4 | @EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
double d = RideThaMob.defaultspeed;
if (RideThaMob.speed.contains(e.getPlayer().getName())) {
d = RideThaMob.maxspeed;
}
if ((p.getVehicle() != null)/*
* &&
* (RideThaMob.sneak.contains(p.getName()))... |
7e6f2ba5-5f5f-4d6a-98ed-651a72c22d18 | 8 | private void cushion() {
final int CushionRound = 16;
for (int i = 0; i < CushionRound; i++) {
try {
sleep(delay);
} catch (InterruptedException e) {
e.printStackTrace();
}
checkRunBridge();
control.run();
towerDefense_TransData = control.getInfo(clientId, timestamp);
towerDefense_Trans... |
ff4a9f47-692a-4f12-99dc-a76e15f2082b | 4 | public int getSafePixel(int x, int y) {
if(x < 0 || y < 0 || x >= imagem.getWidth() || y >= imagem.getHeight()) {
return background;
}
return imagem.getPixel(x, y);
} |
78289d22-60f2-4109-a01b-2447aa8c25c2 | 8 | boolean navigateNextAnchor(int direction) {
EditPart focus = getCurrentViewer().getFocusEditPart();
AccessibleAnchorProvider provider;
provider = (AccessibleAnchorProvider) focus
.getAdapter(AccessibleAnchorProvider.class);
if (provider == null)
return false;
List list;
if (isInState(STATE_ACCESSIBL... |
18aaa810-6839-47d4-b39d-57f70ea32af6 | 2 | public double[] rawItemMinima(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.rawItemMinima;
} |
6caf71a8-9a6c-4810-b005-93abeae1407a | 1 | private Node find(A a) {
assert a != null;
Match m = findMatch(a);
splay(m.node);
return m.matchFound ? m.node : null;
} |
aa652828-b838-401b-b5d7-413947f7ee74 | 8 | private String solveLuggageProblem(int[] weights){
final String _TRUE = "YES";
final String _FALSE = "NO";
int totalWeight = getTotalWeight(weights);
if (totalWeight%2 != 0)
return _FALSE;
int n = weights.length+1;
int halfWeight = totalWeight/2;
boolean [][] dpTable = new boolean [n][halfW... |
50193760-e1fe-4fec-8d73-7fba23dee84b | 2 | private DomainXmlBuilder addDatabase(Database database) {
logger.info("Insert DataSource " + database.getName());
// <jdbc-connection-pool>
Element connectionPool = xmlDocument.createElement("jdbc-connection-pool");
connectionPool.setAttribute("driver-classname", database.getJavaDriver()... |
c044dbb6-aafd-4654-bd06-41d32e53640d | 1 | private List<Node> createSubNodes(List<String> subNodes, Node parent) {
List<Node> nodes = new ArrayList<Node>();
Node node;
for (String s : subNodes) {
node = new Node(s, parent);
nodes.add(node);
allNodes.add(node);
}
return nodes;
} |
4c938cee-e279-46ff-8100-298cc0fa5b5b | 5 | public void setProfile(ProfileBean pb) throws Exception{
Connection conn =null;
Statement stmt = null;
int rs;
try{
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection(url);
stmt = conn.createStatement();
... |
a6e6381a-ba2b-4ee4-972c-5aa6134b5470 | 7 | public void run() {
while (!Thread.currentThread().isInterrupted()) {
//TODO aparentemetne isso n funfa^
int sorteado;
if ((sorteado = sorteio.sorteia()) != -1) {
// for (BingoClient c : clients) {
// try {
// c.recebeBola(sorteado);
// } catch (RemoteException e) {
// // TODO Auto-gener... |
30c04802-6c55-4485-86dd-86b4b3afbf3d | 3 | private void deselectAll( SelectableCapability ignore ) {
for( SelectableCapability selectable : site.getCapabilities() ) {
if( selectable != ignore ) {
if( selectable.getSelected().isSelected() ) {
selectable.setSelected( Selection.NOT_SELECTED );
}
}
}
} |
d2741d30-198f-4853-9e6c-1a8b831888cd | 9 | static void blur(int[] srcPixels, int[] dstPixels,
int width, int height,
float[] kernel, int radius) {
float a;
float r;
float g;
float b;
int ca;
int cr;
int cg;
int cb;
for (int y = 0; y < height; y++)... |
177c46dc-e33a-40bc-92ea-50a6c5fa9cba | 4 | @Override
public boolean equals(Object o) {
if (o.equals(null) || o.getClass() != this.getClass())
return false;
if(this.getDest() == ((Edge) o).getDest() && this.getSource() == ((Edge) o).getSource())
return true;
return false;
} |
c92b4e52-3378-46d7-bdb2-53c9a1245032 | 5 | @Override
public Type applyType(IType type) {
if (this.specialisation != null) {
if (this.specialisation.getArity() > 0) {
IType applied = this.specialisation.applyType(type);
String typesString;
if (this.parent.typesS... |
687b33cf-efb0-4e71-8922-2ec147591fcf | 8 | private void matchJoinedFields(QueryBuilder<?, ?> joinedQueryBuilder) throws SQLException {
for (FieldType fieldType : tableInfo.getFieldTypes()) {
// if this is a foreign field and its foreign-id field is the same as the other's id
FieldType foreignIdField = fieldType.getForeignIdField();
if (fieldType.isFo... |
15207cb1-6908-4035-b8c7-4fe5dca3a1ee | 1 | private PropertyManager(){
try {
pro.load(PropertyManager.class.getClassLoader().getResourceAsStream("config/tank.properties"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
f4ba1c6f-dc62-49b9-8dd5-9b8495d86209 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Way other = (Way) obj;
if (nodes == null) {
if (other.nodes != null)
return false;
} else if (!nodes.equals(other.nodes))
return fals... |
9e76d374-3833-4a42-af0a-2abcb0cc8393 | 4 | private void paintInfoNaves(Graphics2D g2d){
List<Nave> naves = partida.getNaves();
List<Nave> list;
list = (partida.getJuego().getnNaves()==2)
? naves : naves.subList(0, 1);
int h = (int)getSize().getHeight();
for(int i =0; i< list.size();i++){
... |
4b1e4c42-2eaa-4407-a440-2bd443b145cd | 4 | @Override
public void changedUpdate(DocumentEvent e) {
this.lastTimeStamp = System.currentTimeMillis();
if (ColorPicker.this.adjustingHexField > 0) {
return;
}
String s = ColorPicker.this.hexField.getText();
s = stripToHex(s);
... |
32fa8a9b-2218-41c8-88dd-56e8983535f9 | 2 | public static String getSuffixWithoutDot(String s){
if(s == null || s.isEmpty()){
return null;
}
int lastDotIndex = s.lastIndexOf(".");
int length = s.length();
String suffix = s.substring(lastDotIndex+1, length);
return suffix;
} |
2b8c702d-7fbc-41aa-a94c-50fced382a9b | 3 | public void printToConsole() {
// Outputs to console what would be sent to the file.
for(Contact eachContact : allContacts) {
System.out.print("contact,"+eachContact.getId()+","+eachContact.getName()+","+eachContact.getNotes()+"\n");
}
for(Meeting eachMeeting : allMeetings) {... |
69eec7f0-1e0b-41ae-8861-798e9cd3c29c | 8 | @Override
public String[] tokenize(String word) {
ArrayList<String> tokens = new ArrayList<String>();
int state=0;
String token="";
char c;
for(int i=0;i<word.length();i++)
{
c=word.charAt(i);
switch(state)
{
case 0: //if character is extra beginning letter or IPA letter, output separator
... |
95f7974a-a3ce-46b5-89bf-49d4a0f5df91 | 2 | public void move() {
x += dx;
y += dy;
if (x < 1) {
x = 1;
}
if (y < 1) {
y = 1;
}
} |
55f28f53-e5eb-4da0-b032-4c7d6f5eec4e | 2 | @Test
public void testTimeStep_DAILY3_subdivide() throws Exception {
printDebug("----------------------------");
printDebug("DAILY with Subdivide: " + this.toString());
printDebug("----------------------------");
// Data
CSTable t = DataIO.table(r, "obs");
As... |
a3b3bb51-24de-47c0-9c83-480d7a43a026 | 3 | private ArrayList<SPNews> ScrapeNewsList(String input) throws NullPointerException {
ArrayList<SPNews> newslist = new ArrayList<SPNews>();
int iStart = getNextIndex(input, 0);
if(!input.substring(0, iStart).equals("OK")) {
throw new NullPointerException("Nyhederne kan ikke læses. Internkode: #1. Status: " + in... |
eb485b3e-d903-4fae-829e-046c66feb3e7 | 3 | private static String changeFirstCharacterCase(String str, boolean capitalize) {
if (str == null || str.length() == 0) {
return str;
}
StringBuilder sb = new StringBuilder(str.length());
if (capitalize) {
sb.append(Character.toUpperCase(str.charAt(0)));
}
else {
... |
942401ca-9b69-4492-bd48-16f556d64d71 | 2 | public static ConnectionDetails fromAddress(String fullAddress) {
ConnectionDetails cd = new ConnectionDetails();
if (fullAddress != null) {
if ( fullAddress.matches(".+:\\d{3,}$") ) {
int upto = fullAddress.lastIndexOf(":");
cd.address = fullAddress.substrin... |
c0680663-96b8-49c3-b50d-0bbeca24f6f1 | 3 | @Override
public Double get(int index) {
switch(index) {
case 0: return x;
case 1: return y;
case 2: return z;
default: throw new IndexOutOfBoundsException();
}
} |
f51a5adc-7567-43fd-a01b-45a3ca32c75f | 2 | public void doLoopAction()
{
if (resetMap)
{
resetMap();
}
collisionDetector.detectCollisionsGameObjects();
removeObjects();
addObjects();
for (StageObject stageObject : mapObjects)
{
stageObject.doMapCollision();
s... |
35d4a2cb-b3f3-4009-b7f3-8645bbd0bdb4 | 1 | @Override
public void noWindowsAreOpenAtStartup(boolean finalChance) {
if (finalChance) {
Timing timing = new Timing();
TreeTestWindow win = new TreeTestWindow("Test 1 Drop Copy & Move", true); //$NON-NLS-1$
win.setBounds(50, 50, 500, 500);
win.setVisible(true);
System.out.println("Tree 1 took " + tim... |
51520ad5-b2f2-47e1-93a6-65065d91dc70 | 6 | public int[] plusOne(int[] digits) {
if (digits == null || digits.length == 0) {
return digits;
}
boolean hasBItCarray = false;
int bitCarray = 0;
for (int i = digits.length - 1; i >= 0; i--) {
int digitalResult = digits[i] + 1;
if (digitalRe... |
cef1b6cc-8872-4024-8201-e525ac570936 | 5 | @Before
public void putData(){
User user = new User();
user.setLogin("randomUser");
user.setName("USER");
user.setSurname("SURNAME");
user.setPassword("password");
if (dataStoreImpl.getUser(user.getLogin()) == null)
dataStoreImpl.addUser(user);
Account account = new Account();
account.setUs... |
bcc1e7c8-b7ae-4672-8d8d-d75817dfb419 | 7 | private boolean method66(int arg0, int arg1, int arg2) {
int i1 = arg0 >> 14 & 0x7fff;
int j1 = sceneGraph.method304(plane, arg2, arg1, arg0);
if (j1 == -1) {
return false;
}
int k1 = j1 & 0x1f;
int l1 = j1 >> 6 & 3;
if (k1 == 10 || k1 == 11 || k1 == 2... |
13948ad5-9817-425f-9ff5-1c35314ba889 | 5 | public boolean isBalanced(TreeNode root) {
if (root == null){
return true;
}
int hLeft = returnHight(root.left);
int hRight = returnHight(root.right);
if (hLeft-hRight<-1||hLeft-hRight>1||hLeft==-2||hRight==-2){
return false;
}
else {
... |
b9548b6c-0124-487a-82e2-1142c5e35665 | 7 | private static boolean rmDir(final File d) {
final File[] listFiles = d.listFiles();
for(final File f : listFiles) {
final String name = f.getName();
if((name.compareTo(".")!=0)&&(name.compareTo("..")!=0)) {
if(f.isDirectory()) {
return false;
}
}
}
for(final File f : listFiles) {
final... |
47d4ecc3-63f4-49f4-986c-47288187d353 | 7 | void fillOutside(int paramx, int paramy) {
ArrayList<Coord> stack = new ArrayList<Coord>();
stack.add(new Coord(paramx, paramy));
while (stack.size() > 0) {
Coord c = stack.remove(stack.size()-1);
int x = c.x, y = c.y;
if (x < 0 || x >= Width || y < 0 || y >= Height)
continue;
if (mask[x][y] == -1... |
454285bc-e8eb-4f2e-a994-e488f783d477 | 7 | @Override
public void showDialog(DialogAction dialogAction, int row, String code) {
if (DialogAction.UPDATE.equals(dialogAction) && (row == BAD_ROW || code == null)) {
throw new UnsupportedOperationException("You can not perform this action");
}
JDialogStudent dialogStudent = ne... |
858208fc-cac0-45f3-abb8-760bc8993ebd | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
final Room R=mob.location();
if(R!=null)
{
final int type=mob.location().domainType();
if(((type&Room.INDOORS)>0)
||(type==Room.DOMAIN_OUTDOORS_AIR)
||(type==Room.DOMAIN_OUTDOORS_CITY)
||(type==Room.DOM... |
ac1a283d-2055-4314-aa2a-c0a65b531df4 | 3 | public boolean equals(Object obj) {
if (obj instanceof TimeSize) {
TimeSize ts = (TimeSize) obj;
if (this.time == ts.time && this.size == ts.size) {
return true;
}
}
return false;
} |
60d6a92d-bfbe-490a-a781-e691b8a8bbb8 | 0 | public long getFinalEnd() {
return startTime+interval;
} |
66cbbe53-2800-457a-9801-ece9b5ea6026 | 4 | private String formatClass(String str)
{
String class_abbrv = "";
String class_num = "";
String class_section = "";
String formattedString = "";
int firstSub = 0;
int secondSub = 0;
int thirdSub = 0;
int fourthSub = 0;
int fifthSub = 0... |
04e20d4c-fc78-47fc-9dd6-74921f8d08a2 | 2 | public Hit intersect(Ray ray) {
ArrayList<AbstractShape> sortedList = new ArrayList<AbstractShape>();
for (AbstractShape shapes : sortedList) {
if (shapes.intersect(ray) != null) {
return shapes.intersect(ray);
}
}
return null;
} |
50ecc957-36d7-47a3-9bb4-2cdd2ec6cb18 | 4 | public void sendDeleteUser() throws IOException{
String str = new String("deleteuser"+ "," + waiterFld.getText());
System.out.println(str);
InetAddress serverAddr= null;
try {
serverAddr= InetAddress.getByName(GlobalV.serverIP);
} catch (UnknownHostException e1) {
e1.printStackTrace();
}
... |
a930ad41-97dc-4426-9cf2-45faca12b6d4 | 4 | protected static Ptg calcCovar( Ptg[] operands ) throws CalculationException
{
Ptg[] xMeanPtg = new Ptg[1];
xMeanPtg[0] = operands[0];
Ptg[] yMeanPtg = new Ptg[1];
yMeanPtg[0] = operands[1];
PtgNumber pnum = (PtgNumber) calcAverage( xMeanPtg );
double xMean = pnum.getVal();
pnum = (PtgNumber) calcAverage... |
26786aa2-c2f3-4651-a63c-1cd2ffa2ed0a | 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;
... |
dd2aac83-bf64-4948-8e33-ff10ff9167a6 | 4 | public static boolean supported(int encoding) {
/*
return encoding <= Encodings.encodingMax && createFns[encoding];
*/
return (encoding == Encodings.encodingRaw ||
encoding == Encodings.encodingRRE ||
encoding == Encodings.encodingHextile ||
encoding == Encodings.encodingTigh... |
d1104198-950e-4cbb-b5fc-a39f98ee5f25 | 2 | List<Score> matchCoupleFirst(Map<Person, List<Score>> table){
System.out.print("matching first");
List<Score> ret = new ArrayList<>();
new ArrayList<>(table.keySet()).forEach(self -> {
Stream.of(table.get(self))
.filter(sls -> sls != null && !sls.isEmpty())
... |
27f051a9-55ae-405c-9282-5af7d9ffb851 | 3 | public boolean checkCollisions(Fruit f) {
for(int i = (int)((-1)*(playerW/2)) - 2; i < (int)(playerW/2) + 2; i++)
for(int j = -6; j < 7; j++)
if((((player.locx + i) - f.xpos)*((player.locx + i) - f.xpos)) + (((player.locy + j) - f.ypos)*((player.locy + j) - f.ypos)) <= (f.radius*f.radius))
//There is a co... |
1d1a0648-c5f1-4bf0-8cc3-2ac71476d87f | 3 | public static void main(String[]args)
{
long n = 600851475143L;
long largestPrime = 0;
for (long i = 2; i <= n; i++)
{
if (n % i == 0)
{
if(largestPrime < i) largestPrime = i;
n /= i;
i--;
}
}
System.out.println(largestPrime);
} |
4f346854-daf8-4a0b-9870-724a50191ad4 | 4 | public boolean isInvoke() {
switch (opcode) {
case opc_invokevirtual:
case opc_invokespecial:
case opc_invokestatic:
case opc_invokeinterface:
return (true);
default:
return (false);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.