method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f33b15c2-67a7-421b-88d9-db4d1e2da30d | 9 | private void animate(){
if(moving){
if(currentDir == Direction.SOUTH) anim.animateRow(0);
if(currentDir == Direction.WEST) anim.animateRow(1);
if(currentDir == Direction.EAST) anim.animateRow(2);
if(currentDir == Direction.NORTH) anim.animateRow(3);
}else{
if(currentDir == Direction.SOUTH) anim.setFr... |
236c6f8f-5360-43b4-9fe2-4e9933390598 | 1 | protected static final Color parseColor(String rgb) {
try {
return new Color(Integer.parseInt(rgb));
} catch (Exception e) {
return new Color(0);
}
} |
42fb7cb3-6374-4879-beb8-0eaff1f6325a | 7 | private boolean fields_valid() {
this.field_validation_errors = new String();
// fix
if ( this.fix.getText().length() == 0 || (this.fix.getText().length() > 5) ) {
field_validation_errors += "Invalid fix name!\n";
}
// track
if ( ! this.track.getText().equal... |
bd7f9033-8d38-4344-a9fb-7742b4021c10 | 8 | private DetectListTuple detectLists(Matrix<MatchTuple> wMatrix, Tree<String> a, Tree<String> b) throws MatrixException {
int m = wMatrix.getRowSize();
int n = wMatrix.getColSize();
Matrix<Double> normWMatrix = new Matrix<Double>(m, n);
//compute normalized match value
for (int i ... |
936467c1-a253-4130-aa51-077bd32c591c | 3 | @Override
public boolean equals(Object o) {
if (!(o instanceof GrammarState))
return false;
GrammarState s = (GrammarState)o;
return destinations.equals(s.destinations) &&
name.equals(s.name) &&
defaultDestination == s.defaultDestination;
} |
6fdcf643-0e84-4599-8670-2249f1760350 | 9 | private int maxMove(Board prev, int depth, int alpha, int beta)
{
moves++;
if(depth >= maxDepth) return getCost(prev); // exceeded maximum depth
int maxScore = MIN_SCORE;
Board b = new Board(prev);
for(int j = 0; j < size; j++)
{
for(int i = 0; i < size; i++)
{
if(b.move(i, j)) ... |
77ec8cd9-728a-431c-b8fa-b44912f9e092 | 0 | public void setValue(int x)
{
value = x;
} |
10a27e9d-e6b7-4987-adbe-ab48b888939f | 2 | private void processPath(MapHttpServletRequest request) {
if (usePaging) {
processPaging(request);
}
if (useDisposition) {
processDisposition(request);
}
} |
ad3b117c-21cf-4da5-8a80-35761d8660ae | 2 | public static void main(String[] args) throws IOException, InterruptedException {
String basePath = UTF16Test.class.getResource("/").getPath();
File f = new File(basePath+"/files/news.ini");
File f1 = new File(basePath+"/files/logfile.txt");
String code = FileReaderUtils.getEncode(f);
String code1 = FileReade... |
69c490fc-a667-4d11-b0f8-a069591998e7 | 7 | public static Clustering kMeans(int k, Cluster[] centers, List<? extends Cluster> data) {
assert (centers.length == k);
assert (k > 0);
int dimensions = centers[0].getCenter().length;
ArrayList<ArrayList<Cluster>> clustering = new ArrayList<ArrayList<Cluster>>();
for (int i = 0... |
0f86be51-ebd4-48a5-83a1-03bfe413ced1 | 3 | public static List<FavoritesTag> constructTags(Response res) throws WeiboException {
try {
JSONArray list = res.asJSONArray();
int size = list.length();
List<FavoritesTag> tags = new ArrayList<FavoritesTag>(size);
for (int i = 0; i < size; i++) {
tags.add(new FavoritesTag(list.getJSONObject(i)));
}... |
53610ffb-fdf5-401b-9c1d-f9ff8543074a | 8 | public static final void nextExperiment()
{
// Reading parameter
cycles = Configuration.getInt(PAR_CYCLES);
if (CommonState.getEndTime() < 0) // not initialized yet
CDState.setEndTime(cycles);
// initialization
CDState.setCycle(0);
System.err.println("CDSimulator: resetting");
controls = null;
ctrlSchedules... |
04a58857-ee1e-4d1a-bd5b-121044684c4f | 9 | public static int getCode(TribeRank tribeRank) {
if (tribeRank == Cooker) {
return 1;
}
if (tribeRank == Soldier) {
return 2;
}
if (tribeRank == Treasurer) {
return 3;
}
if (tr... |
ab5fc2f5-ec1d-41c2-801b-e4d0aab3687c | 5 | @Override
protected BitSet processHeader(BitSet bits){
int offset = 0;
symbolCount = 0;
int freqSize = fromBitSetLen(bits, offset, 6);
offset += 6;
int simbolSize = fromBitSetLen(bits, offset, 5);
offset += 5;
symbSize = (byte) simbolSize;
Integer freq = -1;
BitSet symb = new BitSet();
symbols.clea... |
a1e13d29-4155-47e2-88ac-b67d08c9265c | 4 | @Override
public String toString() {
String queing;
String parking;
String satisfied;
String exceeded;
if(!wasQueued){
queing = "\nVehicle was not queued";
}else{
queing = "\nExit from Queue: " + exitTime +
"\nQueuing Time: " + (exitTime-arrivalTime);
}
if(!wasParked){
parking = "\nV... |
d10f2765-8819-455b-a75c-3060ac0b2820 | 9 | private void updateBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateBtnActionPerformed
// TODO add your handling code here:
if (addModeBtn.isSelected() == true) {
// デフォルトテーブルを定義
DefaultTableModel defTable = (DefaultTableModel) searchResultTbl.get... |
bc0786eb-d0ec-4c1c-a497-d4fb41afae9e | 7 | @Override
public void checkInstantiationRestriction(ModelInstance m)
throws RestrictionException {
Iterator<Map.Entry<Integer, ClassInstance>> it = m.instanced_classes.entrySet().iterator();
while(it.hasNext()) {
ClassInstance c = it.next().getValue();
if(c.meta.name.equals("Feature") || c.meta.name.eq... |
39ca7055-7bf3-4eff-af5e-b3d34f496549 | 0 | public boolean login(String username, String password){
return authenticationModelBS.login(username, password);
} |
1f8bf90c-f783-4ba0-94ff-70a0793d504e | 5 | private static void drawBio2(Display d)
{
Color current = new Color(d,0,0,0);
//Complex t = new Complex(0,0);
int X = WIDTH/2;
int Y = HEIGHT/2;
for (int y = -Y; y < Y; ++y)
{
for (int x = -X; x < X; ++x)
{
Complex z = new Complex (0.008*x,0.008*y);
int n = 0;
while (n<10)
... |
c3180fda-8e60-4355-8001-bd5dace52a97 | 0 | public void setName(String name) {
this.name = name;
} |
3cbe18a1-8420-43a0-a467-5eb43a726501 | 6 | public static void Explosion(CommandSender sender, String dimension) {
Player cmdPlayer = (Player)sender;
Location cmdLoc = cmdPlayer.getLocation();
char chrDim = dimension.charAt(0);
switch(chrDim){
case 'x': case 'X':
cmdPlayer.getWorld().createExplosion((cmdLoc.add(10, 0, 0)), 4F);
case 'y': case 'Y':
... |
4d97ac88-283f-4cba-92a4-44dea934e0f6 | 9 | public void run() {
logger.debug(xmlDocument.basequery);
@SuppressWarnings("unchecked")
List<Object> result = session
.openSession()
.createSQLQuery(
xmlDocument.basequery + " limit " + limit
+ " offset " + offset).list();
Iterator<Object> iterBaseQuery = result.iterator();
Ar... |
cf9507d9-1a01-47b6-844a-d31aa61ee9ca | 7 | public void execute(Object target, String fieldname, boolean refresh)
{
if (target != null && fieldname != null)
{
try
{
Method getter = target.getClass().getMethod(
"is" + fieldname);
Method setter = target.getClass().getMethod(
"set" + fieldname, new Class[] { boolean.class });... |
4182f87b-6efa-42d7-92b4-e32264fd571d | 7 | public String toString ()
{
// Putting the towers in object arrays
String towerVisual = "";
Object[] towA = towerA.toArray();
Object[] towB = towerB.toArray();
Object[] towC = towerC.toArray();
// Looping to print each line for towers
for (int i = numOfDiscs; i > 0; i--)
{
// Checking for and putti... |
a90c5b81-aa03-410a-813d-4ed5fe19dc6a | 5 | public static boolean isSubClassOf(Class<?> subClass, Class<?> possibleSuperClass)
{
Class<?> c = subClass;
while (c != null)
{
if (c.equals(possibleSuperClass))
{
return true;
}
c = c.getSuperclass();
}
return false;
} |
714de19f-2f89-4b47-9a41-0a13d4f7c209 | 3 | public DrunkardJob addJob(String jobName, EdgeDirection edgeDirection,
WalkUpdateFunction<VertexDataType, EdgeDataType> callback,
RemoteDrunkardCompanion companion) {
/* Configure engine parameters */
switch(edgeDirection) {
case I... |
fcc4618c-d9d1-4bdb-866c-d1e65c481e15 | 1 | private static boolean decodeBoolean(String bString){
int b = Integer.parseInt(bString);
if( b==1 ){
return true;
}
return false;
} |
89d699c7-b7cb-4ee5-94b1-f6e0485e6168 | 5 | @Override
public ValueType returnedType(ValueType... types) throws EvalException {
// we want only two operands
if (types.length != 1)
throw new EvalException("Error: wrong number of operands");
if (types[0] == ValueType.BOOLEAN)
return (ValueType.BOOLEAN);
if (types[0] == ValueType.INTEGER)
return ... |
1d78c654-917f-40b3-9d56-2b2594671fbd | 8 | @Override
public boolean equals(Object obj)
{
if(Debug.getDebugValue()==1)
System.out.println("Inside Overrided equals method of MyAllTypesFirst class");
boolean returnValue = false;
if (obj == null)
returnValue = false;
if (!(obj instanceof MyAllTypesFirst))
returnValue = false;
i... |
b523a55b-0c73-4660-aceb-f60599d93629 | 8 | public void calcLightDepths(int var1, int var2, int var3, int var4) {
for (int x = var1; x < var1 + var3; ++x) {
for (int z = var2; z < var2 + var4; ++z) {
int var7 = blockers[x + z * width];
int y = height - 1;
while (y > 0 && !isLightBlocker(x, y, z... |
4c15db6d-820d-448b-bd70-42a2f569e6d2 | 5 | public boolean doCutCopyCrop( boolean clearArea, boolean doCrop, boolean useClipboard )
{
ImageFrame img_frame = main_frame.getFrameManager().getSelectedFrame();
Rectangle rect = getSelectedArea(img_frame);
if( rect == null )
return false;
int x = (int)rect.getX();
i... |
71008a16-c101-460e-9fa7-15d3341aeb74 | 4 | public static USBConnectionForModem getConnection() throws PortInUseException,
UnsupportedCommOperationException, IOException {
@SuppressWarnings("unchecked")
Enumeration<CommPortIdentifier> ports = CommPortIdentifier.getPortIdentifiers();
logger.debug("Starting to probe ports for modem.");
while (ports.has... |
7d672e16-ead5-4b29-8ccc-03c60f1c5437 | 5 | public void onKeyPressed(char key, int code, boolean coded)
{
if (coded)
{
// Checks whether the key was just pressed instead of being already down
if (!this.codesDown.contains(code))
{
// If so, marks the key as pressed
if (!this.codesPressed.contains(code))
this.codesPressed.add(code);
... |
185520fd-a775-4f94-b813-edbfe26af1b4 | 4 | public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integ... |
1d6173de-044a-4485-bc18-d413e102aa6e | 3 | private void actionOk( )
{
int temp;
try
{
temp = Integer.parseInt(numberTF.getText());
}
catch( NumberFormatException exc )
{
return;
}
if ( temp > max )
return;
if ( temp < min )
return;
number = temp;
state = State.OKAY;
setVisible(false);
} |
e83b7116-99e4-4523-9a7e-b6a61d508072 | 9 | public static ReflectionMatcher<FluentMember> canBeCalledWithArguments(final Object ... args) {
final List<Matcher<? super FluentClass<?>>> types = new ArrayList<Matcher<? super FluentClass<?>>>();
for (final Object object : args) {
if(object == null) {
types.add(anyFluentTyp... |
b6238d57-1611-42c7-a97a-59627c4bca2d | 0 | public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
} |
d440550b-afaa-4094-afbf-2975831ea994 | 1 | private void start_crawl_jButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_start_crawl_jButtonActionPerformed
String Start_URL[] = {start_url_jTextField.getText()};
System.out.println(Start_URL);
WorkerPool MainPool=new WorkerPool();
try {
MainPool.mai... |
cd267d46-864b-46f0-bc3c-858f325e44e0 | 4 | private static void printClass(ClassST clazz)
{
System.out.println(clazz._package + (clazz._package.isEmpty() ? "" : ".") + clazz.name + "{");
{
System.out.println(tab() + "imports {");
{
for(String _import : clazz.imports)
{
System.out.println(tabs(2) + _import);
}
}
System.out.printl... |
7047ceb7-c5fe-4e9f-9886-2425ca6e9ec4 | 1 | @SuppressWarnings("unchecked")
private static final Object[] decodeList(byte[] bencoded_bytes, int offset) throws BencodingException
{
ArrayList list = new ArrayList();
offset++;
Object[] vals;
while(bencoded_bytes[offset] != (byte)'e')
{
vals = decode(bencoded_b... |
216abdca-24be-488a-9348-b6c7351a23f5 | 5 | private boolean checkKVM() {
if (!HypervisorUtils.isLinuxHost()) {
LOGGER.debug("It is not a linux host");
return false;
}
if (!new File("/dev/kvm").exists()) {
LOGGER.debug("/dev/kvm does not exist");
return false;
}
if (!new File("/dev/kvm").canRead() || !new File("/dev/kvm").canWrite()) {
... |
cdd51e6d-d7fe-48c3-9a94-e1783814ddcd | 9 | public Integer selectNextActivePlayer() {
int activePlayerIndex = 0;
//find the currently active player and make inactive
for (int i = 0; i < players.length ; i++) {
Player p = players[i];
if (p == null) {
continue;
}
if(p.... |
760f6d72-065f-4d6a-854d-f9ce2ddf4f4a | 3 | public int autoPromoteUnhandledCount() {
int count = 0;
String query = "SELECT COUNT(*) AS `playercount` FROM `" + TableName(TableType.AUTOPROMOTE) + "` WHERE `handled` = ?;";
PreparedStatement statement = null;
Connection connection = getSQLConnection();
if ( tableExists(TableType.AUTOPROMOTE) ) {
try {
... |
62f888ed-5202-44c3-888f-57603c5d66bd | 3 | public void removeTile(Tile tile) {
for (int y = 0; y < bounds.height; y++) {
for (int x = 0; x < bounds.width; x++) {
if (map[y][x] == tile) {
setTileAt(x + bounds.x, y + bounds.y, null);
}
}
}
} |
ab8f7fc9-0386-4f48-a542-32929874db82 | 0 | public CheckResultMessage checkSum3(int i,int j){
return checkReport1.checkSum3(i,j);
} |
257551aa-a90a-458b-865e-8d0ef4e77ca4 | 0 | @Override
public void removeDefaultAppenders() {
removeAppender("STDOUT");
removeAppender("FILEOUT");
} |
a2eedf84-63e1-450b-b849-fa816423e0b5 | 3 | public void sort(){
for(int i = 0; i<5; i++){
for(int j = 0; j<4; j++){
if(Integer.parseInt(topScores[j][1]) < Integer.parseInt(topScores[j+1][1])){
String score = topScores[j+1][1];
String name = topScores[j+1][0];
... |
87187d7d-5484-4341-8ada-7158adfefebb | 5 | private static double[] getSupportPoints(int curvePoints,int lineNumber, double[] lowPrices) {
double[] sPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 999999999;
for(int j=-(curvePoints);j<=0;j++){
if((i+j>=0) && (i+j<lineNum... |
9876b1f3-b935-4f1c-a90f-09fd02329652 | 8 | static public void msDur(StringBuilder sb, int ms) {
if (ms < 0) {
sb.append("-");
msDur(sb, -ms);
} else if (ms < 1000) {
sb.append(ms);
sb.append("ms");
} else if (ms < 10000) {
tenths(sb, ms, 1000);
sb.append(... |
3ec8a074-3004-4b76-8450-e53c1125b13b | 4 | @Override
public void run() {
if (hasRun || !valid) {
return;
}
int parentRow = parent.getSelectedRow();
row = parent.getRowSorter().convertRowIndexToView(row);
if (row > -1 && parentRow != row) {
parent.setRowSelectionInterval(row, row);
}
hasRun = true;
} |
ccd083d0-741f-46ea-b8d9-f569000548f2 | 3 | public boolean equals(Object obj) {
try {
if (!obj.getClass().equals(imgClass.class)) {
throw new Exception();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return (obj != null)
&& ((imgClass) obj).getLocation().equals(this.location);
} |
940bb117-8c52-4543-9960-fa4bb48aa391 | 4 | public AbstractConnection( DefaultUmlDiagram diagram, DefaultBox<?> sourceItem, ConnectionArray source, DefaultBox<?> targetItem, ConnectionArray target, ItemKey<Connection> key ) {
super( diagram, key );
setSourceItem( sourceItem );
setTargetItem( targetItem );
selection = new ConnectionSelectionCapability( ... |
e0b22948-5157-4b0d-be5c-cc1cef664685 | 2 | public void render(Graphics g) {
for (int y = 0; y < tiles[0].length; y++) {
for (int x = 0; x < tiles.length; x++) {
tiles[x][y].render(g);
}
}
} |
59769ca3-a18c-45a7-bfa8-70b5b30ebc9a | 0 | public int getId() {
return id;
} |
ba1b5c26-2664-46e8-826e-cbeec4ba7e44 | 9 | int insertKeyRehash(short val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look ... |
e0e7dc38-08bf-4f3e-8928-c0a41633f43f | 1 | @Override
public Item next() {
if (!hasNext())
throw new java.util.NoSuchElementException();
Item x = current.item;
current = current.next;
return x;
} |
be72b5b9-6eba-48bb-b433-4f63c52e5010 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Professor)) {
return false;
}
Professor other = (Professor) object;
if ((this.id == null && other.id != null) |... |
70d66264-d2f8-47de-b9d3-03a8235d3fe9 | 1 | public void enqueue(Item item) {
if (isFull())
q = resize(N * 2);
q[rear] = item;
rear = (rear + 1) % (N + 1);
System.out.println("enqueue " + item + " -> front: " + front + " rear: " + rear);
System.out.println(toString());
} |
8eef337f-5992-45d4-b8be-babfb3566e8e | 8 | private int findDefaultFontIndex() {
int index = -1;
for(int i=0; i<fontNames.length; i++) {
if (fontNames[i].equals("Lucida Sans") ) {
index = i;
i = fontNames.length;
}
}
//If we found Lucida Sans, return the index
//else, look for choice number 2
if (index>-1)
return index;
else {
... |
19398860-160f-4f14-9e6a-089ffc68009a | 3 | public static void loadTransactions(SWDataClass swDataClass) {
// Create the data objects for us to restore.
SWDataClass tempData = new SWDataClass();
// Wrap all in a try/catch block to trap I/O errors.
// Open file to read from, named SavedObjects.sav.
FileInputStream saveFile;
try {
saveFile = new ... |
62af5b36-a054-4fc6-9970-e85fda472f9a | 8 | void print() {
System.out.println("@RELATION Untitled");
for(int i = 0; i < m_attr_name.size(); i++) {
System.out.print("@ATTRIBUTE " + m_attr_name.get(i));
int vals = valueCount(i);
if(vals == 0)
System.out.println(" CONTINUOUS");
else
{
System.out.print(" {");
for(int j = 0; j < vals; j... |
1864eb60-7ac5-4742-99e9-31af98dbce8c | 9 | public static final String removeUninterestingParts(String text, String startBorder, String endBorder, boolean includeBorders) {
String ret="";
try {
if(text!=null&&startBorder!=null&&endBorder!=null&&(text.indexOf(startBorder)!=-1)&&(text.indexOf(endBorder)!=-1) ) {
if(includeBorders) {
text = tex... |
ff9a82a9-1f6f-4de2-baf2-4865d02bbd31 | 1 | public void printIntArray(int[] A) {
for (int i = 0; i < A.length; i++) {
System.out.print(A[i] + " ");
}
System.out.println();
} |
eab1df8f-9dbe-49c9-80d0-f7e2cc58cf27 | 1 | public IntArrayBag clone()
{//create a clone of an IntArrayBag object
IntArrayBag answer; // another object named answer???
try
{
answer = (IntArrayBag) super.clone();
}
catch(CloneNotSupportedException ex)
{//it would not occur, but if it does, programming error,check not to forget "implements Clone... |
ed134ae6-ee7a-4494-879f-c6a50955d6ee | 4 | @Override
public void deserialize(Buffer buf) {
playerId = buf.readInt();
if (playerId < 0)
throw new RuntimeException("Forbidden value on playerId = " + playerId + ", it doesn't respect the following condition : playerId < 0");
playerName = buf.readString();
breed = buf.... |
265ed9b0-9085-4214-ac8a-32c493c6b5bc | 4 | @Override
public void movePages() {
mainOptions.move();
if(newSave != null)
newSave.move();
if(fieldSave != null)
fieldSave.move();
if(saveList != null)
saveList.move();
if(loadConfirm != null)
loadConfirm.move();
} |
cd6e744a-3e15-476b-bab2-b9e9ed266651 | 1 | private static Employee getEmployee(Employee bean, PreparedStatement stmt, ResultSet rs) throws SQLException{
stmt.setString(1, bean.getUsername());
rs = stmt.executeQuery();
if (rs.next()) {
Employee newBean = new Employee();
newBean.setName(rs.getString("name"));
newBean.setUsername(rs.getString(... |
63927264-623c-4c5d-a97d-31525a7e245a | 0 | public static void main(String[] args) {
Juoksu juoksu = new Juoksu();
} |
2389702e-33d9-4448-a4e0-ba620776e3a2 | 3 | public boolean triggerShortcut(Key key) {
if(key.getKind() == Key.Kind.NormalKey) {
NormalKeyShortcut asShortcutKey = new NormalKeyShortcut(key.getCharacter(), key.isCtrlPressed(), key.isAltPressed());
synchronized(normalKeysShortcut) {
if(normalKeysShortcut.containsKey(a... |
ae50d5d3-e3c9-463b-8332-377bb14a9b5b | 2 | public void Set_thetai(float[][] temp){
for(int i = 0; i< temp.length; i++){
for(int j = 0; j < temp[0].length; j ++){
thetai[i][j] = temp[i][j];
}
}
} |
8da50b61-6b7e-4d51-9290-145ae99017b7 | 5 | public static void deserialise(Ecran e) {
try {
JFileChooser chooser = new JFileChooser();
int returnName = chooser.showOpenDialog(null);
String path = null;
if (returnName == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
if (f != null) { // Make sure the user didn't choose a... |
4cc9c0ba-d2e4-47c3-bec8-79d190e5cf6b | 5 | public void login() throws IOException
{
if (useGarena)
getGarenaToken();
getIPAddress();
getAuthToken();
TypedObject result, body;
// Login 1
body = new TypedObject("com.riotgames.platform.login.AuthenticationCredentials");
if (useGarena)
body.put("username", userID);
else
body.put("user... |
976f053f-c16c-4924-bbbb-dbee64107634 | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
fill(1000000);
while ((line = in.readLine()) != null && line.length() != 0) {
int n = Integer.parseInt(line.trim()... |
88e058c1-9009-409e-9728-6d8d29152063 | 6 | public void tsumo(String[] split, String command)
{
if (split.length != 5)
{
PrintMessage("Syntax:!tsumo [game] [winner] [hou] [han|y|dy]");
return;
}
TournyGame m = (TournyGame) games.get(split[1]);
if (m == null)
{
PrintMessage(split[1] + " is not a game");
return;
}
String p = split[2];
... |
cd79e973-ee74-4062-ba37-f371b484b16b | 2 | public void onStatus(Status status) {
//System.out.println("@" + status.getUser().getScreenName() );
/*
if (status.getGeoLocation() != null) {
System.out.print(String.valueOf(status.getGeoLocation().getLatitude()));
System.out.print(" ");
System.out.print(String.valueOf(status.getGeoLocation().ge... |
1e527cfd-dcae-4eaa-bae7-640925e9890c | 6 | private void setImage(int roll, JLabel die)
{
switch (roll)
{
case 1: die.setIcon(one);
break;
case 2: die.setIcon(two);
break;
case 3: die.setIcon(three);
break;
case 4: die.setIcon(four);
break;
... |
ac99faa6-7e88-46ad-9596-810b66cd0a3a | 6 | void resetEditors (boolean tab) {
TableItem oldItem = comboEditor.getItem ();
if (oldItem != null) {
int row = table.indexOf (oldItem);
try {
new String (nameText.getText ());
} catch (NumberFormatException e) {
nameText.setText (oldItem.getText (NAME_COL));
}
try {
new Integer (widthText... |
9d656570-49bb-47f1-ab9e-27f812d21a21 | 0 | @Override
public boolean closeRequested() {
return true;
} |
55e35b69-5713-4a04-8308-389b93339137 | 8 | public void initTree(Coordinate coord) {
Coordinate temp;
Coordinate coordNorth = coord.copy();
Coordinate coordEast = coord.copy();
Coordinate coordSouth = coord.copy();
Coordinate coordWest = coord.copy();
setTree(coord);
int direction;
int emission;
direction = (int) (Math.random()*density-1);
f... |
8797ce4c-1ba1-4479-96b9-e72505d2dfc9 | 0 | public final int getWord() { return word; } |
61aa84a2-0c17-4f6a-8456-3ea009b9e3a8 | 5 | public MenuButton(int index, ImageHandler images, int windowWidth, int windowHeight)
{
int yGap;
switch(index)
{
case 0:
this.action = GameEngine.ACTION.NEW_GAME;
break;
case 1:
this.action = GameEngine.ACTION.... |
d510d430-f037-4db4-902c-85038746eb9a | 1 | private boolean merkkiOsaTunnusta() {
return paikkaSisaltyySyotteeseen() && paikkaSisaltaaSallitunMerkin();
} |
1bbda9da-18af-48c2-a792-9801a8a390c8 | 0 | @Override
public void mouseEntered(MouseEvent e) {
} |
72d99d72-a6a6-4927-872c-8ff62047a235 | 2 | @EventHandler
private void onSignChange(SignChangeEvent event) {
Player player = event.getPlayer();
if(event.getLine(0).equalsIgnoreCase("[ca]")) {
if(player.hasPermission("ca.sign.create")) {
event.setLine(0, ChatColor.BLUE + "ColoredArmor");
event.setLine(1, "");
event.setLine(2, "");
event.se... |
3a82dd68-48a8-4a9f-8dbc-a5dfef8a7fbb | 4 | public boolean intersects(Box2D box) {
if (xmax < box.xpos) return false ;
if (ymax < box.ypos) return false ;
if (xpos > box.xmax) return false ;
if (ypos > box.ymax) return false ;
return true ;
} |
5c2bb35c-f578-4aa1-8121-dbb3d30fe4c1 | 2 | private void dispose() {
aBoolean831 = false;
while (drawingFlames) {
aBoolean831 = false;
try {
Thread.sleep(50L);
} catch (Exception exception) {
}
}
titleBox = null;
titleButton = null;
runes = null;
... |
e5445225-d710-448f-b0ad-98fadd57b557 | 9 | private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as
// name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBui... |
61e8ad9a-139d-455a-ac18-d7261ac18e52 | 2 | private static void readTldList(Stream buffer) {
int charCode = buffer.getInt();
Censor.aCharArrayArray624 = new char[charCode][];
Censor.anIntArray625 = new int[charCode];
for (int j = 0; j < charCode; j++) {
Censor.anIntArray625[j] = buffer.getUnsignedByte();
char ac[] = new char[buffer.getUnsignedByte(... |
e991fc48-4831-4d03-af1a-5dafce820dda | 2 | private boolean boardFull()
{
for(int i = 0; i < gameBoard.length; i++)
{
if(gameBoard[i].getState().getState() == 0)
{
return false; //if any tile is empty ie state = 0 then the board isn't full
}
}
return true;
} |
f874a81b-3a3a-479a-a9b2-e8ca9dfa004e | 8 | protected List <Segment> installedBetween(Tile start, Tile end) {
if (start == null) return null ;
if (end == null) end = start ;
final RoadSearch search = new RoadSearch(start, end, Element.VENUE_OWNS) {
protected boolean canEnter(Tile t) { return true ; }
} ;
search.doSearch() ;
final... |
d15c7a8e-200d-4129-9961-895b8b5cea14 | 1 | public Fen_Princ(OutputStream pos) {
initComponents();
this.setLocationRelativeTo(null);
this.setVisible(true);
try {
oos = new ObjectOutputStream(pos);
}
catch (IOException ex) {
System.out.println("Erreur rencontrée dans la classe : "+ Fen_Princ.... |
74faef06-eb29-4123-9e30-daaf26a903e0 | 3 | private String[] findGroups(String user) {
Connection connection = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
connection = getConnection();
statement = connection.prepareStatement(groupQuery);
statement.setString(1, user);
... |
04b21d16-7c83-4ca4-a29e-78b6faf93fde | 8 | public static List<Integer> GetPrimes(int max)
{
System.out.println("Generating primes up to max of: " + max);
boolean[] flags = new boolean[max + 1];
flags[0] = false;
flags[1] = false;
for(int i = 2; i < flags.length; ++i)
{
flags[i] = true;
}
// Find next prime, then mark off all multiples
int... |
a3fd3997-40a4-4e55-b42f-c8dc181a6ad4 | 6 | public static double dot_product(FeatureNode [] x, FeatureNode [] z) {
double sum=0;
int i,j;
for (i=0,j=0;x!=null && z!=null && i<x.length && j<z.length;) {
if (x[i].index<z[j].index) {
i++;
... |
777f5688-ad39-494f-b1d1-217f6a78e211 | 9 | public static Collection getPossibleEncodings(byte [] data) {
Collection possibleEncodings = new TreeSet();
if(data == null || data.length == 0) {
return possibleEncodings;
}
// We may have to take account of a BOM (Byte Order Mark) as this could be present at the beginning of
// the source byte array. T... |
24b2f029-bced-4bef-859d-d10a0b1ae69d | 1 | private void updateTouristList(Criteria criteria, AbstractDao dao) throws DaoException {
List<Tourist> list = (List<Tourist>) criteria.getParam(DAO_ORDER_TOURIST_LIST);
for (Tourist t : list) {
Criteria bean = new Criteria();
bean.addParam(DAO_ID_TOURIST, t.getIdTourist());
... |
1d29ffff-5b14-4e6f-abde-b2910148ef25 | 2 | public boolean equals(Object ob) {
if (super.equals(ob)) {
Toffee other = (Toffee) ob;
if (viscosity != other.viscosity)
return false;
}
return true;
} |
1b5d6c6a-bb96-4d1e-a720-278fa1b16aa7 | 2 | public static void stop(String id){
if(staticClips.containsKey(id)){
staticClips.get(id).stop();
} else if(cacheClips.containsKey(id)){
cacheClips.get(id).stop();
} else {
System.out.println("[SoundManager] Try stoping unloaded clip: " + id);
}
} |
e7ee50aa-1abe-471f-9c4f-03a291f50225 | 7 | public void toFile(File file, boolean compress) throws IOException
{
byte[] data = getData();
if(file.exists() && file.isFile())
{
if(!file.delete()) throw new IOException("Unable to delete existing file!");
}
//if(!file.getParentFile().mkdirs()) throw new IOException("Unable to make directories to file!"... |
ab7d6c99-64ea-4ab5-9d9a-7876ae19e821 | 1 | private void checkLoaded() throws IOException {
if (realImage != null) return;
realImage = loader.load();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.