method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
cd50aa01-130b-44c9-92b5-85df7387a854 | 0 | public void dragg(Excel start, Excel finish)
{
} |
e7aa0368-3acc-45fa-864e-cb57b15e08c7 | 7 | private void setHighlightPosition() {
if ( activePosition != null ) {
int x, y;
if ( perspective == WHITE ) {
x = activePosition.getX () - 1;
y = activePosition.getY () - 1;
}
else {
x = CELL_AMOUNT - activePosition.getX ();
y = CELL_AMOUNT - activePosition.ge... |
3fb53fb8-b9c5-48c4-9522-244f0a668329 | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
9517a4f2-ddd1-41b1-ac6c-518754375af2 | 0 | public void setDestinationStop(int value) {
this._destinationStop = value;
} |
533836d3-fc53-4221-80aa-d30da2336d0f | 3 | public ArrayList<MusicObject> getAllSongs() {
ArrayList<MusicObject> retVals = new ArrayList<MusicObject>();
try {
if (connection == null) {
connection = getConnection();
}
String sql = "select "+getColumnNames("music")+" from org.music music";
log.info("About to execute: " + sql);
... |
17971d28-637b-4e8c-b63b-6dba893e2282 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[34];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 23; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... |
26d08c00-e5b1-4813-9bed-6b6994638d43 | 4 | @Test
public void testGetAllAvailableMoves() {
System.out.println("getAllAvailableMoves");
Board board = new Board(8, 12);
RuleManager instance = new RuleManager();
SetMultimap<Position, Position> expResult = HashMultimap.create();
for (int i = 1; i < board.getSize(); i += 2)... |
84330be5-ff76-4a18-8658-fc9c24fa1387 | 8 | private static int decode4to3(
byte[] source, int srcOffset,
byte[] destination, int destOffset, int options ) {
// Lots of error checking and exception throwing
if( source == null ){
throw new NullPointerException( "Source array was null." );
} // end if
... |
2934c6f9-09e4-425b-aea3-a9fd2a9bfbd3 | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
651f40b3-3e02-4b50-8594-8e06af94cddd | 5 | public void keyReleased(KeyEvent arg0) {
switch (arg0.getKeyCode()) {
case KeyEvent.VK_UP:
upKey.setPressed(false);
break;
case KeyEvent.VK_DOWN:
downKey.setPressed(false);
break;
case KeyEvent.VK_SPACE:
spaceKey.setPressed(false);
break;
case KeyEvent.VK_LEFT:
leftKey.setPressed(false);... |
dccbc5d6-696f-4475-98de-32c4b224a40e | 2 | private void receive() {
receive = new Thread(this, "Receive") {
public void run() {
while (running) {
byte[] data = new byte[1024];
DatagramPacket packet = new DatagramPacket(data, data.length);
try {
socket.receive(packet);
} catch (IOException e) {
e.printStackTrace();
}... |
caf5c59c-0434-4842-81b2-664b74ecf51c | 4 | private void modifyThread(Map<String, Object> jsonrpc2Params) throws Exception {
Map<String, Object> params = getParams(jsonrpc2Params,
new NullableExtendedParam(Constants.Param.Name.THREAD_ID, false),
new NullableExtendedParam(Constants.Param.Name.HEADLINE, false),
... |
b9689901-9c78-4f3b-944c-aaf45d9e84e5 | 2 | public void actionPerformed(ActionEvent e)
{
String command = e.getActionCommand();
if (command.equals("GEN"))
{
try {
editor.setPage(meriseRapport.createRapport());
} catch(IOException exc) {
... |
8ddcc0d1-3b2d-4d02-b3ea-105c5de9d5b6 | 4 | @Override
public void mouseDragged(MouseEvent e) {
if(px == null && py == null){
px = e.getX();
py = e.getY();
}
x = e.getX();
y = e.getY();
Graphics2D g2 = (Graphics2D) canvas.getImg().getGraphics();
g2.setColor(canvas.getColor());
g2.setStroke(canvas.getStroke());
if (x != -1 && y != -1) {
g... |
0cfb9390-3e07-4ae6-8715-04a332d02391 | 0 | public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
} |
ffd78c7b-42b2-4c7c-b908-7b4c5762a8cf | 4 | @EventHandler(priority = EventPriority.NORMAL)
public void onChat(PlayerChatEvent event){
Player p = event.getPlayer();
String s = event.getMessage();
String active = bm.getSign(p.getName());
if(active != null) {
event.setCancelled(true); //Dont show the message.
bm.setSign(p.getName(), null);
if(act... |
295ab7f0-6e19-41ac-8277-3d0c038a1ba5 | 7 | public String getTypeDescription(File f) {
String extension = Utils.getExtension(f);
String type = null;
if (extension != null) {
if (extension.equals(Utils.jpeg)) {
type = "JPEG Image";
} else if(extension.equals(Utils.jpg)) {
... |
e1d7db2b-dd11-4905-b5f1-b9a8d9cf1543 | 9 | @Override
public String toString() {
String suiteDisplay, valueDisplay;
switch (suite) {
case "S":
suiteDisplay = "Spades";
break;
case "H":
suiteDisplay = "Hearts";
break;
case "D":
... |
d4fd1936-f942-4002-a801-893d5a8b0044 | 4 | public String[] getVariables() {
ArrayList list = new ArrayList();
String[] rhsVariables = getVariablesOnRHS();
for (int k = 0; k < rhsVariables.length; k++) {
if (!list.contains(rhsVariables[k])) {
list.add(rhsVariables[k]);
}
}
String[] lhsVariables = getVariablesOnLHS();
for (int i = 0; i < l... |
814400a5-c73b-4149-b489-e7dcb6fbe935 | 0 | public Environment(Serializable object) {
theMainObject = object;
clearDirty();
initView();
} |
33ba77e1-a218-4118-aaba-57f67d2efc0b | 5 | public static double[][] calculateDensity() {
int numGridLines = getNumGridlines();
double[][] density = new double[numGridLines][numGridLines];
double i1 = Settings.getMinimumRange();
// Calculate un-normalized density for each point in domain, looping across X1
for (int x1Ind = 0; x1Ind < numGridLines... |
89aa3961-5c17-40fd-b4d3-53f3d421a4ef | 5 | private ArrayList<T> getList(Object... objects)
{
ArrayList<T> l = new ArrayList<T>();
for(Object obj : objects)
{
if(typeClass.isInstance(obj))
{
l.add(typeClass.cast(obj));
}
else
{
if(obj instanceof Object[])
{
l.addAll(getList((Object[])obj));
}
if(obj instanceof... |
534d066f-37bc-43cb-9c80-a0675dbc1531 | 8 | private MouseListener createProductContainerTreeMouseListener() {
return new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
handleMouseEvent(e);
}
@Override
public void mouseReleased(MouseEvent e) {
handleMouseEvent(e);
}
private void handleMouseEvent(MouseEvent ... |
6764030b-2750-4f88-8836-76e451843315 | 8 | public void collisionCheck(){
if(bulletsInRoom.size() >0){
bullets = new CopyOnWriteArrayList<Bullet>(bulletsInRoom);
for(Bullet b: bullets){
b.updateBounds();
if(enemylist.size()>0){
enemies = new CopyOnWriteArrayList<Enemy>(enemylist);
for(Enemy e: enemies){
if(b.bounds.intersects(e.en... |
406796b4-c9c9-4ed3-a373-464a02ab7173 | 9 | private int buildJump(int xo, int maxLength) {
gaps++;
//jl: jump length
//js: the number of blocks that are available at either side for free
int js = random.nextInt(4) + 2;
int jl = random.nextInt(2) + 2;
int length = js * 2 + jl;
boolean hasStairs = random.nex... |
7598cc2b-6b88-48e9-a945-7d3c2c0bd30c | 2 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(LevelEditorView.HELP)){
new HelpFrame();
} else if (e.getActionCommand().equals(LevelEditorView.SAVE)) {
this.save(); //save the level
}
} |
41b175ff-a93e-4c69-ae73-26ca0f7482de | 1 | @OnOpen
public void onOpen(Session userSession) throws IOException {
chatroomUsers.add(userSession);
this.userSession = userSession;
Iterator<Session> iterator = chatroomUsers.iterator();
while (iterator.hasNext()) {
(iterator.next()).getBasicRemote().sendText(buildJsonUs... |
4d8d388f-c9a6-4553-aff9-be83f71e49b1 | 8 | public boolean pairMatch(
LinkedHashMap<String, LinkedHashMap<String, String>> humanPropRoot,
String correctName1, String correctName2) {
if (humanPropRoot.containsKey(correctName1)
&& humanPropRoot.containsKey(correctName2)) {
String gender1 = humanPropRoot.get(correctName1).get("g");
String gender2 ... |
d09f6077-f9b8-42ff-89fd-691489996bff | 3 | private CommunityAccount accountFromResultSet( Connection con, ResultSet rs ) throws SQLException {
long id = rs.getLong("uid");
/**
* Grab roles from other table. Don't use the wrapper since this is only called
* from process() (i.e., when we already have the lock)
*/
PreparedStatement s = con.prepa... |
aecc92b2-fa74-4819-a567-a12b22ba1983 | 2 | public void shrink() {
trimWidth /= 2;
trimHeight /= 2;
byte image[] = new byte[trimWidth * trimHeight];
int off = 0;
for (int offY = 0; offY < height; offY++) {
for (int offX = 0; offX < width; offX++) {
image[(offX + offsetX >> 1) + (offY + offsetY >> 1) * trimWidth] = pixels[off++];
}
}
pixel... |
e4dd1b24-72f4-40d0-ad74-dc5a9820f244 | 8 | protected void search(String fileName){
startOutput(fileName);
while(!cobweb.getUnsearchQueue().isEmpty()){
final WebPage wp = cobweb.peekUnsearchQueue();// 查找列隊
System.out.println("!cobweb.getUnsearchQueue().isEmpty(): " + wp.getUrl());
//初始節點
if(wp.getDepth() == 0){
try {
leavesNodeFileWri... |
b3a95fba-a3fa-4d33-9c52-777f9cb3cd45 | 5 | public static void ex4() throws NumberFormatException, IOException{
int [] array=new int[10];
for(int i=0; i<10; i++){
array[i]=(int)(Math.random()*100);
System.out.print(array[i]+"\t");
}
System.out.print("\nValor => ");
int val=Integer.parseInt(stdin.readLine());
boolean encontrado=false;
for(int i=0; i<10... |
7776f418-e444-43fe-9b2b-1d9b72220b29 | 4 | public static Valign parse(HtmlElement element, String str){
switch(str){
case "top":
return TOP;
case "middle":
return MIDDLE;
case "bottom":
return BOTTOM;
case "baseline":
default:
return BASELINE;
}
} |
82b27749-caad-48b4-af4d-d0a52c2e70a2 | 8 | public static void main(String[] args) {
// TODO Auto-generated method stub
String marketIP = args[0];
//String marketIP = "192.168.1.107";
int numberOfAgent = Integer.valueOf(args[1]);
//int numberOfAgent = 100;
final int recycleTime = Integer.valueOf(args[2]);
//final int recycleTime = 100;
... |
e96a8455-30f5-4b37-96e4-a3e9145a36ca | 6 | final void method1556(ItemDefinition class213_9_, byte i,
ItemDefinition class213_10_) {
try {
anInt2808 = class213_9_.anInt2808;
((ItemDefinition) this).anInt2779 = ((ItemDefinition) class213_10_).anInt2779;
((ItemDefinition) this).anInt2819 = 0;
aShortArray2785 = class213_9_.aShortArray2785;... |
8bb01c53-65d2-4df8-89f9-785f578aab34 | 0 | public static void main(String[] args) {
JFrame frame = new JFrame("GuiFrame");
frame.setContentPane(new GuiFrame().mainframe);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
} |
33e2f612-cc7f-437d-9840-80ac9479712f | 8 | public static java.sql.Connection openConnection(Properties properties) throws SQLException, ClassNotFoundException {
String userName = properties.getProperty("app.dao.userName") == null ? "" : properties.getProperty("app.dao.userName");
String daoHost = properties.getProperty("app.dao.host") == null... |
c4694ba4-5c27-44f4-931b-38f1390cab24 | 9 | public static void computeRankings() {
/*
* 1) win% (4-1 > 3-2)
* 2) more wins (3-3 > 2-2)
* 3) less losses (0-2 > 0-4)
*/
if (roster.size()!=0) { // put first player in first
rankings.add(new LinkedList<Integer>());
rankings.get(0).add(0);
}
for(int i=1;i<roster.size();++i) { // loo... |
e9e9e09c-8b55-4dcd-8df2-6252b517e4d1 | 5 | public void processStep() throws FroshProjectException {
// Increment the day number
//
day++;
// Log a message
//
FroshProject.getLogger().log(Level.FINE, "Processing day " + day);
// Get the new weather state
//
processWeatherChange();
... |
0131f1eb-c05e-43f3-af80-a688bdb846ca | 6 | void portNumberKeyReleased(KeyEvent e) {
if (client.getCommunicator() != null) {
popUpWindow dialog = new popUpWindow(this, "Wollen Sie sich wirklich vom Server abmelden ?");
if (dialog.getResult()) {
client.disconnect();
}
}
if (client.getCommunicator() == null) {
isPortOk... |
13462065-0820-4a21-adc0-bd6a52fe08a7 | 2 | public Track getTrack(final int trackRefNumber) throws SQLException
{
// First Build the bare track details
PreparedStatement s = Connect
.getConnection()
.getPreparedStatement(
"SELECT RecordNumber, TrackName, Length, TrackNumber,formtrack FROM Track WHERE Trac... |
7db40bc7-9d73-4b6a-83ba-08afaa0eb93b | 4 | private boolean listFind(ListNode<T> node ,T element )
{
ListNode<T> tmpNode = node;
if(tmpNode == null)
{
return false;
}
while(tmpNode.next !=null)
{
if(tmpNode.element.equals(element))
{
return true;
}
tmpNode = tmpNode.next;
}
if(tmpNode.element.equals(element))
{
return tru... |
ca75959e-f142-43dd-bc17-9ce7049ee93a | 8 | private void calculateDiagonalsAndBounds() {
super.modelHeight = 0;
diagonal2DAboveOrigin = 0;
maxY = 0;
minX = 0xf423f;
maxX = 0xfff0bdc1;
maxZ = 0xfffe7961;
minZ = 0x1869f;
for (int vertex = 0; vertex < vertexCount; vertex++) {
int x = verticesX[vertex];
int y = verticesY[vertex];
int z = ver... |
33db0993-317b-4288-a735-15f4be0e24ad | 3 | public long getHostID(String link) throws ForceErrorException {
long retVal = 0;
try {
Memcached cache = Memcached.getInstance();
URL url = new URL(link);
String host = url.getHost();
Object cacheValue = cache.get("papayHostID:" + host);
if (cacheValue == null) {
retVal = this.selectHost(... |
365caca9-851c-4fc7-8527-0cd5382e01af | 0 | public static Visiteur selectOneByNomPrenom(EntityManager em, String nom, String prenom) throws PersistenceException {
Visiteur visiteur = null;
Query query = em.createQuery("select v from Visiteur v where v.nom = :nom and v.prenom = :prenom");
query.setParameter("nom", nom);
query.setPa... |
d9fea7da-1f70-4ec5-9ac4-cb019adeca71 | 5 | static private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
return 3;
}
switch(curChar)
{
cas... |
23043f5e-53dd-4ee4-adf5-753156ec7c6c | 3 | private void itemCounterDown(FieldItem item) {
switch (item.getType()) {
case 'T':
numberOfTrees--;
break;
case 'D':
numberOfDucks--;
break;
case 'H':
numberOfHunters--;
break;
... |
d768e31a-31a8-4630-8f87-e0d2e6f3ceba | 2 | public double getEtxToNode(int nodeID) {
Iterator<Edge> it2 = this.outgoingConnections.iterator();
EdgeOldBetEtx e;
while (it2.hasNext()) {
e = (EdgeOldBetEtx) it2.next();
if (e.endNode.ID == nodeID)
return e.getEtx();
}
return 0.0;
} |
ef10aa82-9f47-4e36-9238-75ecd62cb8b8 | 2 | public void save(){
File newDir = new File(DocIO.SAVE_PATH+doc.getName()+"Results");
if (!newDir.exists())
newDir.mkdirs();
try (
OutputStream file = new FileOutputStream(newDir.getAbsolutePath()+"/"+takersName);
OutputStream buffer = new BufferedOutputStream(file);
ObjectOutput output = new Objec... |
4ceff345-eacf-4496-9504-0bb96dfbf05f | 8 | public void trimRect(final Rectangle aRect)
{
int lastX = aRect.x;
int lastY = aRect.y;
int firstX = aRect.x + aRect.width;
int firstY = aRect.y + aRect.height;
boolean bFoundAPixel = false;
for (int y=aRect.y; y<aRect.y + aRect.height; ++y)
{
... |
356d3638-3838-475d-a498-7e7601349d73 | 0 | public void setType(int type) {this.type = type;} |
2204acf5-0208-4b58-8524-36bbb52bcd65 | 2 | @Override
public int hashCode() {
int result = user != null ? user.hashCode() : 0;
result = 31 * result + (role != null ? role.hashCode() : 0);
return result;
} |
8829db2c-9f01-4c93-84de-697114ca5287 | 9 | private void loadMapFromFile(String mapFilePath) throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(mapFilePath);
... |
1a8ccc05-6527-460b-84da-b2727049bd90 | 9 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 75
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 75
... |
9d8850bd-1b3b-4197-a91a-3c38fb893ff5 | 1 | public void visitThrowStmt(final ThrowStmt stmt) {
if (stmt.expr == from) {
stmt.expr = (Expr) to;
((Expr) to).setParent(stmt);
} else {
stmt.visitChildren(this);
}
} |
cb3a4c41-f88c-4d59-9908-c2ac076748e2 | 9 | public int largestRectangleArea(int[] height) {
intStack heights = new intStack(height.length);
intStack indexes = new intStack(height.length);
int LargestAres = 0;
for (int i = 0; i < height.length; i++) {
if (heights.isEmpty() || height[i] > heights.peek()) {
... |
98093e43-41c1-4fd1-ae60-f6ac2192a9e5 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if(c == 0) {
return null;
}
if(c == '<') {
return XML.LT;
}
sb = new StringBuffer();
for(;;) {
if(c == '<' || c == 0) {
back();
return sb.toString().t... |
92ef866a-9c4a-42b0-a13f-2fbc78ffec26 | 2 | @Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns;
//Find the column.
int boardPositionColumn = boardPosition % columns;
if (boardPositio... |
5007ef79-ee70-4db3-872f-eac819192408 | 8 | public static void dswap_f77 (int n, double dx[], int incx, double
dy[], int incy) {
double dtemp;
int i,ix,iy,m;
if (n <= 0) return;
if ((incx == 1) && (incy == 1)) {
// both increments equal to 1
m = n%3;
for (i = 1; i <= m; i++) {
d... |
8f61fb3d-7b0a-4d9e-850a-b01f9e172a26 | 7 | protected void determineUnusedIndices(Instances data) {
Vector<Integer> indices;
int i;
int n;
boolean covered;
// traverse all ranges
indices = new Vector<Integer>();
for (i = 0; i < data.numAttributes(); i++) {
if (i == data.classIndex())
continue;
covered = f... |
9c602c0a-7118-4c07-8007-0f9fcbbbfb78 | 5 | private void recalculateDimensions()
{
if(originalImage!=null)
originalSize = new Point(originalImage.getAbsoluteWidth(), originalImage.getAbsoluteHeight());
else
originalSize = new Point(correctImage.getAbsoluteWidth(), correctImage.getAbsoluteHeight());
scaledSize = new Point(originalSize);
if... |
4f0ae4bf-8c83-409b-b59c-9791754a7312 | 1 | public void testSetEndMillis_long2() {
MutableInterval test = new MutableInterval(TEST_TIME1, TEST_TIME2);
try {
test.setEndMillis(TEST_TIME1 - 1);
fail();
} catch (IllegalArgumentException ex) {}
} |
dc7c9d35-8dd7-4e42-8428-19bf5e244707 | 0 | public void loadRegion(Region region){
regions.add(region);
this.attachChild(region);
} |
584eaad9-bfbf-43db-a42c-b29277fa7192 | 2 | public boolean addItem(Item item){
if(item != null){
if(!checkOverLimit()){
itemList.add(item);
return true;
}
}
return false;
} |
7c5e6d7e-3f2b-4eae-99b8-90231678166b | 1 | public void arenaBoardcast(String message) {
for (Player p : players) {
plugin.sendtoplayer(p, message);
}
} |
89368ee2-9a51-4b3e-9ebf-10b222ac6b21 | 8 | public void actionPerformed(ActionEvent e) {
String selected = e.getActionCommand();
if (selected.indexOf("Font:") != -1) {
tp.setFont(selected.split("Font:")[1]);
} else if(selected.indexOf("FontSize:") != -1) {
tp.setFontSize(Integer.parseInt(selected.split("FontSize:")[1]));;
} else if(selected.indexO... |
6e70b8a8-b7ca-4da4-b5db-c745447a5bb6 | 2 | @Override
public LoginUserResponse loginUser(String username, String password) {
ArrayList<Pair<String,String>> requestHeaders = new ArrayList<Pair<String,String>>();
requestHeaders.add(new Pair<String,String>(CONTENT_TYPE_STR, APP_JSON_STR));
UserRequest loginRequest = new UserRequest(username, password);
ICo... |
63a4c7c0-2dfc-4bab-a0d6-05272b62f3e0 | 2 | private void checkThreeOfAKind() {
for (int i = 0; i < 13; i++) {
if (getNumberOfValues(i) == 3) {
myEvaluation[0] = 4;
myEvaluation[1] = i;
myEvaluation[2] = i;
myEvaluation[3] = 0;// Find leftover card
break;
}
}
} |
823fa305-ff3b-4eea-9b81-33e46a05bf76 | 9 | public static void main(String[] args) {
try {
logger.info("Entering application.");
String inputFolder = null;
File jarFile = null;
// Path to the folder jar is executed from
String jarPath = App.class.getProtectionDomain().getCodeSource()
.getLocation().getPath();
String jarDecod... |
709cf558-86ed-4b38-b3de-256ef3f467b9 | 5 | public double getTotalCostInATime(String beginTime,String endTime){
double totalCost=0.0;
ArrayList<Object> receipts=this.show();
for (Iterator iterator = receipts.iterator(); iterator.hasNext();) {
SalesReceiptPO object = (SalesReceiptPO) iterator.next();
if(changeDateToInt(object.getTime())>=changeDate... |
d6b3cb05-9fae-4a9d-bd90-96b9c7ae6626 | 5 | public Tfoot(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "align":
align = Align.parse(this, v);
break;
case "char":
charr = Char.parse(this, v);
break;
... |
b487e050-131f-4fc0-866e-b5dbb325915a | 6 | public void read(String file_name) throws DataInitialisationException{
try{
reset();
DocumentBuilderFactory dBFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dBFactory.newDocumentBuilder();
Document doc = dBuilder.parse(new FileInputStream(file_name));
/* Document root eleme... |
b3d5e8d8-841f-43ba-a094-e5978f1d90dc | 3 | private Token fetchBlockEntry () {
if (flowLevel == 0) {
if (!allowSimpleKey) throw new TokenizerException("Found a sequence entry where it is not allowed.");
if (addIndent(column)) tokens.add(Token.BLOCK_SEQUENCE_START);
}
allowSimpleKey = true;
forward();
tokens.add(Token.BLOCK_ENTRY);
return Token.... |
4ffa7521-e8a4-4a28-bd5d-39b5ccfca6b1 | 6 | public String toString() {
String s = "RDFNode {";
if( subjectUri != null ) s += "\n subjectUri = "+subjectUri;
if( sourceUri != null ) s += "\n sourceUri = "+sourceUri;
if( simpleValue != null ) s += "\n simpleValue = "+simpleValue;
for( Map.Entry<String,Set<RDFNode>> prop : properties.entrySet() ) {
f... |
fe3b006a-aaba-4ea0-859e-0cc0e1965a3d | 1 | public int getHP()
{
int hp = totalHP%getDefense();
return hp == 0 ? getDefense() : hp;
} |
4d6b0f2d-fbd0-4f78-ae9b-23287d307ec9 | 8 | private static void removeThreshold(List<String> otuNames,
List<List<Double>> dataPointsUnNormalized, double threshold)
{
List<Boolean> removeList = new ArrayList<Boolean>();
for (int x = 0; x < otuNames.size(); x++)
{
int sum = 0;
for (int y = 0; y < dataPointsUnNormalized.size(); y++)
{
sum +... |
9285403a-c44a-42fb-bf6b-402a86e7733b | 2 | private boolean checkCommand() {
try {
CommandScanner commandscanner = new CommandScanner(
StockGameCommandType.values(), descriptor);
BufferedReader reader = new BufferedReader(new StringReader(commandstring));
commandscanner.checkCommandSyntax(reader);
return true;
} catch (WrongCommandException ... |
664ce6d4-f292-4ee1-8827-9e71eae06fbf | 0 | public Map edit(Map map)
{
return null;
} |
e1772ce4-a8e8-490e-ab36-f0677a9a88bc | 2 | private void grow_leaves() {
if (internal_node)
return;
compute_divisions();
octant1 = new SpatialTree<E>(division_x, division_y, division_z, max_x, max_y, max_z, max_objects_per_leaf);
octant2 = new SpatialTree<E>(min_x, division_y, division_z, division_x, max_y, max_z, ma... |
b65a88b9-9a4a-47a3-9c84-6aa3a3180c18 | 7 | @Override
public boolean test(String value) {
// TODO Auto-generated method stub
if (value == null || value.length() == 0) {
return false;
}
int len = value.length();
if (!Character.isUpperCase(value.charAt(0))) {
return false;
}
for (int i = 1; i < len; i++) {
char c = value.charAt(i);
if (!... |
68a688c4-dcb4-47e1-9ae7-400549fb818f | 2 | private static String getRefreshTokenFromFile() {
String temp = null;
JsonObject j;
// checks if refresh token file exists
File f = new File("refresh_token.json");
if (!f.exists()) {
return null;
}
// reads in refresh token file and parses out token value
try {
j = JsonObject.readFrom(openFile("... |
24a644ae-2c4e-4c06-ab71-1083509b0ad9 | 3 | public static void main(String[] args) {
int[] data = {1, 4, 2};
for (int barrier = data.length - 1; barrier >= 1; barrier--) {
for (int index = 0; index < barrier; index++) {
if (data[index] > data[index+1]) {
swap (data, index);//граничные условия!! м... |
12333163-1275-4f7d-aeba-0129a8345a6a | 4 | void update(int delta) {
if (isFlashing) {
timeSinceFlashing += delta;
if (timeSinceFlashing >= FLASH_DURATION) {
isFlashing = false;
}
}
if(wasChargingLastUpdate && !isCharging()){
flashOnce(3, Color.white, true);
}
wasChargingLastUpdate = isCharging();
} |
14295d5b-8294-4545-a656-2f171c85d491 | 5 | @Override
public void start() throws RemoteException {
// TODO Auto-generated method stub
// determine the configure file is existed or not
if (isExistedFile(midwarePath + "conf", confFile) == false) {
throw new RemoteException("There is no " + confFile);
}
//System.out.println(serverName);
if (isExis... |
95487752-ad51-4061-a7ce-759c74df88f5 | 1 | public Castle(CastleType t, String n)
{
type = t;
name = n;
for (int i=0; i<availableToRecruit.length; ++i) {
availableToRecruit[i] = 0;
}
} |
e37f0fd0-bc66-4955-bec8-67dfc30b0eb6 | 2 | private String siteLastUpdated() {
String url = "http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml";
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection con;
long date = 0;
try {
con = (HttpURLConnection) new URL(url).openConnection();
date = con.getLas... |
25e10b34-939c-4661-a368-0f7fc438f7ab | 7 | public void run(){
try {
// Starting all threads at the same time (clock == 0 / "8:00AM").
startSignal.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
//Initializing the current time and the Random object
startTime = System.currentTimeMillis();
Random r = new Random();
//System.... |
b7e1a39f-3017-4b3c-9043-4cf464dd8ed2 | 9 | @Override
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException{
res.setContentType("text/html");
Connection con = null;
String lausend = null;
ResultSet rs = null;
PreparedStatement ps = null;
Gson gson=new Gson();
ArrayList<CreateByParty> byParty=new Arr... |
2023588b-1651-4f9c-a095-a299494251a0 | 5 | final void reflectX() {
byte[] is = ((ImageSprite) this).colorIndex;
if (((ImageSprite) this).alphaIndex == null) {
for (int i = (((ImageSprite) this).indexHeight >> 1) - 1; i >= 0; i--) {
int i_35_ = i * ((ImageSprite) this).indexWidth;
int i_36_ = ((((ImageSprite) this).indexHeight - i - 1)
* ((Ima... |
3428d349-28f8-4d64-b564-3aec9d94b2da | 1 | public TruncateHelper setSuffix(String suffix)
{
// Treat null as empty string
if(null == suffix) suffix = "";
this._suffix = suffix;
return this;
} |
220608cb-7fca-4eb9-876a-ce6a21eff596 | 6 | public void generateWing(int y) {
int iEvent = this.randomGenerator.nextInt(6);
switch (iEvent) {
case 0:
this.generateKamikazeWingLeft(y);
break;
case 1:
this.generatePassiveWing(y);
break;
case 2:
break;
case 3:
this.generateShooterWing(y);
break;
c... |
6a350835-cba7-47be-90af-db0e22cdf3c0 | 7 | protected Float coerceToFloat(Object value) {
if (value == null || "".equals(value)) {
return Float.valueOf(0);
}
if (value instanceof Float) {
return (Float)value;
}
if (value instanceof Number) {
return Float.valueOf(((Number)value).floatValue());
}
if (value instanceof String) {
try {
r... |
7c0fd630-4500-4e10-a6d6-427e080d0ac2 | 0 | @Override
public void windowClosed(WindowEvent e)
{
} |
f56a89c8-8743-415b-a5b9-2e54f32a2bc5 | 0 | protected void end() {
Robot.driveTrain.tankDrive(0, 0);
} |
e3540875-a317-4cdc-9e1d-6c268b9cbde4 | 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... |
05399d06-8b22-4989-95a8-772289701520 | 7 | @Override
public int h(T myNode) {
TicTacToeBoard<T> tictac = (TicTacToeBoard<T>) myNode;
ListToMatrix<T> matrix = tictac.getMatrix();
int h = 0;
Vector<Tile> line = new Vector<Tile>(0);
boolean check;
check = tictac.compareTilesForH((Vector<Tile>) matrix.getRow(0));
if (check)
h++;
check... |
078300bf-159c-4e39-936a-f49bb4cfbc91 | 8 | static int process(String line) {
line = line.trim();
int ind = 1;
while(true) {
if(line.compareTo("#") == 0)
break;
switch (line.trim()) {
case "HELLO":
System.out.println("Case "+ind+": ENGLISH");
break;
case "HOLA":
System.out.println("Case "+ind+": SPANISH");
break;
case... |
a2fbf134-58b7-4dd6-b7eb-332ae448940b | 2 | private ArrayList<String> wordLetterPairs(String text)
{
ArrayList<String> result = new ArrayList<String>();
// Tokenize the string and put the tokens/words into an array
String[] words = text.split("\\s");
// For each word
for (int wordCounter = 0; wordCounter < words.length; wordCounter++)
{
// Find t... |
11eab9b8-cfc9-4bbf-b7b3-e53ce99ae01f | 8 | public HashMap parse_v3_frames(RandomAccessFile s, long payload_len, int v3minor) throws IOException {
HashMap tags = new HashMap();
byte[] frame = new byte[10]; // a frame header is always 10 bytes
long bread = 0; // total amount of read bytes
while(bread < payload_len) {
bread += s.read(f... |
4f7e5137-5ab2-49de-b1f3-5a735caaef16 | 9 | public void mostrarDatoDeVenta(String campo, beansVentas venta){
String descripcion = null, parametro = null;
switch(campo.trim()){
case "nombre":
descripcion = "Nombre del producto ";
parametro = venta.getNombre();
break;
case "nick":
descripcion = "Comprado por ";
parametro = venta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.