method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c1a8cbae-de01-4bba-8e00-68f77ed89605 | 4 | public TreeMap<Double,DatasetObject> sortAndRetrieve(TreeMap<Double,Integer> identifiers, DatasetObject objectQuery, int k)
{
// System.out.println("Filtering result set");
java.util.Iterator<Double> s=identifiers.keySet().iterator();
// if(s.hasNext())
// s.next(); //skip first to ... |
e8d21722-7f21-4e41-9e77-765366ae718b | 4 | public boolean doTransformations() {
StructuredBlock last = flowBlock.lastModified;
return (!isEntered && CompleteSynchronized.enter(this, last))
|| (isEntered && object == null && CompleteSynchronized
.combineObject(this, last));
} |
e98c9b61-06d9-4036-9717-669ac56d6137 | 0 | public TakeIterable(Iterable<T> source, int take)
{
this._source = source;
this._take = take;
} |
e305b06f-8c05-4c8c-bc98-2f0a5d42881f | 6 | @Override
public byte[] write(DataOutputStream out, PassthroughConnection ptc, KillableThread thread, boolean serverToClient) {
if((length = lengthUnit.getValue()) < 0) {
lengthUnit.setValue(length);
}
length = lengthUnit.write(out, ptc, thread, serverToClient);
if(length == null) {
return null;
}
... |
380e0d73-b0ab-4784-844b-09e0981b4a45 | 5 | static final int method1045(int i, int i_1_, int i_2_, int i_3_, int i_4_,
int i_5_, byte i_6_) {
i_5_ &= 0x3;
anInt1716++;
if ((i_2_ & 0x1 ^ 0xffffffff) == -2) {
int i_7_ = i_3_;
i_3_ = i_1_;
i_1_ = i_7_;
}
if (i_5_ == 0)
return i_4_;
if (i_6_ != 16)
return -78;
if (i_5_ == 1)
... |
a732e178-4486-4fb0-98f1-505d4f5eca64 | 1 | private void makeGotoJsr(HashMap marks, int pos, int target, boolean isGoto, int size) {
Mark to = makeMark(marks, target);
BasicBlock[] jumps;
if (isGoto)
jumps = makeArray(to.block);
else {
Mark next = makeMark(marks, pos + size);
... |
c5a96f56-c83a-46a2-a5ad-64aec2ea22d1 | 7 | public void fireMsg(MsgHead m){
//DzҷصϢ:ҽ
if(m.getType()==IMsgConstance.command_find_resp){
MsgFindResp resp=(MsgFindResp)m;
List<UserInfo> users=resp.getUsers();//ҵû
showFindResult(users);//ҽ
}
else if(m.getType()==IMsgConstance.command_chatText
||m.getType()==IMsgConstance.command_chatFile
... |
6cfb068b-1723-4c73-911c-cda735337aad | 1 | private void removeAbilities(ArrayList<AbilityType> remove) {
for (int c = 0; c < remove.size(); c++) {
abilityTypes.remove(remove.get(c));
}
} |
5e2460de-112f-4306-bf1c-17b1bf84610c | 0 | @AfterMethod
public void tearDownMethod() throws Exception {
} |
b8f7a375-e885-4ea3-9b3f-1e026fe35cce | 2 | public void insert(E element) {
if (size == array.length) {
Object[] doubledArray = new Object[size * 2];
for (int i = 0; i < array.length; i++) {
doubledArray[i] = array[i];
}
this.array = doubledArray;
}
array[size] = element;
... |
21261299-dda0-49dc-87e1-5f07a916c006 | 0 | @Override
public void endSetup(Attributes atts) {
RESTORE_DEFAULT_EDITOR_BUTTON.addActionListener(this);
AbstractPreferencesPanel.addLastItem(RESTORE_DEFAULT_EDITOR_BUTTON, this);
// Update all the prefs.
setToCurrent();
} |
08a8c850-d1f6-4a79-ba13-16cc08e8a780 | 3 | public boolean IsOutBound(State state)
{
return (state.XCoord < 0 || state.XCoord >= this.States.length || state.YCoord < 0 || state.YCoord >= this.States[0].length);
} |
d981b5a7-a3ce-4946-95f5-9ffa729cf44d | 4 | private File[] sortFiles( File[] files ) {
TreeMap<String,File> dirMap = new TreeMap<String,File>( CaseInsensitiveComparator.sharedInstance );
TreeMap<String,File> fileMap = new TreeMap<String,File>( CaseInsensitiveComparator.sharedInstance );
for( int i = 0; i < files.length; i++ ) {
if( files[i].isDirecto... |
126b94bb-0706-43a3-a0db-8ec7718ad0e1 | 3 | public boolean save(String email, String password) {
try {
String sql = "select * from user where email=" + email;
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
if (rs.next()) {
System.out.println("Exist such email");
stmt.close();
rs.close();
closeConnec... |
b213095b-38e3-47c6-b029-e615d7269668 | 4 | public void setType( int type )
{
switch( type )
{
case TYPE_PLOTAREA:
case TYPE_TEXTDISP:
getData()[0] = 2;
getData()[1] = 0;
break;
case TYPE_LEGEND:
getData()[0] = 5;
getData()[1] = 2;
break;
case TYPE_DATATABLE:
getData()[0] = 3;
getData()[1] = 0;
}
getData()[2] ... |
49eec8d0-8579-4175-82bb-311933eb40d6 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
f8a31859-d372-4824-b40a-ed79e37dbacf | 8 | public void paintComponent(Graphics g) {
drawLetters(g);
} |
39d955e6-1ba6-4f17-89e7-b50711cc51d8 | 6 | public AutocompleteJCBClient() {
super();
setEditable(true);
Component c = getEditor().getEditorComponent();
if (c instanceof JTextComponent) {
final JTextComponent tc = (JTextComponent) c;
tc.getDocument().addDocumentListener(new DocumentListener() {
... |
15cb041e-6b10-4edd-83f2-532df05b7ea8 | 4 | public void makeDeclaration(Set done) {
super.makeDeclaration(done);
/*
* Normally we have to declare our exceptionLocal. This is automatically
* done in dumpSource.
*
* If we are unlucky the exceptionLocal is used outside of this block.
* In that case we do a transformation.
*/
if (exceptionLo... |
9029b342-cfd9-4964-833d-b067fdaa68c0 | 8 | public static void Test() {
boolean success = true;
//Run Tests for now
BZRSocket socket = new BZRSocket();
Shoot shoot = new Shoot(new Tank());
socket.parseResponse("ack 111.456 shoot 1\nok Success", shoot);
success &= shoot.wasSuccessful();
AngVel angvel = new AngVel(new Tank(),... |
1cc5708e-55c2-46cd-a3f0-d2360bc96669 | 8 | public static Status.StoredFieldStatus testStoredFields(CodecReader reader, PrintStream infoStream, boolean failFast) throws IOException {
long startNS = System.nanoTime();
final Status.StoredFieldStatus status = new Status.StoredFieldStatus();
try {
if (infoStream != null) {
infoStream.print... |
d66fb60c-7f36-44b4-a039-f3e4ba79967a | 0 | @Override
public void setGUITreeComponentID(String id) {
this.id = id;
} |
dc5b77f0-2f26-469c-86e0-44eb897b957d | 8 | @SuppressWarnings("unchecked")
public HashMap<ShieldOwner, Shield> loadShieldsFromFile() {
if (!shieldsFile.exists() || plugin.getListener() == null || plugin.getListener().getShields() == null) {
return null;
}
//if (directory.)
new File(directory).mkdir();
HashMap<ShieldOwner, Shield> map = new Hash... |
bb398df4-b316-470f-8cc0-00ef0a228620 | 3 | private void initUsermenuImageframeMenu(Color bg) {
this.usermenuImageframeMenu = new JPanel();
this.usermenuImageframeMenu.setBackground(bg);
this.usermenuImageframeMenu.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
// imagePath
Path initialValue = this.skin.getImgPath... |
634a6cf5-b139-4790-9ea7-d289b392733b | 2 | public long inserir(InstituicaoCooperadora instituicaocooperadora) throws Exception
{
String sql = "INSERT INTO instituicaocooperadora(nome) VALUES (?)";
long idGerado = 0;
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
stmt.set... |
0bcd6c74-2499-42ca-a392-6e7fc3b97bb2 | 3 | @SuppressWarnings("static-access")
private void ROUND7() {
enemises.clear();
System.out.println("Round7!!!!!!");
for (int i = 0; i < level.getWidth(); i++) {
for (int j = 0; j < level.getHeight(); j++) {
if ((level.getPixel(i, j) & 0x0000FF) == 2) {
... |
66fefd5f-fedf-465c-bb24-34b82fa00200 | 1 | public boolean type(char key, java.awt.event.KeyEvent ev) {
if(key == 27) {
wdgmsg(fbtn, "click");
return(true);
}
return(super.type(key, ev));
} |
fb3b70aa-21d8-4e43-a4ad-ed465c7a34b3 | 0 | public void setBbox(double[] bbox)
{
this.bbox = bbox;
} |
b52f47b3-ce83-4d3b-a03c-f539ed25f6fc | 4 | public void writeInformation(Description d, int categoryID, HUD UI) {
super.writeInformation(d, categoryID, UI) ;
if (categoryID == 0) {
d.append("\n\nDrill Orders:") ;
for (final int s : DRILL_STATES) {
d.append("\n ") ;
d.append(new Description.Link(DRILL_STATE_NAMES[s]) {
... |
9ea0db6c-38aa-4cdf-87c4-32a5369bbf3a | 5 | public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
int ticks = 0;
int frames = 0;
long lastTimer = System.currentTimeMillis();
double delta = 0;
init();
while (running) {
long now = System.nanoTime(... |
ee5f5338-1ab4-45f8-943d-69f0def3b812 | 4 | private int generateHSLBitset(int h, int s, int l) {
if (l > 179)
s /= 2;
if (l > 192)
s /= 2;
if (l > 217)
s /= 2;
if (l > 243)
s /= 2;
return (h / 4 << 10) + (s / 32 << 7) + l / 2;
} |
80a6d724-f8ba-4b6c-8787-1d08364837b2 | 4 | public static double ioa(double[] obs, double[] sim, double pow, double missingValue) {
sameArrayLen(obs, sim);
int steps = sim.length;
double sum_obs = 0;
double len = 0.0;
for (int i = 0; i < steps; i++) {
if (obs[i] > missingValue) {
sum_obs += ob... |
7c288906-50ad-4d4a-a94c-f87d2be61908 | 3 | public void setExp(PExp node)
{
if(this._exp_ != null)
{
this._exp_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
f15e1a10-a1c1-4828-82ac-cd14df047764 | 8 | public static boolean isHit(int i, int j, int[][] imageGraph,
int[][] structuringElement, int foregroundClass) {
int rowCounter = i - structuringElement.length / 2;
int columnCounter = j - structuringElement[0].length / 2;
int initialColumnValue = columnCounter;
for (int k = 0; k < structuringElement.length;... |
2213d509-c016-4b59-af8f-47babc27eea9 | 2 | public void fire(){
final int dX = 3,dY = 3;
if( lastDir==DirKey.Up || lastDir==DirKey.Down ){
bullets.add(new Bullet(id,this.getCenter().x - dX, this.getCenter().y, lastDir));
}
else{
bullets.add(new Bullet(id,this.getCenter().x, this.getCenter().y - dY, lastDir));
}
} |
88242a69-4092-4959-9a7f-2b09855d96e7 | 6 | @Override
public TicketPoolTicket[] book(final TicketPoolQueryArgs args) throws Exception {
PlanTicket[] planTickets = Queries.query(this.query(args)).toArray(new PlanTicket[0]);
for(PlanTicket pt : planTickets)
{
pt.getGroup().getTickets().remove(pt);
if(pt.getGroup().getTickets().size() ==... |
3d3a93d5-000c-4c72-a1f1-3c18e61ac43e | 4 | @Override
public Team findTeamByID(Long id) {
checkDataSource();
if (id == null) {
throw new IllegalArgumentException("id is null");
}
try (Connection conn = dataSource.getConnection();
PreparedStatement st = conn.prepareStatement("SELECT id,name,coach,sta... |
2967750f-3276-438b-9211-478ffd770bd4 | 4 | public static void getMaxRectangleSum() {
int ROWS = rows, COLS = cols;
for (int i = 0; i < COLS; i++)
for (int j = 0; j < ROWS; j++)
comp[j][i + 1] = m[j][i] + comp[j][i];
for (left = 1; left <= COLS; left++)
for (right = left; right <= COLS; right++)
kadane();
} |
43426349-7764-4d05-9259-a205632f2dd2 | 9 | private MSODrawing getAssociatedMso()
{
Boundsheet bs = getSheet();
int idx = -1;
if( bs != null )
{// shouldn't!
idx = bs.getIndexOf( OBJ );
if( idx == -1 )
{
return null; // should't!
}
while( idx < bs.getSheetRecs().size() )
{
if( ((BiffRec) bs.getSheetRecs().get( idx )).getOpco... |
b510c553-11d3-48fc-ad66-68b3c584fa94 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Letter other = (Letter) obj;
if (Float.floatToIntBits(id) != Float.floatToIntBits(other.id))
return false;
if (letter != other.letter)
re... |
3f28294f-e852-49e6-92a2-5351421900a5 | 1 | private void updateCheck() {
if(getConfig().getBoolean("Update-Notifications", true)) {
Updater updater = new Updater(this, 68348, this.getFile(), Updater.UpdateType.NO_DOWNLOAD, true);
update = updater.getResult() == Updater.UpdateResult.UPDATE_AVAILABLE;
name = updater.getLatestName();
} else {
Mess... |
7d507365-d616-4d83-9bbe-b756e124958e | 1 | private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
stream.writeInt(exceptions.size());
for (int i = 0; i < exceptions.size(); i++) {
stream.writeObject(exceptions.get(i));
}
} |
ac618b58-3f7b-4504-a625-f257d5347d57 | 6 | public ArrayList<Tilaus> haePaistettavatTilaukset() throws DAOPoikkeus, SQLException {
ArrayList<Tilaus> tilaukset = new ArrayList<Tilaus>();
Tilaus tilaus = new Tilaus();
ResultSet tulokset, fantasiaTulokset;
// Avataan ensin yhteys
Connection yhteys = avaaYhteys();
// Alustetaan kyselyt.
// Til... |
e5eefb4e-d0ab-4a28-b754-679e3a310b14 | 1 | public void calcTargets(int row, int col, int steps) {
visited = new boolean[numRows*numColumns];
for(int i = 0; i < numRows*numColumns; i++) {
visited[i] = false;
}
visited[calcIndex(row, col)] = true;
targets = new HashSet<BoardCell>();
actualCalcTargets(calcIndex(row, col), steps);
} |
12eaa2c8-e007-4e58-bd2a-e63a6255dbcc | 2 | public static DoChores getSingleton(){
// needed because once there is singleton available no need to acquire
// monitor again & again as it is costly
if(singleton==null) {
synchronized(DoChores.class){
// this is needed if two threads are waiting at the monitor at the
//... |
68fc0dce-b34d-471f-b5b1-46753bd962ac | 3 | private HelperQuery obtenerQueryCliente(ClienteRequest cliente) {
HelperQuery helperQuery = new HelperQuery();
int numeroAbonado = cliente.getNumeroAbonado();
int numeroCelular = cliente.getNumeroCelular();
Boolean numeroAbonadoExiste = false;
String queryParteWhere = "WHERE ... |
b9c8ded6-44bd-4801-94cb-0fdcf2c9a3de | 5 | @Override
public void tick() {
if (cylinderMassSlider.isActive()) {
cylinderMassSlider.tick();
cylinderMass = cylinderMassSlider.getValue();
box = new Rectangle((int) (300 - (boxMass * 2)), 400, (int) (boxMass * 4), 40);
vy = 0;
ay = 0;
ti... |
46ebc5e0-3411-467c-b9a4-958be7b0b856 | 3 | public static void main(String[] args) {
try {
for(LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
... |
d7156035-c229-465f-a0b2-7945a6a93a0d | 7 | public Device getDevice (Host host)
throws IOException
{
Bus busses [], bus = null;
// Is there a likely Universal Serial Bus?
if (host == null)
return null;
try {
busses = host.getBusses ();
for (int i = 0; i < busses.length; i++) {
if (!busses [i].getRootHub ()
.getDeviceDescriptor ()... |
81f05937-28b0-4617-840c-2384ccd716a8 | 9 | protected boolean repositionValid(mxGraphHierarchyModel model,
mxGraphAbstractHierarchyCell cell, int rank, double position)
{
mxGraphHierarchyRank rankSet = model.ranks.get(new Integer(rank));
mxGraphAbstractHierarchyCell[] rankArray = rankSet
.toArray(new mxGraphAbstractHierarchyCell[rankSet.size()]);
i... |
9302204e-8dbc-41d7-b424-558a6ced86bc | 5 | private ComponentDef(Class<? extends Component> clazz) {
for (Method method : clazz.getDeclaredMethods()) {
String methodName = method.getName();
if (methodName.startsWith("get")) {
addGetMethod(method, getFieldName(methodName, 3));
} else ... |
3013daff-627a-408b-a864-1f69763b1983 | 7 | private List<Shape> getShapesOrderedTop(Collection<Line> lines) {
final List<Shape> firsts = new ArrayList<Shape>();
final Set<String> tops = new HashSet<String>();
final Map<String, Shape> shs = new HashMap<String, Shape>();
for (final Iterator<Shape> it = shapes.iterator(); it.hasNext();) {
final Shape sh... |
dcf64341-ca87-44bc-84be-e42e6070b489 | 2 | private boolean containsElement(List<ElementInfo> elements, ElementInfo element) {
for (ElementInfo e : elements)
if (e.equals(element))
return true;
return false;
} |
0f860fc9-3252-42c9-a1e9-03cb632547c6 | 5 | private List<TestInstanceInfo> populateTestInstances(List<Long> testsetIds)
{
try {
if (testsetIds != null && !testsetIds.isEmpty()) {
testInstances = qcConnector.getTestInstances(testsetIds);
if (testInstances != null && !testInstances.isEmpty()) {
log.info("Got... |
60a292e6-7196-4127-85ba-203d07374b97 | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
ebc3e341-dce5-4daf-8141-28e0e5192efe | 6 | public List<Tuple<Integer,Integer>> pathAroundCorner( List<Tuple<Integer,Integer>> o ) {
if ( o.size()>=5 && getDistance(o.get(0),o.get(4)) == 3) {
// Move away from 4th move?
Tuple<Integer,Integer> startMove = o.get(0);
Tuple<Integer,Integer> lastMove = o.get(4);
Tuple<Integer,Integer> addedMove1 = o.... |
b53a384b-43d1-4feb-af67-7a47d5061707 | 0 | public String getAlgorithm() {
return algorithm;
} |
79fb461a-2641-431f-8067-2765a8c5130d | 7 | public Vector getIntersection(Edge other, boolean ray) {
double dx1 = end.x - start.x;
double dy1 = end.y - start.y;
double dx2 = start.x - other.start.x;
double dy2 = start.y - other.start.y;
double dx3 = other.end.x - other.start.x;
double dy3 = other.end.y - other.start.y;
if(dy1 / dx1 != dy3 / dx3) {
... |
d4a3a503-1a7b-4dae-9580-74b6abee5e9b | 1 | private void setFactory( AbstractUmlConnectionFactory factory ) {
this.factory = factory;
if( factory != null ) {
factory.setDiagram( view.getDiagram() );
}
connecting.setFactory( factory );
} |
b47c8b63-7cdd-45ad-8f43-e40b5e75dacc | 8 | public void writeRecs( BiffRec b, BufferedWriter writer, int level ) throws IOException
{
String tabs = "\t\t\t\t\t\t\t\t\t\t";
if( b == null )
{
return;
}
writer.write( tabs.substring( 0, level ) + b.getClass().toString().substring( b.getClass()
... |
1f9e45cb-779c-443d-880d-e04755b951a3 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
8e80b9a2-e101-4896-8db9-b25fc54a90d0 | 9 | public int[] merge(int[] a, int[] b) {
int[] c = new int[a.length + b.length];
int i =0;
int j = 0;
int index = 0;
while(i < a.length && j < b.length) {
if (a[i] > b[j]) {
c[index] = b[j];
j++;
} else {
c[index] = a[i];
i++;
}
index++;
}
if (i > a.length -1 && j <... |
c6052a70-4692-4a05-a86b-df0d0357a55c | 4 | private boolean infectRabbit(Location location,List<Actor> newZombieRabbits)
{
Field field = getField();
List<Location> adjacent = field.adjacentLocations(getLocation(), 1);
Iterator<Location> it = adjacent.iterator();
while(it.hasNext()) {
Location where = it.next();
... |
29ec1206-04be-4135-b4ae-f5c2614108b6 | 0 | public void setGroup(StopRangeGroup value) {
this._group = value;
} |
7b6044a7-c23f-4e59-b9d0-018f069c4081 | 8 | private static boolean a3 (int i, int j, BufferedImage image) {
boolean ll = ((image.getRGB(i-1, j ) == BLACK) ||
(image.getRGB(i-1, j-1) == BLACK) ||
(image.getRGB(i , j-1) == BLACK));
boolean with = ((image.getRGB(i-1, j+1) == WHITE) &&
... |
6e441a2d-da56-4ce5-a392-ae514bb79d58 | 5 | @Override
public Void call() {
final String timestamp = this.writer.timestamp.format(new Date());
boolean sneakers = false;
this.markers.clear();
for (final Player player : this.writer.plugin.getServer().getOnlinePlayers()) {
if (!player.hasPermission("livemarkers.online... |
196b5bae-b6d3-431f-9814-faac3454ef44 | 2 | public static double ahav(double a){
if(a<0.0D && a>1.0D) throw new IllegalArgumentException("ahav argument (" + a + ") must be >= 0 and <= 1");
return Fmath.acos(1.0D - 2.0D*a);
} |
ba75159c-1e1f-4881-bf18-eca7b5294c78 | 1 | public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
} |
14e2e196-030d-44c4-a12e-99dd9c049225 | 5 | static final void method947(byte i) {
anInt5783++;
if (i != 41)
amountUpdatePlayers = 38;
for (Class348_Sub9 class348_sub9
= (Class348_Sub9) Class218.aClass262_2859.getFirst(4);
class348_sub9 != null;
class348_sub9 = (Class348_Sub9) Class218.aClass262_2859
.nextForward((byte) 117)) {
... |
7ecb61f9-0db4-4cbf-85b3-01cef97a7e02 | 3 | public void visitMultiANewArrayInsn(final String desc, final int dims) {
checkStartCode();
checkEndCode();
checkDesc(desc, false);
if (desc.charAt(0) != '[') {
throw new IllegalArgumentException(
"Invalid descriptor (must be an array type descriptor): "
+ desc);
}
if (dims < 1) {
throw new... |
03b7afe7-b667-42d9-80e5-5302c3d3b7a1 | 3 | public int[] Sort(int data[], int n){
// pre: 0 <= n <= data.length
// post: values in data[0..n-1] are in ascending order
int numSorted = 1; // number of values in place
int index; // general index
while (numSorted < n) {
// take the first unsorted value
... |
9c314e7d-eeb7-4bcc-a6cf-21410ad8cf93 | 6 | private void generateTrackerURL() throws IOException {
//String buffer we'll store the url extension in. Initialized to base URL.
StringBuffer urlExtension = new StringBuffer( (torrentInfo.announce_url).toString() );
//Generate the info_hash parameter and add to URL.
urlExtension.append("?info_hash=");
... |
c236c245-5968-4c5f-a503-bcf000d01909 | 7 | public void checkserver(int num){
if (num==1){TC=GosLink.TC1;ol=offline1;ct=count1;}
else{TC=GosLink.TC2;ol=offline2;ct=count2;}
if (TC.loggedin == 1){
if (ct==3){
TC.write("");
GosLink.dw.append("PING");
ct=0;
}else{ct++;}
if (ct >5){ct=0;}
}else{
if (ol==0){GosLink.dw.append("Server "+... |
e86fc876-c4a1-467f-becf-9ac437907d5a | 6 | void scan(String file) throws Exception
{
boolean care = false;
String[] files = file.split("\n");
for(int i = 1; i < files.length; i++)
{
if(files[i].length() > 2)
{
Token t = null;
int firstSpace = files[i].indexOf(' ');
t = new Token(files[i].substring(0, firstSpace),files[i].sub... |
7fc37484-a4b2-437e-a48d-dbc7a326aa71 | 8 | Set<Position> getDiagNeighbors(Position p) {
Set<Position> neighbors = new HashSet<Position>();
if (p.i+1 < n && p.j+1 < m) neighbors.add(board[p.i+1][p.j+1]);
if (p.i-1 >= 0 && p.j+1 < m) neighbors.add(board[p.i-1][p.j+1]);
if (p.i+1 < n && p.j-1 >= 0) neighbors.add(board[p.i+1][p.j-1]);
if (p.i-1 >=0 && p... |
5080d3e5-3e4b-4d02-826b-d96e1728cc94 | 1 | @Override
public boolean removeValues(int i) {
boolean returnValue = false, found;
do {
returnValue |= (found = list.removeLastOccurrence(i));
} while(found);
return returnValue;
} |
167330d0-f6ed-4255-8247-a4cc846b04d2 | 2 | public void addNodeBalanced(int newLeafValue) {
treeNode newNode = new treeNode(newLeafValue);
// root node is last insert, add to left child
if (this.lastInsertNode == this.root) {
this.lastInsertNode.leftLeaf = newNode;
newNode.parent = this.lastInsertNode;
this.lastInsertNode = newNode;
return;
... |
b6a5d4c4-2bd7-4860-bfaa-e8603d437ac5 | 3 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
9381e137-64c6-4049-b8c4-c2099f36fc17 | 8 | public int numDecodings1(String s) {
if (s.length() == 0) {
return 1;
}
if (s.length() == 1) {
return 1;
}
if (s.charAt(0) == '1') {
if (s.charAt(1) == '0') {
return numDecodings(s.substring(2));
} else {
... |
f347e02e-1457-43a5-a45d-6ec2c97658d1 | 4 | public static boolean overwriteFile(){
if (f != null){
try {
f.createNewFile();
FileWriter fw = new FileWriter(f.getAbsoluteFile());
StringBuilder content = new StringBuilder();
BufferedWriter bw = new BufferedWriter(fw);
content.append("p " + character.x + " " + character.y + "\n");
for ... |
2554f54a-84d2-4d25-ab7b-bb007878a78d | 2 | private int checkRowWidth(int y) {
int rtnWidth = 0;
for (int i = 0; i < width; i++) {
boolean tmpBool = grid[i][y];
if (tmpBool) rtnWidth += 1;
}
return rtnWidth;
} |
98f1ec73-1c07-4e32-83d9-b8312d213cec | 3 | public void ShutDown() {
for (Future<BasicProvider<T>> future : futureList) {
try {
BasicProvider<T> basicProvider = future.get();
basicProvider.unExportService();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
executor... |
2c0d357c-77df-4c1c-9cd6-556533b65167 | 7 | protected void scanString() {
np = bp;
boolean hasSpecial = false;
for (;;) {
if (bp >= buflen) {
lexError(pos, "unclosed.str.lit");
return;
}
ch = buf[++bp];
if (ch == '\'') {
scanChar();
if (ch != '\'') {
token = LITERAL_CHARS;
break;
} else {
System.arraycopy(b... |
4a67574d-3c08-4c23-889a-ec87e0626046 | 8 | public static void heapSort(int[] array) {
// build heap (percolate up)
for(int i=1; i<array.length; i++) {
int insert = array[i];
int hole = i+1;
for(;hole>1&&insert>array[hole/2-1]; hole/=2) {
array[hole-1] = array[hole/2-1];
}
array[hole-1] = insert;
}
// sort heap (percolate down)
fo... |
4d6affea-f6bb-48fc-85ca-6d64446bf93a | 8 | public boolean executeLine(String line) {
if (first && (line.equals("ditaa") || line.startsWith("ditaa("))) {
data = new StringBuilder();
if (line.contains("-E") || line.contains("--no-separation")) {
performSeparationOfCommonEdges = false;
}
if (line.contains("-S") || line.contains("--no-shadows")) {... |
c311da79-1d75-4e43-8a0e-da4048b9dfe5 | 0 | public JLabel getjLabelTitre() {
return jLabelTitre;
} |
0741b574-15fc-4b79-b402-b34a2ad228bd | 2 | public NickButton() {
super("Chatař");
setToolTipText("Kliknutím nastavíte přezdívku (vyžaduje aktivní připojení na server)");
addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
AbstractTab tab = MainWindow.get... |
3329b53b-1a57-458e-a2ac-8690fae2b690 | 4 | public SimpleRunCPE(String args[]) throws Exception {
mStartTime = System.currentTimeMillis();
// check command line args
if (args.length < 1) {
printUsageMessage();
System.exit(1);
}
// parse CPE descriptor
System.out.println("Parsing CPE Descriptor");
CpeDescription cpeDesc =... |
79d0533d-26d4-48eb-bd15-8fa81e42c823 | 0 | public ScorePanel(TimerButtonPanel timerButtonPanel)
{
super();
AnswerSideManager.getInstance().addListener(this);
scoreManager.addListener(this);
NamesManager namesManager = NamesManager.getInstance();
namesManager.addListener(this);
BoxLayout boxLayout = new BoxLa... |
49460bd4-0690-490a-ab11-5d3a55043d52 | 7 | private void sendToBack(int slaveIdx, BufferedReader br) {
try {
mSocket = new Socket(backIPs[slaveIdx], backPorts[slaveIdx]);
mapperIPs[slaveIdx] = backIPs[slaveIdx];
mapperPort[slaveIdx] = backPorts[slaveIdx];
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(mSocket.getOutputStream()));
bw... |
ef6bf628-4aa1-4b79-a338-f71d3af2d3af | 5 | public static RetCode getRetCode(int code) {
switch (code) {
case 0:
return SUCCESS;
case 65534:
return ILLEGAL_ARG;
case 65535:
return INTERNAL_ERROR;
case 1001:
return NOT_FOUND_NODE;
case 1003:
return UNSUPPORT_SCHEMA;
default:
throw new IllegalArgumentException("错误的code: " + code);
... |
4fe87019-3d14-4e09-866e-a4f33f3aa414 | 9 | public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
if (!par1World.isRemote)
{
int var6 = par1World.getBlockMetadata(par2, par3, par4);
boolean var7 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4);
if (var7 |... |
322b6693-564f-4d79-8fea-b1bb754ea2d3 | 8 | public MeetingRoomListGUI() {
//Get size of screen without taskbar
screenSize = Toolkit.getDefaultToolkit().getScreenSize();
screenMax = Toolkit.getDefaultToolkit().getScreenInsets(bookDialog.getGraphicsConfiguration());
taskbarSize = screenMax.bottom;
screenWidth = (int)screenSize.getWidth();
scr... |
2ad8d9e3-13f0-4c06-a66d-eb14ce0bf904 | 6 | public ArrayList<Point> findTrajectory()
{
if (_sling == null) return null;
ArrayList<ConnectedComponent> traj = _seg.findTrajectory();
ArrayList<Point> pts = new ArrayList<Point>();
// use distance from previous point to remove noise
final int THRESHOLD = 3... |
e02525b5-424a-4699-8ca2-e75f182c0aaf | 0 | public int getDistance() {
return distance;
} |
186843a0-0627-42d0-a136-8283f888e247 | 7 | protected boolean canSpawnStructureAtCoords(int par1, int par2)
{
if (!this.ranBiomeCheck)
{
Random var3 = new Random();
var3.setSeed(this.worldObj.getSeed());
double var4 = var3.nextDouble() * Math.PI * 2.0D;
for (int var6 = 0; var6 < this.structureC... |
2485b94c-87ec-406d-8941-33b236d6f2ea | 0 | public void nextStep(Context ctx) {
ctx.setState(null);
} |
df7945fa-d180-46bd-a1b3-5d44b15efec8 | 4 | @Override
public int hashCode() {
int result = novCedula != null ? novCedula.hashCode() : 0;
result = 31 * result + (novCodigoConcepto != null ? novCodigoConcepto.hashCode() : 0);
result = 31 * result + (novUnidad != null ? novUnidad.hashCode() : 0);
result = 31 * result + (novAaaamm... |
dd7a813a-3d10-41ba-a846-10892f4e3266 | 4 | public String tojstring() {
/*
if ( v == 0.0 ) { // never occurs in J2me
long bits = Double.doubleToLongBits( v );
return ( bits >> 63 == 0 ) ? "0" : "-0";
}
*/
if (Double.isNaN(v))
return (isNegative() ? "-" : "") + JSTR_NAN;
if (Double.isInfinite(v))
return (v < 0 ? JSTR_NEGINF : JSTR_POSINF)... |
82a40a64-d4a5-4896-ab4c-c70a95740d38 | 2 | public float[][] getM() {
float[][] res = new float[4][4];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
res[i][j] = m[i][j];
}
}
return res;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.