method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1edd3482-080c-4877-b43f-a72c3b92e0fd | 6 | public boolean canShift(Direction dir)
{
int minX = getWidth()*2;
int maxX = 0;
int minY = getHeight()*2;
int maxY = 0;
for (Level l : levels)
{
for (Piece p : l.pieces)
{
minX = Math.min(minX, p.x);
minY = Math.min(minY, p.y);
maxX = Math.max(maxX, p.x... |
dc83c8c0-d720-4335-b0de-07291508ee4a | 3 | public void update() {
if (isComplete == false) {
applyFilter();
passesLeft--;
if (passesLeft == 0) {
isComplete = true;
}
} else {
this.stop();
if (parent != null) {
this.notifyListeners(new ActionEv... |
cfec1508-49bc-44b4-ae92-49c007c9c3a8 | 3 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerQuit(PlayerQuitEvent event)
{
// cleanup
if(playersInSM.contains(event.getPlayer().getName()))
{
playersInSM.remove(event.getPlayer().getName());
}
if(playersInGracePeriod.containsKe... |
aed7c82c-8802-4d97-945f-0551b6e30db8 | 6 | private void SimpleMotion(){ //uniform motion along X and accelereted motion along Y
m_acceleration.setX((m_draft.X() /*+ m_uplifting_force.X()*/)/m_weight);
m_acceleration.setY((m_draft.Y() /*+ m_uplifting_force.Y() */+ m_gravity.Y())/m_weight);
if(m_acceleration.Length() > Physics.MAX_ACCEL... |
6775debf-1dee-49f7-b58f-a3f3441e5435 | 4 | @Override
public long resolve(String url) throws IOException {
HttpResponse resp = get(Request.to(Endpoints.RESOLVE).with("url", url));
if (resp.getStatusLine().getStatusCode() == HttpStatus.SC_MOVED_TEMPORARILY) {
Header location = resp.getFirstHeader("Location");
if (locati... |
d3003dad-2dbc-4af9-b044-579efcc0ca3d | 7 | public String stringRouteSourceToTarget (String source, String target) {
if (this.negCircle) {
return "ERROR:1001:NEG Circle";
}
int idxSource = -1;
int idxTarget = -1;
for (int i = 0; i < this.listOfVertices.size(); i++) {
if (this.listOfVertices.get(i).equals(source)) {
idxSource = i;
} ... |
8aec37a2-ac56-4188-8590-2a43c6396bc2 | 0 | public double getLargura() {
return largura;
} |
6410d405-68a2-45ba-8f2d-91c0b352b112 | 8 | private void viewScreen(String action,
boolean updated,
HttpSession session,
Connection database,
HttpServletRequest request,
HttpServletResponse response,
PrintWriter webPageOutput)
{
int descriptionNumber=0;
Routines.tableStart(false,webPageOutput);
Ro... |
6a834e5d-f665-41ee-9edb-b424aff1deaf | 7 | public String generateQueryFromOWL(){
double priceLowerFilter = 0;
double priceUpperFilter = Integer.MAX_VALUE;
String os = scenario.getOperatingSystemName();
String osFilter ="";
String category = "Notebook";
String typeFilter = "";
String performance = scenario.getPerformance();
String performanc... |
6c75e280-0b1b-4327-89bd-d3ea02744a0b | 4 | private TreeNode rotateLeft(TreeNode rotatingNode) {
TreeNode rotatedTreeRootNode = rotatingNode.right;
rotatedTreeRootNode.parent = rotatingNode.parent;
rotatingNode.right = rotatedTreeRootNode.left;
if (rotatingNode.right != null) {
rotatingNode.right.parent = rotatingNode;
}
rotatedTreeRootNode.le... |
8be3991c-c07d-48ec-8a46-b607ce29ba03 | 7 | public boolean isBlockIn(Block block)
{
Location whereishe = block.getLocation();
//player.sendMessage("testing you in "+whereishe.getWorld().getName());
//int rsx, rsy,rsz ;
//int xw,yw,zw;
//rsx = Math.min(sx,ex);
//xw = Math.max(sx,ex)-Math.min(sx,ex);
//System.out.print("X start in "rsx+" znd is "+xw... |
c9e3c81e-9eac-4a1d-93b7-ebde9835489e | 1 | private void getFloorPlanChargingStation(String line, CellDescription cellDescription) {
int startIndex;
int endIndex;
/*check if it is charging station*/
startIndex = line.indexOf("cs") + 4;
endIndex = line.indexOf('\'', startIndex);
if ("1".equals(line.substring(startIndex, endInde... |
6f7cc11e-5042-4dbb-b320-ed595099cee2 | 5 | @Override
public boolean addUserEntity(Object obj) {
String sqlget = "select max(userid) from tb_user";
ResultSet rs = executeQuery(sqlget);
int temp = 0;
try {
rs.next();
temp = rs.getInt(1);
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
int max = temp + 1;
Register_E... |
8c137016-3a68-4665-a75e-70daee454024 | 5 | private static double euclideanNorm(double vector[]) {
int n = vector.length;
if (n < 1) {
return 0;
}
if (n == 1) {
return Math.abs(vector[0]);
}
// this algorithm is (often) more accurate than just summing up the squares and taking the square... |
3e85bac9-c7a2-4b22-924a-30745e3729b6 | 4 | @Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
if (e.getKeyCode() == KeyEvent.VK_LEFT){
//System.out.println("l");
grid.sLeft();
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT){
grid.sRight();
}
if (e.getKeyCode() == KeyEvent.VK_UP) {
grid.sUp();
Sy... |
70f93b96-614f-4323-9519-56c442c9f02d | 7 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SingleFeatureValue other = (SingleFeatureValue) obj;
if (indexCode != other.indexCode)
return false;
if (symbol == null) {
if (other.symbol != null)... |
6c83058a-9b7e-43fc-86ff-157ba75af801 | 4 | private synchronized void dynamicLoad(String s) throws IOException {
try {
System.out.println("Old library path: " + System.getProperty("java.library.path"));
Field field = ClassLoader.class.getDeclaredField("usr_paths");
field.setAccessible(true);
String[] paths ... |
7d85001c-81d9-4d95-b198-ffe0280f34cc | 9 | public int synthesis(Packet op){
Info vi=vd.vi;
// first things first. Make sure decode is ready
opb.readinit(op.packet_base, op.packet, op.bytes);
// Check the packet type
if(opb.read(1)!=0){
// Oops. This is not an audio data packet
return (-1);
}
// read our mode and pre/... |
2eac8539-1787-410d-a931-77a609ad7990 | 7 | public boolean equals(Object y) {
if (y == this)
return true;
if (y == null)
return false;
if (y.getClass() != this.getClass())
return false;
SET<Key> that = (SET<Key>) y;
if (this.size() != that.size())
return false;
try {
for (Key k : this)
if (!that.contains(k))
return false;
} ... |
bde44e2c-507e-41b0-bb2d-2aaa63ad3a81 | 2 | public JSONArray names() {
JSONArray ja = new JSONArray();
Iterator keys = this.keys();
while (keys.hasNext()) {
ja.put(keys.next());
}
return ja.length() == 0 ? null : ja;
} |
69eb79a2-b0ab-4851-a167-353c0548e837 | 0 | public int getResting() {
return this.resting;
} |
d5b60305-fe08-4f47-a58f-fae5a92465ec | 2 | protected static Point[] parsePoints(String string) {
Vector points = new Vector();
StringTokenizer tok = new StringTokenizer(string);
try
{
while (tok.hasMoreTokens())
{
int x = Integer.parseInt(tok.nextToken());
... |
cac85997-ec92-4e3b-b220-fe16ba91167f | 3 | @Override
public List<Usuario> ListAll() {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Usuario> usuarios = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LIST);
... |
c7982dc7-b3f5-4216-94a2-6a7d1b994e0a | 9 | public static int K051316_vh_start(int chip, int gfx_memory_region, int bpp, K051316_callbackProcPtr callback) {
int gfx_index;
/* find first empty slot to decode gfx */
for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++) {
if (Machine.gfx[gfx_index] == null) {
... |
67c2eff9-f1fa-4863-b207-48f557bb925b | 6 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int f = 0;
int [][] a = new int [n][n];
for (int m = 0 ; m <= (n-1)*2 ; m ++){
for (int i = 0, j = m; ((i<=m)... |
2d4d9058-b0de-40cd-ad70-c87194dc6b49 | 2 | public ServerIcon(File file) throws IOException
{
BufferedImage image = ImageIO.read(file);
if(image.getWidth() != 64 || image.getHeight() != 64)
throw new IllegalArgumentException("Server icon must be 64 x 64");
ByteBuf buffer = Unpooled.buffer();
ImageIO.write(image, "PNG", new ByteBufOutputStream(buff... |
933cca0e-0a63-44cc-a71d-c4c8c3f9320d | 6 | public Descriptor compile(SymbolTable table){
int size;
if(node instanceof IdentNode){
size = ((IntConstDescriptor)table.descriptorFor(((IdentNode)node).getIdentName())).value();
}else if(node instanceof ContentNode){
size = ((IntConstDescriptor)table.descriptorFor((((IdentNode)((ContentNode)... |
b7ffb1b5-cab6-44e0-bb1f-7ca6b0665df4 | 3 | public void run() {
EventHandler dataEvent;
while(true) {
synchronized(queue) {
while(queue.isEmpty()) {
try{
queue.wait();
} catch(InterruptedException e){
}
}
dataEvent = (EventHandler) queue.remove(0);
}
// return to sender
dataEvent.server.send(data... |
27f0a929-f60e-4d12-8495-135b9b79e049 | 8 | public boolean Login() throws ClassNotFoundException, SQLException {
HttpSession ses;
ses = request.getSession(false);
if(ses == null || ses.getAttribute("username") == null) {
System.out.println("New Session Created");
//user username and password to validate if no passw... |
d10567fb-b900-4c14-9244-91a89f9ed6b0 | 4 | public void findBestSystemGeneration() {
for (SoftwareSystem softwareSystem : systems)
softwareSystem.refine();
bestSoftwareSystemW = systems.get(0);
worstSoftwareSystemW = systems.get(0);
for (SoftwareSystem softwareSystem : systems) {
if (softwareSystem.getSystemConsumptionW() < bestSoftwareSystemW.getS... |
65f0a917-21da-4222-aa86-6ea46b10c18e | 9 | @Override
public void delete(T elemento)
{
Nodo<T> atual = raiz;
int comp = 0;
while (atual != null) {
comp = elemento.compareTo(atual.getElemento());
if (comp < 0)
atual = atual.getEsquerda();
else if (comp > 0)
atual = atual.getDireita();
else
break;
}
if (atual == null)
return... |
3a55fd5c-c263-4ba1-aa18-b6e94fff6e91 | 2 | @Override
public void doMapCollision() {
checkCollisionMap();
if (mapCollision == Collision.NONE) {
setFall(true);
}
if (mapCollision != Collision.NONE) {
setFall(false);
}
} |
12389767-48ec-4a7e-813a-094f8f9a243a | 1 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
User activeUser = User.findById(session.getActiveUserId());
if(!activeUser.isAdmin) {
rtn.put("rtnCode", this.getRtnCode(405));
return rtn;
}
long uid = Long.parseLo... |
1fa0e80b-338b-494c-b8b1-d537d4a5c1d0 | 1 | public void add(K key, V value) {
List<V> list = values.get(key);
if(list==null) {
list = new ArrayList<V>();
values.put(key, list);
}
list.add(value);
} |
1c32e14d-13bd-4518-9437-3bcc7912d660 | 7 | public Color color(int color) {
switch(color) {
case 3:
case 4:
case 5: return Color.RED;
case 6:
case 7:
case 8: return Color.orange;
default: return Color.green;
case 27: return Color.PINK;
}
} |
7a3113b3-a50b-4845-b0ef-05bba158e9a0 | 1 | public void testNegated() {
Days test = Days.days(12);
assertEquals(-12, test.negated().getDays());
assertEquals(12, test.getDays());
try {
Days.MIN_VALUE.negated();
fail();
} catch (ArithmeticException ex) {
// expected
}
... |
3c2b3e44-197c-430b-8a1c-814aa41c91ee | 6 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || obj.getClass() != this.getClass()) {
return false;
}
Team t = (Team) obj;
return this.FullName().equals(t.FullName()) || this.teamID == t.GetTea... |
1f65c472-dfb4-494f-9132-8b4257e83136 | 7 | private ArrayList<Reward> getResults() {
ArrayList<Reward> results = new ArrayList<Reward>();
ArrayList<Block> blocks = game.getSlot().getBlocks();
// checks horizontal matches
for(int i = 0; i < 5; i++) {
Reward reward;
ArrayList<Integer> currentId = new ArrayList<Integer>();
List<Block> current... |
cdaadaf4-377b-4cfa-bfdb-f64f1183ba7f | 2 | public static String loadShader(String fileName)
{
StringBuilder shaderSource = new StringBuilder();
BufferedReader shaderReader = null;
try
{
shaderReader = new BufferedReader(new FileReader("./res/shaders/" + fileName));
String line;
while((line = shaderReader.readLine()) != null)
{
sh... |
7beb8595-66de-4c1d-ad6f-0d8dec0507fc | 6 | public static int addPost(String student_id, long offering_id, String content, boolean privilege_flag, long parentPostId){
try{
PreparedStatement pstmt;
pstmt = conn.prepareStatement("select * from offering where offering_id = ?");
pstmt.setLong(1, offering_id);
... |
03b5c84f-a480-4e2b-a529-86f499c7e71a | 0 | public int getNum()
{
return num;
} |
ef1d2cc4-3fcd-45d1-b8d3-f5c1f61f3285 | 3 | */
BSTNode insert(BSTNode tree, K key, V value) {
// Special case: Empty tree. Build a new node.
if (tree == null) {
return new BSTNode(key, value);
} // if (tree == null)
else {
int tmp = order.compare(key, tree.key);
if (tmp == 0) {
tree.value = value;
return tree;
} else if (tmp < 0) ... |
263abb7e-891a-4af8-ab1c-91e82677ffcd | 4 | public void unreadFrame() throws BitstreamException
{
if (wordpointer==-1 && bitindex==-1 && (framesize>0))
{
try
{
source.unread(frame_bytes, 0, framesize);
}
catch (IOException ex)
{
throw newBitstreamException(STREAM_ERROR);
}
}
} |
62c8861b-64d5-42da-a5e1-396ea94d0054 | 7 | public void printMove (XmlWriter xml, int size, int number, Node n)
{ String s="";
if (Type.equals("B")) s="Black";
else if (Type.equals("W")) s="White";
else return;
xml.startTagStart(s);
xml.printArg("number",""+number);
if (n.contains("N")) xml.printArg("name",n.getaction("N"));
if (s.equals("Black") ... |
67b2442c-30a0-42b3-9228-7c5e1d522516 | 6 | @Override
protected void initializeCPointer() {
assert this.cPointer != 0;
assert reportNameBase != null;
final int r = ppaml_tracer_init(this.cPointer, reportNameBase);
switch (r) {
case 0:
break;
case -1:
throw new java.lang.OutOfMemoryError(... |
c9c308fa-fc04-472c-ae70-57025f781eb2 | 9 | final synchronized void method2902(int i) {
if (i == 0) {
method2923(0);
this.removeNode();
} else if (anInt8970 == 0 && anInt8974 == 0) {
anInt8972 = 0;
anInt8969 = 0;
anInt8976 = 0;
this.removeNode();
} else {
int i_60_ = -anInt8976;
if (anInt8976 > i_60_)
i_60_ = anInt897... |
25907076-6c91-4707-8d01-ef13aa1e52f1 | 7 | public void GetMaximas() {
lowerX = 0;//PointArray[0];
upperX = 0;//PointArray[0];
lowerY = 0;//PointArray[1];
upperY = 0;//PointArray[1];
for (int i = 0; i <= (PointArray.length-1); i += 2) {
if (Double.isInfinite(PointArray[i])) {// || Double.isNaN(PointArray[i])){... |
2eb8ef44-ea5b-4cf7-a3b4-8fe75166cc19 | 3 | private void greetHelper() {
Jokes joke = new Jokes(this.connection, config.getChannel());
try {
if (!hasArgs) {
connection.msgChannel(config.getChannel(), joke.getPhoneNumber(getRandChanUser()));
} else {
int temp = cmdArgs.indexOf(' ');
if (temp != -1) {
connecti... |
b4e545a5-1997-4e62-b08c-8f8fb780dac2 | 3 | public String toStringFromTracker(){
String returnMe = "";
try{
for (Entry<String, Integer> entry : this.questTracker.entrySet()) {
//Should be a string if their list is setup correctly
String key = entry.getKey(); // Objective name
int value = entry.getValue(); // actual tracker
returnMe += ... |
f1ded83a-4214-4dd9-9ce3-123c8868c75c | 9 | @Override
public void actionPerformed(ActionEvent event) {
int pos[] = getPos(event.getActionCommand());
int delta[] = {selection[0], selection[1]};
int i;
if(isSelection) {
if(pos[0] == selection[0] && pos[1] == selection[1]) {
unselectAll();
... |
c48a81f9-7c99-440b-9018-e9bedd346e9d | 2 | @Override
public void messageReceived(DefaultMessage msg) {
if(msg instanceof PrivateMessage) {
clientWindow.onPrivateMessageReceived((PrivateMessage) msg);
} else if(msg instanceof BroadcastMessage) {
clientWindow.onBroadcastMessageReceived((BroadcastMessage) msg);
}
} |
f1ab9951-fd79-4785-95d6-b8015b862321 | 6 | public static <T> boolean listsEquivalent(List<T> list1, List<T> list2) {
if (list1 == null) {
return list2 == null;
}
if (list2 == null) {
return false;
}
for (T t : list1) {
if (!list2.contains(t)) {
return false;
... |
a57b988c-cfdc-45d9-a5ce-d4b8a2ba0d7f | 6 | public void delete(Long id) {
try {
utx.begin();
} catch (NotSupportedException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
Message message = em.find(Message.class, id);
em.remove(message);
t... |
6374294c-59df-4865-ab95-dd76c74845a8 | 8 | public void update( GameMap gameMap )
{
gameMap.update();
debugString = "";
for( Player player : PlayerList )
{
debugString += player.Name +": "+ player.OwnedPlanets.size() +", "+ player.EnemyPlanets.size() + "\n";
}
debugTextArea.setText( debugString );
... |
6174f120-e17d-43cb-82b5-6c995adaadeb | 4 | public void updatePlayers() {
for (Client c : clients) {
if (c.loggedIn) {
ChannelBuffer updateBlock = ChannelBuffers.dynamicBuffer();
updateBlock.writeByte(1);
updateBlock.writeByte(c.updateFlags);
if ((c.updateFlags & 0x1) == 0x1) {
List<Message> messages = World.getWorld().getMessages();
... |
0a332132-efc6-4a63-b077-e198adc1578d | 2 | private void addFile(File file, int validCount) {
if (crawlStyle == DEPTH_FIRST) {
fileList.add(validCount, file);
} else if (crawlStyle == BREADTH_FIRST) {
fileList.add(file);
}
} |
87c57314-124a-4a43-8037-6c7dc81c8498 | 2 | public boolean hasFlag(EntityFlag flag) {
for (int x = 0; x < flags.size(); x++) {
if (flag == flags.get(x)) {
return true;
}
}
return false;
} |
40bfdcc8-7dc1-45d3-89af-11cc8f0c8df5 | 4 | public void printTuple(TupleExpression msg) throws CruiseRuntimeException {
if (msg.getTupleType().equals("String")) {
for (ValueExpression te : msg.getElements()) {
if (te instanceof TupleExpression) {
TupleExpression t = (TupleExpression)te;
System.out.print(t.getTupleType());
... |
2b535446-e477-460e-b63d-51c89d0cf422 | 7 | public void closeImmediately() {
/* write the window size */
this.store.setVariable(CONFIG_WINDOW_SIZE, Util.dimensionString(this.getWidth(), this.getHeight()));
/* close the task store: this is done in a loop to handle errors */
boolean promptDirectory = false;
while (true) {
try {
/* if the saving... |
0ccb0a15-6e56-4555-b05e-fd842dfa3dd0 | 4 | @Override
public void run() {
while(true) {
Map<String,Cache> map = CacheMap.CACHEMAP;
Set<String> set = map.keySet();
Iterator<String> it = set.iterator();
while(it.hasNext()) {
String key = it.next();
Cache cache = map.get(key);
long endtime = cache.getEndtime();
long nowtime = System.c... |
e9b23400-11bd-48ff-a535-7b514e3b9d0a | 7 | private void load_data (BufferedReader in, DirectedSparseGraph<String, Integer> graph) throws IOException {
long start = System.currentTimeMillis() ;
int edgeCnt = 0;
String line;
while ((line = in.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line);
String source = null;
if ( st.hasM... |
704f6dd5-fb40-4987-bd06-67a8484f2bd2 | 2 | public long[][] findEnergy() {
long[][] gradient = new long[height][width];
int i, j;
int gxred, gyred, gxblue, gyblue, gxgreen, gygreen;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
// processing red gx
gxred = gyred = gxblue = gyblue = gxgreen = gygreen = 0;
gxred += pixel[acces... |
eb69ae33-16e9-4281-9bcb-04302d3954c0 | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
92012b90-1685-486e-8371-d03643d5fdb1 | 0 | @Override
public void mousePressed(MouseEvent paramMouseEvent) {/**/} |
b4f49af2-f0cc-4ae8-b745-b9ed89259567 | 1 | public void setImgPathLoadingStatusBg(Path img) {
this.imgLoadingStatusBg = handleImage(img, UIResNumbers.LOADINGSTATUS.getNum());
if (this.imgLoadingStatusBg == null) {
deleteImage(UIResNumbers.LOADINGSTATUS.getNum());
}
} |
0345e106-dbf0-44a0-8360-b45c6ff911f9 | 1 | public String getArtifactBaseDir() {
if (this.name == null) throw new IllegalStateException("Cannot get artifact dir of empty/blank artifact");
String[] parts = this.name.split(":", 3);
return String.format("%s/%s/%s", new Object[] { parts[0].replaceAll("\\.", "/"), parts[1], parts[2] });
} |
57b19892-37af-4730-a27e-cbcc142dbc3e | 2 | @Override
public void ResetMazzo() {
for(int seme =0; seme < 4;seme++){
for (int valore=0; valore<13;valore++){
mazzo.add(new Carta(seme,valore));
}
}
} |
9a55a626-d604-4530-bd20-9ea17fa6e56c | 8 | ArrayList<String> processQueryCollection() throws BusinessException{
ArrayList<String> commonSpaceIDs = new ArrayList<String>();
ArrayList<String> firstSetOfIds = new ArrayList<String>();
Set<Triple> currentQueryTriples = null;
for(int i=0; i< queryCollection.size();i++){
String temp = queryCollection... |
3ed81727-96a3-42c1-a0ca-c33e157f4305 | 0 | public void setTimeLimit(Integer timeLimit) {
this.timeLimit = timeLimit;
} |
d8ce0382-8bf7-4d4e-a3ca-81448056381a | 6 | * @param geo Geometry for which the alternate bounds should be updated.
* @param willCollapse Boolean indicating if the cell is going to be collapsed.
*/
public void updateAlternateBounds(Object cell, mxGeometry geo,
boolean willCollapse)
{
if (cell != null && geo != null)
{
if (geo.getAlternateBounds()... |
a26a6ff2-990e-4526-83b2-aae585f329af | 6 | private void songtitle(Scanner scdiv) {
while (scdiv.hasNext()) {
String getline = scdiv.nextLine();
if (getline.contains("class=\"tit\"")) {
String ab = getline.replaceAll(
" <span class=\"tit\" id=\"cTitle\">", "").replaceAll(
... |
645736b0-96c5-462f-8f3c-18b017cde56c | 1 | public Text(String text) {
if(defaultUnifont == null)
setDefaultFont();
parseText(text);
} |
a6292435-a589-485d-ad95-5d198e3c0b09 | 0 | public void setEventCommentList(final List<EventComment> eventCommentList) {
this.eventCommentList = eventCommentList;
} |
08c55e44-edeb-4c77-ab46-f5395a6aa99b | 3 | @Override
public void deserialize(Buffer buf) {
challengeId = buf.readShort();
if (challengeId < 0)
throw new RuntimeException("Forbidden value on challengeId = " + challengeId + ", it doesn't respect the following condition : challengeId < 0");
targetId = buf.readInt();
... |
09dd2f98-0bc3-4d53-9acd-3c3c7eeff7ae | 7 | public void onMouseDown(MouseDownEvent event) {
if ((event.getNativeButton() != NativeEvent.BUTTON_LEFT) || m_dragging || (m_currentAnimation != null)) {
// only act on left button down, ignore right click
// also ignore if the dragging flag is still true or an animation is still runnin... |
e0788247-9e8c-4cc9-976d-dd5b58d96e7c | 4 | @Override
public void mouseMoved(MouseEvent e) {
if ((scrollerTimer != null && scrollerTimer.isRunning()) ||
drawableAvatars == null) {
return;
}
DrawableAvatar avatar = getHitAvatar(e.getX(), e.getY());
if (avatar != null) {
... |
63db33d7-d8d2-495d-8768-e42c6bf630ec | 9 | @Override
public void propertyChange(final PropertyChangeEvent evt) {
// If text file was changed we need its name with an asterisk sign
if (evt.getPropertyName().equals("changed")) {
this.setTitleAt(TabbedPane.this.getSelectedIndex(), CurrentlyOpenTextFile.getInstance()
.getCurrentlyOpenTextFile().getSimpe... |
860ff7d0-cc20-4af4-9ac7-180bae88712c | 1 | public static synchronized Cache getInstance() {
if (instance == null) {
instance = new Cache(new TreeMap());
}
return instance;
} |
6615311c-70f3-405d-90a4-b4b016e717bc | 2 | private boolean jj_3R_65() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_73()) {
jj_scanpos = xsp;
if (jj_3_74()) return true;
}
return false;
} |
d8f4708d-a4e3-4b64-95c8-c930c2d42eec | 6 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (shadowEtchedInButton.getSelection ()) style |= SWT.SHADOW_ETCHED_IN;
if (shadowEtchedOutButton.getSelection ()) style |= SWT.SHADOW_ETCHED_OUT;
if (shadowInButton.getSelection ()) style |= SWT.SHADOW_IN;
if (... |
c222bcf9-edfd-45be-976a-ba6c3b4e87dc | 2 | private void release() throws ClosedByInterruptException {
HackThread ut = (HackThread)Thread.currentThread();
InterruptAction ia = this.ia.get();
if(ia == null)
throw(new Error("Tried to release a hacked thread without an interrupt handler."));
ut.remil(ia);
if(ia.interrupted) {
ut.interrupt();
thr... |
3449cf5b-e221-4834-9857-f9e482bf1f67 | 3 | public int getNbBases() {
// how many bases does the player have ?
int nbBasesPlayer = 0;
for(Base b: Game.getInstance().getBaseManager().getBases()) {
if (b.getPlayer()!=null && b.getPlayer().equals(this)) {
++nbBasesPlayer;
}
}
return nbBasesPlayer;
} |
7cfe9847-0cc5-4c62-815c-f7ae8c13749a | 7 | private void calculateCalendar() {
// clear the selected date
if (null != selectedDay) {
selectedDay.setBackground(white);
selectedDay = null;
}
// get the first day of the selected year and month
final GregorianCalendar c = new GregorianCalendar(
... |
35dd0058-2bda-427d-99af-6459f1c06cc2 | 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... |
5d20539c-115c-4026-a13e-e42b925a9538 | 4 | public static void main(String[] args) {
// TODO Auto-generated method stub
if(args.length<3)
{
System.err.println("Argument error");
System.err.println("Argument: input_file output_file uni_gram_file");
System.exit(1);
}
SVMClassifier c=new SVMClassifier();
try
{
... |
dbe5b2d2-9495-427f-ada8-35a9092ce863 | 2 | public String getEmailByUID(Statement statement,String UID)//根据用户名获取邮箱
{
String result = null;
sql = "select email from Users where UID = '" + UID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getString("email");
}
}
catch (SQLException e)
{
Sy... |
7baac820-3953-408d-8535-d37cdb06ad32 | 8 | private void printFile (String filename) {
try {
byte[][] data = null;
//Check ring of trust first
File file = null; //folder
File file2 = null; //file
file2 = new File("./ServerFiles/" + filename);
file = new File("./ServerSignatures/" + file2.getAbsolutePath().replaceAll("[^\\p{L}\\p{Z}]",""))... |
c1c6f1b7-8c1b-4701-9219-acf5373ae443 | 4 | public static void editBook(Book b){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedState... |
f49dd99f-2251-4471-a0d9-e26f0962cca5 | 2 | public void addHex(HexLocation hexLoc, HexType hexType)
{
// Add hex to hex map
hexes.put(hexLoc, hexType);
// Compute hex point for the new hex
allHexPoints.put(hexLoc, getHexPoint(hexLoc));
// Compute edge points for the new hex
for (EdgeDirection edgeDir : EdgeDirection.values())
{
EdgeLoc... |
1019ca93-ff79-41f4-817b-14c0bbd50f64 | 1 | public DataCompiler ReadXml(String filename) {
DataCompiler archivo = null;
String to = System.getProperty("user.dir"); // recupero el directorio del proyecto
String separator = System.getProperty("file.separator"); //recupero el separador ex: Windows= '\' , Linux='/'
to = to + separator... |
ca758ab3-b9be-4e82-8aa4-7b7440f50656 | 6 | public void enablePlayerOneSpaces()
{
for (int x = 0; x < checkersSpaces.length; x++) {
for (int y = 0; y < checkersSpaces.length; y++) {
if(checkersSpaces[x][y].getIcon() != null && checkersSpaces[x][y].getIcon().equals(playerOneCheckerPiece))
{
checkersSpaces[x][y].setEnabled(true);
}
else ... |
4bfbe3b7-2fc9-46be-a0cb-407197e876bf | 7 | private void fillSelectedArea(int element) {
boolean b = false;
for (int k = 0; k < nAtom; k++) {
if (selectedArea.contains(atom[k].getRx(), atom[k].getRy())) {
b = true;
break;
}
}
if (obstacles != null) {
int n = obstacles.size();
if (n > 0) {
for (int k = 0; k < n; k++) {
if (sel... |
08d651af-39d3-4d5c-88ef-e4054ba40fa8 | 9 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox))
{
return false;
}
else
{
byte var4 = 11;
if... |
8e56cd1e-e008-40fc-9dfa-d6a3058bdcee | 0 | public int to() { return w; } |
4a60e81e-b55e-476d-95c1-a127f8e5dc52 | 8 | public static Inet4Address getIP4AsNeeded(Collection<InetAddress> hostAdresses){
Inet4Address returnAddr = null;
Inet4Address globalAddr = null;
Inet4Address siteLocalAddr = null;
Inet4Address loopBackAddr = null;
for (InetAddress inetAddress : hostAdresses) {
if(inetAddress instanceof Inet4Address){
... |
70d2f781-42a9-4bef-8e83-a1c607ba08d2 | 8 | private boolean loadNextProfile() {
ArrayList<String> lines = null;
while (profilesEnum.hasMoreElements()) {
if (lines != null) {
lines.clear();
} else {
lines = new ArrayList<>();
}
final URL url = profilesEnum.nextElement();
try {
final InputStream in = ur... |
0265a46c-fa43-48f6-9b82-05538049ceb7 | 4 | public static boolean transform(InstructionContainer ic,
StructuredBlock last) {
if (!(last.outer instanceof SequentialBlock)
|| !(ic.getInstruction() instanceof StoreInstruction)
|| !(ic.getInstruction().isVoid()))
return false;
return (createAssignOp(ic, last) || createAssignExpression(ic, last));
... |
0f60fe5c-79d2-4972-b8df-2ec35ee0ca9b | 7 | public Object run(Class<?> classType,Object obj[]) throws Exception
{
//获取类的class对象
// Class<?> classType = Class.forName(className);
//生产类的实例对象
Object invokeTester = classType.newInstance();
//获取声明的方法
Method[] methods = classType.getDeclaredMethods();
for(Method mthd: methods)
{
if(mthd.is... |
71eca467-951a-4c0a-97c8-aa9c7f3b7225 | 4 | @Override
public long solve() {
Stack<Integer> stack = new Stack<Integer>();
int columnSum = 0;
StringBuilder sb = new StringBuilder();
for (int ci = DATA[0].length() - 1; ci >= 0; ci--) {
for (int ri = 0; ri < DATA.length; ri++) {
columnSum += getNumber(r... |
0296f7ea-6866-45b9-af6d-c38f1e638857 | 9 | public Matrix fixDoublingElements(Matrix m, ArrayList<String> W2,
ArrayList<Set<String>> sortedKeys) {
Matrix p = new Matrix(m);
String ids[] = p.getIds();
int[][] conn = p.getConnections();
int startPosition = ids.length - W2.size(); //CHECK!
int[] count = new int[co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.