method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7475bed9-ea92-4a9c-a5ee-e5577f1987a8 | 2 | public void limpiarTabla(){
try {
DefaultTableModel modelo=(DefaultTableModel) tabla.getModel();
int filas=tabla.getRowCount();
for (int i = 0;filas>i; i++) {
modelo.removeRow(0);
}
} catch (Exception e) {
JOptionPane.showMessag... |
2fc83940-0151-4421-a45e-70ecaa5541e8 | 9 | public VCFReader(String _dataFile, String _sampleName) throws IOException {
dataFile = _dataFile;
sampleName = _sampleName;
br = new BufferedReader(new FileReader(dataFile));
String line = null;
while ((line=br.readLine())!=null) {
if (line.length()<=0) continue;
// If it is not a meta-infor... |
90cd9788-198f-428e-800e-7bd4a1244b77 | 2 | private static void writeBit(boolean bit) {
// add bit to buffer
buffer <<= 1;
if (bit) buffer |= 1;
// if buffer is full (8 bits), write out as a single byte
N++;
if (N == 8) clearBuffer();
} |
31d7ef30-0d50-4324-953c-14330f995f1d | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
5588d907-adf2-4666-a661-aee9872881fc | 1 | @Test
public void filtersByAddressWorks2() {
citations.add(c1);
citations.add(c2);
citations.add(cnull);
filter.addFieldFilter("address", "Espoo");
List<Citation> filtered = filter.getFilteredList();
assertTrue(filtered.contains(c2) && filtered.size() == 1);
} |
b10b4480-f564-426b-9a19-1906ce0e2fdc | 9 | public IQ parseIQ(XmlPullParser parser) throws Exception {
boolean done = false;
Bytestream toReturn = new Bytestream();
String id = parser.getAttributeValue("", "sid");
String mode = parser.getAttributeValue("", "mode");
// streamhost
String JID = null;
String host = null;
String port = null;
int... |
4550a9f7-ae84-4f2f-9509-b43562ae9087 | 8 | public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException {
super.initialize(flowChartinstance, chartItemSpecification);
for (String key : chartItemSpecification.getChartItemAttributes().keySet()) {
if (key.equals("id")) {
idName... |
b0d9953d-ea1d-430b-bbae-990e643c508a | 2 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
try {
ClienteDao_Mysql oClienteDAO = new ClienteDao_Mysql(Conexion.getConection());
ClienteBean oCliente = new ClienteBean();
... |
220cb174-4522-4011-a09c-f2ff3d534154 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
2f7a3f1d-4ce1-4368-bbb4-1daed17fa54a | 7 | public boolean resetStream( AudioFormat format )
{
// make sure the Mixer exists:
if( errorCheck( myMixer == null,
"Mixer null in method 'resetStream'" ) )
return false;
// make sure a format was specified:
if( errorCheck( format == null,
... |
5938aaa6-13b7-4ba8-b824-000cc2cbf2b8 | 8 | @Override
public String serializeToString(Element root) {
if (root == null) {
return null;
}
if (root.getGUID() == null) {
root.setGUID(guidCreator.getNewGUID());
}
StringBuilder sb = new StringBuilder("{");
if (!root... |
d1576c2d-6650-4ee4-a107-e8436b9c11ce | 1 | public String testUpdateUrl(String appKey, String userKey, String testId) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
testId = URLEncoder.encode(testId, "UTF-8");
} catch (UnsupportedEncodingException e) {
... |
fc786eae-7dce-477b-a871-2abf3be9b656 | 1 | static public CycObject convertResponseToCycObject(Object response) {
if (response.equals(CycObjectFactory.nil)) {
return new CycList();
} else {
return (CycObject) response;
}
} |
7e50e59a-a1d1-4137-9e2b-e7f2efbba36d | 6 | private static boolean parseURL(StringBuilder sourceCode) {
if (sourceCode.toString() == "-1") return false;
Pattern p = Pattern.compile("id=\"((Selected_filmography)|(Film)|(Filmography))\">");
Matcher m = p.matcher(sourceCode);
if (m.find()) {
start = m.start();
p = Pattern.compile("Main art... |
4656e7bc-b22c-4deb-a909-4e5acb6063aa | 0 | public byte[] getAuthenticatorServer() {
return this.AuthenticatorServer;
} |
63648cb2-4571-460b-a35b-b7ec15236581 | 8 | public EnergyVisualizer(MDModel m) {
model = m;
String s = MDView.getInternationalText("Energy");
String s1 = MDView.getInternationalText("TimeInFemtoseconds");
cg = new CurveGroup(s != null ? s : "Energies", new AxisLabel(s1 != null ? s1 : "Time (fs)"), new AxisLabel(
(s != null ? s : "Energies") + " (eV... |
b77ce6e9-ffc8-41d3-b80a-b60ff3cca0d2 | 3 | @SuppressWarnings("unchecked")
private String generateColorTeamTable(String color) {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT id, team_id, auton_... |
6b9666f4-88d4-456b-99b9-87de41a341aa | 1 | public void check() {
if (this.isInputValid()) {
this.setBackground(validColor);
} else {
this.setBackground(errorColor);
}
this.repaint();
} |
df34176d-576e-4f70-af85-ea58564872c9 | 5 | public void keyReleased(KeyEvent e)
{
int key=e.getKeyCode();
if(key==KeyEvent.VK_UP || key== KeyEvent.VK_DOWN)
dy=0;
if(key==KeyEvent.VK_LEFT || key== KeyEvent.VK_RIGHT)
dx=0;
if(key == KeyEvent.VK_SPACE) {
isCharging = false;
fire();
}
... |
657ee045-3e7a-4efc-9a6b-0cafd6cae539 | 0 | static public void setMapType(String type)
{
mapType=type;
} |
07755a70-022b-438e-b2f0-635ca9c1e7f1 | 1 | final void put(final ClassWriter cw, final byte[] code, final int len,
final int maxStack, final int maxLocals, final ByteVector out) {
Attribute attr = this;
while (attr != null) {
ByteVector b = attr.write(cw, code, len, maxStack, maxLocals);
out.putShort(cw.newUTF8(attr.type)).putInt(b.length);
out.p... |
0f45c459-ccd3-47c5-bdd8-8d4c2426ff02 | 1 | public static Statement createStmt(Connection conn) {
Statement stmt = null;
try {
stmt = conn.createStatement();
} catch (SQLException e) {
e.printStackTrace();
}
return stmt;
} |
f0c6a516-9d1f-46a2-b750-f9e1cd02b088 | 0 | public int getQuantityOfVictims() {
return victims.size();
} |
3d9674f3-e6c5-4a9a-b20c-60e5b9c70167 | 9 | private void testJceAvailability(int keyBitLength)
throws
EncryptionUnsupportedByPlatformException, PDFParseException {
// we need to supply a little buffer for AES, which will look
// for an initialisation vector of 16 bytes
final byte[] junkBuffer = new byte[16];
... |
52ca1a40-bf82-4fd1-8b44-6d97a5b83c3f | 5 | public static boolean wasKeyPressed(char c) {
try {
if (!keypCheckInitiated) {
keypCheckInitiated = true;
keypLastUpdate = System.currentTimeMillis();
}
if (keypLastUpdate + TIMEOUT < System.currentTimeMillis()) {
app.keysPressed.clear();
}
Character n = new Cha... |
088a583c-0eca-4c8a-8416-f1714cddeb5b | 4 | @Override
public boolean equals(Object other) {
if (other == this)
return true;
if (other == null || other.getClass() != this.getClass())
return false;
Position pos = (Position) other;
return this.getxCoordinate() == pos.getxCoordinate()
&& this.getyCoordinate() ==... |
4a42fe57-ae10-4c2c-a58e-859e6d0decd8 | 8 | public static String encodeForHtml(String s) {
StringBuilder sb = new StringBuilder();
int len = (s == null ? -1 : s.length());
for(int i=0; i<len; i++) {
char c = s.charAt(i);
if(c == '&') {
sb.append("&");
} else if(c == '<') {
sb.append("<");
} else if(c == '>') {
sb.appen... |
221910da-9e52-4a7c-a8a8-e859a1cf943f | 4 | public OlympicDataVisualiserFrame() {
TitledBorder title;
// TODO Add more views
// TODO filter data (sliders, checkboxes)
// This instantiates the classes based of the name in the
// visualisationOptions array
// Each of these classes must have a constructor which takes one
// string(data) to open the ... |
1ba60f30-53d4-40f2-8457-01f5b8df1e83 | 4 | public void onKeyReleased(char key, int code, boolean coded)
{
if (coded)
{
// Marks the key as released
if (!this.codesReleased.contains(code))
this.codesReleased.add(code);
// Sets the key up (= not down)
if(this.codesDown.contains(code))
this.codesDown.remove(this.codesDown.indexOf(code)... |
20cdb196-7d04-4c97-910b-3a97a636c7ca | 7 | private List<TableRow> Code(List<TableRow> l){
if(l.size()>1){
int psum=0;
for(TableRow t:l)
psum+=t.getP();
int sum=0,mind=psum,mini=-1;
for(int i=0;i<l.size()-1;i++){
sum+=l.get(i).getP();
int d=Math.abs(psum-2*sum);
if(d<mind){
mini=i;
mind=d;
}
}
List<TableRow> l... |
86c1a8b9-228e-4b3a-820c-b11114e61245 | 3 | private boolean getFreeCell(ERow row){
int i =0;
for (i = 0; i < size; i++) {
if(U[row.getXs()[i]][row.getYs()[i]] == 0)
break;
}
if(i<size){
x = row.getXs()[i];
y = row.getYs()[i];
System.out.println("free " + x + ":" + y);... |
b3d6d34f-d8c6-4e2c-9267-ce43ef7a8fe8 | 6 | public Object readConst(final int item, final char[] buf){
int index = items[item];
switch(b[index - 1])
{
case ClassWriter.INT:
return new Integer(readInt(index));
case ClassWriter.FLOAT:
return new Float(Float.intBitsToFloat(readInt(index)));
case ClassWriter.LONG:
return new Long(readLong(index));... |
282af709-06a4-49db-83c7-bfb2e1a07ed3 | 9 | private static ArrayList<String> getRowColAndGapsTrimmed(String s)
{
if (s.indexOf('|') != -1)
s = s.replaceAll("\\|", "][");
ArrayList<String> retList = new ArrayList<String>(Math.max(s.length() >> 2 + 1, 3)); // Approx return length.
int s0 = 0, s1 = 0; // '[' and ']' count.
int st = 0; // Start of "next... |
6ae944b8-660c-48b0-b141-3aa82ec7674f | 5 | private long removeRefTradeDataNym(long lIndex) {
//
// loop through the elements in the actual container, in order to find the one
// at lIndex. Once it is found, then loop through the reference list and remove
// the corresponding reference for that element.
//
TradeDataNym refActualElement = GetTradeDataNym(l... |
27dec684-62fb-4d30-b7b8-0bbd09c5c5f4 | 2 | public void serverStart(int max, int port) throws java.net.BindException {
try {
clients = new ArrayList<ClientThread>();
RoomList = new ArrayList<RoomList>();
serverSocket = new ServerSocket(port);
serverThread = new ServerThread(serverSocket, max);
... |
109ea07d-177d-4d85-9f96-16b47b062451 | 4 | public Rule(int code, int[] in, int[] out) throws Exception{
super();
this.code = code;
/*Throws an exception if in or out is not well formatted
* (which means not int triplets)*/
if(in.length%3!=0 || out.length%3!=0){
throw new TripleFormatException("Triples must be like \"(s p o)*\"");
}
/*Gen... |
546ecff3-2c9b-4c1d-b046-3f57156b3bee | 8 | private Mesh loadMesh(String fileName){
String[] splitArray = fileName.split("\\.");
String ext = splitArray[splitArray.length - 1];
if(!ext.equalsIgnoreCase("obj")){
System.err.println("ERROR: File format not supported - " + ext);
new Exception().printStackTrace();
... |
9ec893c9-8ebb-4259-815f-478bf7916484 | 8 | @Override
public void set_irq_line(int irqline, int state) {
int eddge;
if (m6800.irq_state[irqline] == state) return;
//LOG((errorlog, "M6800#%d set_irq_line %d,%d\n", cpu_getactivecpu(), irqline, state));
m6800.irq_state[irqline] = state;
switch(irqline)
{
case M6800_IRQ_LINE:
if (state == CLEAR_LINE) ... |
4a2d6ceb-c747-4763-bb80-dfcb68c45916 | 1 | public static String reformatTitle(String fullTitle) {
if (!fullTitle.contains("_URL_"))
return "incompatible text";
String dateTitle = fullTitle.replaceAll(".html", "").replaceAll(
"_URL_", " ");
return dateTitle;
} |
fd784806-a5ad-4bde-a278-604f7e58d188 | 6 | private void run() {
isRunning = true;
int frames = 0;
long frameCounter = 0;
final double frameTime = 1.0 / FRAME_CAP;
long lastTime = Time.getTime();
double unprocessedTime = 0;
while (isRunning) {
boolean render = false;
long startT... |
d4af0747-3c68-4116-a8ee-8d0ecebb208e | 7 | public void previewRoom(Player player, int[] boundChuncks, RoomReference reference, boolean remove) {
int boundX = reference.x * 8;
int boundY = reference.y * 8;
Region region = World.getRegion(RegionBuilder.getRegionHash(reference.room.chunkX/8, reference.room.chunkY/8));
int boundX2 = (reference.room.chunkX -... |
eeec2c00-9bcd-48e7-9c20-6f3bd58fcdb0 | 1 | public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println(
"Usage: java ReliableUdpServer <listening port>");
System.exit(1);
}
int serverPort = Integer.parseInt(args[0]);
//create new datagram socket ... |
7f4918ac-698c-44a8-8834-db22a60ef427 | 8 | private boolean sendData(BufferedInputStream bis, StageContext ctx) {
final TextConnection c = new TextConnection(ctx.getConnection());
Integer pos = (Integer) ctx.getParameter("position");
if (pos == null) {
pos = 0;
}
if (pos == 0) {
tr... |
d25e5ea8-8423-42b6-8cf1-2c2ce947b465 | 1 | public String toString() {
try {
return this.toJSON().toString(4);
} catch (JSONException e) {
return "Error";
}
} |
9d69f3fb-0658-4711-b545-e4a1ce9ef876 | 7 | @Override
public List<String> getColumns(String fileName) throws CustomerizedException {
List<String> columnNames = new ArrayList<String>();
String line = "";
String columnLines = "";
log.info("Start to read column names in "+fileName+"... ...");
//Get Column Name list
try {
FileReader fr = new FileReader... |
8ef6fcc6-9926-4054-b35f-0f60133b1998 | 4 | public static void main(String[] args) throws InterruptedException {
class SendThread extends Thread{
ClientTurtleEnvironment nioClientMT;
public SendThread(ClientTurtleEnvironment nioClientMT){
this.nioClientMT = nioClientMT;
}
@Override
... |
23345401-aad5-49be-a19f-c109ef7a3479 | 8 | public static Community parseCommunity(String name, String[] jsonFiles)
throws IOException {
// resulting community object to be filled with data.
Community result = new Community(name);
for (String file : jsonFiles) {
BufferedReader bin = new BufferedReader(new InputStreamReader(
new FileInputStream(f... |
ec461a65-bc09-46ca-9425-8f81c143ac68 | 9 | public qr_fact_househ(Matrix M) {
// Declare global variables
QR = M.getArrayCopy();
m = M.getRowDimension();
n = M.getColumnDimension();
if (!(m >= n)) {
entryError();
}
diagR = new double[n];
// Outer loop
for (int k = 0; k < n; k++)... |
67b182b7-a6e2-4d03-8479-0f5b2f672494 | 2 | public boolean query(String query){
// TODO: all calls here should call a closeQuery() which closes ps and currentResult
try {
ps = con.prepareStatement(query);
currentResult = ps.executeQuery();
return true;
} catch( SQLException e ){
if( debug ) System.out.println("Error in DataBaseConnection.query(... |
ad45f81a-27c1-4841-a8a6-2ef13b48586d | 3 | public void removeRow(int row)
{
if (getRowCount() > 0)
{
Object[][] temp = new Object[data.length - 1][data[0].length];
for (int i = 0; i < temp.length - 1; i++)
{
if (i < row)
{
temp[i] = data[i];
}
else
{
temp[i] = data[i + 1];
}
temp[i][1] = new Integer(i + ... |
dc6fef51-fb2a-4485-a92e-57581dfef2cd | 5 | @Override
public synchronized void avaliarCaso(Oferta oferta, boolean avaliacao)
throws RemoteException, SQLException {
if (oferta == null) {
throw new InvalidParameterException();
}
if (oferta instanceof OfertaEmprego) {
mConexaoBD.reviewEmprego(oferta.... |
03aa478e-5108-4ab5-ae52-9672db2d86c5 | 9 | public void displayGuiScreen(GuiScreen par1GuiScreen)
{
if (!(this.currentScreen instanceof GuiErrorScreen))
{
if (this.currentScreen != null)
{
this.currentScreen.onGuiClosed();
}
if (par1GuiScreen instanceof GuiMainMenu)
... |
d0b6f4bc-3485-449a-a423-86e09af4dd3f | 4 | private void setSizes(Container parent) {
int nComps = parent.getComponentCount();
Dimension d = null;
// Reset preferred/minimum width and height.
preferredWidth = 0;
preferredHeight = 0;
minWidth = 0;
minHeight = 0;
for (int i = 0; i < nComps; i++) {
... |
666595d3-430e-489e-bb04-82dd7d43fd48 | 5 | public List<Point> performFloodFile(Point start, FloodFillFunction function, int size) {
Set<Point> closed_set = new HashSet<>();
Queue<Point> open_list = new LinkedList<>();
List<Point> filled_list = new ArrayList<>();
open_list.add(start);
while (open_list.size() > 0) {
Point cur_point = open_list.poll();... |
3127983e-510f-463c-a73f-afc9dcc7657c | 8 | public OptionsFrame(VncViewer v) {
super("TigerVNC Options");
viewer = v;
GridBagLayout gridbag = new GridBagLayout();
setLayout(gridbag);
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
for (int i = 0; i < names.length; i++) {
labels[i] = new... |
8f02be5d-d945-4a39-8121-8a2a1e7ea12e | 5 | public static void main(String[] args)
{
System.out.println ("Text eingeben, 'Enter' schickt ihn zum Server. Eingabe von 'X' zum Beenden!");
// Tastatureingaben werden eingelesen:
BufferedReader reader = new BufferedReader ( new InputStreamReader (System.in));
//Server-Verbindung aufbauen:
... |
713e3dad-50f0-4ace-8728-142234513697 | 0 | public int incrementAndGet() {
int val;
synchronized (this) {
this.sharedCounter ++;
val = sharedCounter;
}
return val;
} |
30b5b9b3-92a9-4a0f-a3a4-f9037e619f55 | 3 | public void obstacleEvent(MapObstacle obstacle){
if(obstacle.getType() == ObstacleType.BUSH){
AudioPlayer.play(ResourceTools.getResourceAsStream("sounds/hitbush.wav"));
}
if(obstacle.getType() == ObstacleType.WALL){
AudioPlayer.play(ResourceTools.getResourceAsStream("s... |
ef26e589-11fd-4acc-8ff0-e9f080a63e85 | 1 | public String getArtifactFilename(String classifier) {
if (this.name == null) throw new IllegalStateException("Cannot get artifact filename of empty/blank artifact");
String[] parts = this.name.split(":", 3);
String result = String.format("%s-%s%s.jar", new Object[] { parts[1], parts[2], "-" + classifier }... |
15bf42e4-db40-4321-9afc-bac7bd303818 | 9 | public static void main(String[] args) {
for(;;)
{
System.out.println("\nDigite o comando: ");
String comando = sc.nextLine();
String[] array = comando.split(" ");
String opcao = array[0];
switch (opcao) {
case "imagem":
imagem = new Imagem(Integer.valueO... |
748c0d4b-a5f8-49f9-9fef-182e9cc47c9e | 0 | public boolean run() {
return gameWorld.run(camera, buffer);
} |
d089cb69-2cec-4d8a-8447-876754d8f9f0 | 4 | public void setTestInfo(TestInfo testInfo) {
BmTestManager bmTestManager = BmTestManager.getInstance();
if (testInfo == null || testInfo.isEmpty() || !testInfo.isValid()) {
testInfo = new TestInfo();
testInfo.setName(Constants.NEW);
testIdComboBox.setSelectedItem(test... |
232a1c17-8adc-4594-8e9f-12d2e47a8272 | 5 | @Override
public void paint(Graphics g) {
super.paint(g);
System.out.println("Printing Start Menu...");
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
... |
db7342f6-05b7-4bf4-b08b-ab811ec4caf7 | 0 | public OutConnectionHandler(ObjectOutputStream out) {
this.out = out;
} |
98890e8f-997c-46f9-b6d2-eac785d321ad | 3 | public static boolean getResultSet(String path,String request){
Connection c = null;
Statement stmt = null;
int s = 0;
try {
Class.forName("org.sqlite.JDBC");
c = DriverManager.getConnection("jdbc:sqlite:"+path);
stmt = c.createStatement();
ResultSet rs = stmt.... |
ef9bf782-54ca-452b-a552-7644c9aac0ed | 5 | public void echo() {
BufferedReader br = null;
try {
br = getReader(socket);
String str = null;
while (true) {
str = br.readLine();
if (str != null) {
System.out.println("From server: " + str);
if (str.startsWith("yt"))
ai_response(str);
} else {
break;
}
}
} catch... |
a259fd6d-867b-46b7-8052-f67b11558ddf | 5 | public static void main(String[] args) {
System.out.print("Enter the integers between 1 and 100: ");
Scanner scanner = new Scanner(System.in);
int integer = scanner.nextInt();
ArrayList integers = new ArrayList();
while (integer != 0) {
integers.add(integer);
integer = scanner.nextInt();
}
fo... |
f95d6516-baca-496e-b982-a569d2f129be | 6 | @Override
public int compare(Event<?, ?> e1, Event<?, ?> e2)
{
Interval<?> i1 = e1.getInterval();
Interval<?> i2 = e2.getInterval();
return ComparisonChain.start()
.compare(i1.getFrom(), i2.getFrom())
.compare(i1.getTo(), i2.getTo())
.compare(e1.getPayload(), e2.g... |
692dfddd-f78a-47f3-80ba-6d1102db9d7d | 7 | boolean validateMove(movePair movepr, Pair pr) {
Point src = movepr.src;
Point target = movepr.target;
boolean rightposition = false;
if (Math.abs(target.x-src.x)==Math.abs(pr.p) && Math.abs(target.y-src.y)==Math.abs(pr.q)) {
rightposition = true;
}
if (Math.abs(target.x-src.x)... |
912e081f-cbe9-43ff-98bb-b1e134ea0c45 | 0 | public Object deepCopy() throws Exception
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(this);
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
ObjectInputStream ois = new ObjectInputStrea... |
442f9f4c-9bb5-4064-bdda-a57872c0ee7d | 8 | public int decodeInteger(boolean implicit) throws Asn1Exception {
int retValue;
//
// There must be at least 2 bytes available
//
if (residualLength < 2)
throw new Asn1Exception("Attempt to read past end of stream");
//
// Validate the tag for an exp... |
00aa42e9-c0cf-48bc-bd85-1eaec07dde26 | 9 | @Override
protected Void doInBackground() throws Exception {
int hundred=pointsList.size();
setProgress(0);
for(int index=0;index<hundred;++index){
if (isCancelled())
return null;
List<Instance> tmpLst=new ArrayList<Instance>();
//Step 1 --> 4
Instance p=pointsList.get(index);
if(p.isClassed()... |
b8c018e8-a6f0-4f90-9c21-8295032a1f04 | 9 | public static int getAnsiScale(int color) {
int space = 256/5;
if(color == 0) {
return 0;
}
if(color < space*1) {
return 1;
}
if( color > space*1 && color < space*2) {
return 2;
}
if( color > space*2 && color < s... |
e0d7a2d4-0cfa-4f5e-be58-efee94a47aac | 0 | protected void onAction(String sender, String login, String hostname, String target, String action) {} |
56a771de-7547-4717-bb19-1145de58518f | 9 | public Object execute(IEval aEval, IContext aCtx, Object[] aArgs)
throws CommandException
{
try
{
Object[] lArgs = aArgs;
if (argList != null)
{
lArgs = argList.guard(aArgs, aCtx);
}
if(argMapping != null)
... |
c1b8554f-ebb5-4796-86ad-f831cc59c80c | 9 | public void wrap(Calculation base, int id) {
List<Node> sublist = new ArrayList<>();
List<Node> exp = base.algorithm;
int bracketCheck = 0;
/* Cutting the thing.*/
while (exp.size() > id) {
Node node = exp.remove(id);
sublist.add(node);
if (node instanceof ControlNode) {
if (((ControlNode) no... |
7b04790f-16e9-4f99-9ceb-166b5c18ee88 | 9 | @Override
public void close() {
if(status == STATUS_ALIVE){
try {
try {
if (serverSocket != null) socket.close();
} catch (IOException e) { e.printStackTrace(); }
try {
if (readStream != null) readStream.close();
} catch (IOException e) { e.printStackTrace(); }
try {
if... |
16764c32-dbd1-4a02-8c44-50fd729d5c2a | 1 | public void panic(EntityLiving el) {
if(el.left){
el.setRight(true);
}else
el.setLeft(true);
} |
6907d3d6-49f0-4443-8c2e-2bd2b7e4725c | 3 | public static void search_query(String[] query, String[] pages) {
StringBuilder re = new StringBuilder();
for (String q : query) {
re.append(q).append(".*");
}
Pattern pattern = Pattern.compile(re.toString());
int matchedCount = 0;
for (String page : pages)... |
84027e41-7006-4ee3-ae64-66a293568d06 | 6 | public static boolean isBSTTwo(BinaryTreeNode root) {
if (root == null) {
return true;
}
if (root.leftChild != null) {
int leftMinValue = BinaryTreeMin.minValueRecursive(root.leftChild);
if (root.data < leftMinValue) {
return false;
}
}
if (root.rightChild != null) {
int righ... |
60a82464-fa2e-4d36-8e2f-b3522d1f876d | 7 | public String readTxtFileRangeRow(String filePath) {
StringBuilder contents;
contents = new StringBuilder();
try {
String encoding = "UTF-8";
// filePath = RecoverUserFromDbTask.class.getResource("/").getPath() + filePath;
File file = new File(filePath);
// ... |
d5bf159a-786f-4b5d-95a3-9c68d4f2ff7f | 9 | public int updateFileSystemObject(Vector<Object> data) throws SoSimException {
// Update any file system item
FolderItem folder;
if (selectedObject.isFolder()) folder = selectedObject.getParent();
else folder = selectedObject.getFolder();
if (selectedObject.getParent() == null) throw new ... |
b3822444-fb35-4bdc-bc58-5ceebe17363b | 1 | public String toStringf(){
//System.out.printf("\tMarker 1\n");
String str1 = toString();
String str2;
//System.out.println("\tMarker 2\tstr1 = "+str1);
int len = str1.length();
//System.out.printf("\tMarker 3\tlen = %d\n", len);
if (len>3){
// System.out.printf("\tMarker 4\n");
... |
0ceea147-ae0a-49b8-99e4-bf0e504a4976 | 6 | @Override
public void mouseMoved(MouseEvent arg0) {
int x = arg0.getX();
int y = arg0.getY();
if(x>XPAINT && x<XPAINT+WIDTH && y>YPAINT && y<YPAINT+HEIGHT){
if((x-XPAINT)/32!=current_abscisse || (y-YPAINT)/32!=current_ordonnee){
repaint(XPAINT+current_abscisse*32,... |
14b539d1-6b41-4325-9a2b-c87cab766609 | 8 | public void unionIn(PostingsList other) {
// Don't do anything if other has no elements
if (other.size() == 0) {
return;
}
Node<Posting> meCur = this.getHeadNode(), meNext = meCur.next;
Node<Posting> them = other.getHeadNode().next;
while (them != null) {
if (meCur != this.getHeadNode() &&
them.v... |
a454990d-0b0f-43eb-ae01-d0b9537e5744 | 6 | public Wave31(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 1100; i++){
if(i % 27 == 0)
add(m.buildMob(MobID.TENTACRUEL));
else if(i % 5 == 0)
add(m.buildMob(MobID.TENTACOOL));
else if(i % 4 == 0)
add(m.buildMob(MobID.SHELLDER));
else if(i % 3 == 0)
add(m.buildMob(Mob... |
0e113f56-ca35-4ed0-87e3-e050f6ec9f80 | 8 | @Override
public void keyPressed(KeyEvent e) {
traceKeyEvents(e);
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
case KeyEvent.VK_NUMPAD4:
case KeyEvent.VK_A:
deltaX--;
xPosition = xPosition + deltaX;
if (xPositio... |
8beb6336-247d-4c21-bf64-eb6042a49dc9 | 2 | public final void sendMessage(Message msg) {
System.out.println("============== Sending Msg ==================" );
try {
byte[] buffer = new byte[1024];
DatagramPacket packet = new DatagramPacket(buffer, buffer.length, multicastAddre, 4446);
... |
012eed31-28f3-4647-809d-488b5b425d4a | 1 | public void printListForwards() {
if (next != null) {
System.out.println(this.getData());
next.printListForwards();
} else {
System.out.println(this.getData());
}
} |
51dd98e7-21df-44ac-b099-ff8135754938 | 9 | @Override
public boolean isValidObject(){
if(lines.size() == 3){
String begin = lines.get(0);
String middle = lines.get(1);
String end =lines.get(2);
return (begin.startsWith(SECTION_SEP) && end.startsWith(SECTION_SEP) && isValidSectionNumber(middle))
|| (begin.startsWith(SUBSECTION_SEP) && e... |
cc5ef471-112b-43d7-b7c5-e54379fda821 | 6 | @Test
public void requestCreation() {
TeleSignRequest tr;
if(!timeouts && !isHttpsProtocolSet)
tr = new TeleSignRequest("https://rest.telesign.com", "/v1/phoneid/standard/15551234567", "GET", "customer_id", "secret_key");
else if(timeouts && !isHttpsProtocolSet)
tr = new TeleSignRequest("https://rest.teles... |
610d384d-90f1-449a-a60e-b0089002b8b8 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
6d80181b-7203-47a1-be3b-1f159202c33c | 8 | private void btnguardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnguardarActionPerformed
String nombre="", precio="", descripcion="", nombrev="", status="A", status2="", sSQL="", sSQL2="";
nombre=txtnombre.getText();
precio=txtprecio.getText();
descripcion=... |
104f031f-40c8-4490-8837-8b55bb7c36b2 | 7 | public void changeArrayProperties(boolean clear){
boolean go = true;
JTextField field1 = new JTextField(EditorWindow.panel.editor.getTileBuffer().getMap().getCols()+"");
JTextField field2 = new JTextField(EditorWindow.panel.editor.getTileBuffer().getMap().getRows()+"");
JPanel panel = ne... |
a648dbff-8a08-47cf-9cef-c55788ef5451 | 5 | private static String getVariableTypeFromName(String name) {
for (VariableInformation var : variableList)
if (var.name.equals(name))
return var.type;
if (name.equals("inf") || name.equals("-inf") || name.equals("nullity"))
return "transreal";
return "unknown";
} |
209d92c8-349c-4d59-a9ee-74968b587d53 | 0 | private void resetImageGeometry() {
this.imgHeight = -1;
this.imgWidth = -1;
this.imgBitsPerPixel = -1;
this.imgIndexedColors = 0;
} |
872da91f-e644-4862-82cc-662ec50605a7 | 7 | @Override
public int attack(NPC npc, Entity target) {
final NPCCombatDefinitions defs = npc.getCombatDefinitions();
int distanceX = target.getX() - npc.getX();
int distanceY = target.getY() - npc.getY();
int size = npc.getSize();
int hit = 0;
int attackStyle = Utils.random(2);
if (attackStyle == 0 && (di... |
e4ac7cc1-d706-4a0b-bb07-1fd689302eef | 1 | private static void println(String msg) {
if (AzotConfig.GLOBAL.VERBOSE) {
System.out.println(msg);
}
} |
95c0e57d-f3f0-46cb-8325-028efa7bde8f | 2 | public boolean accountExists(String name) {
for (Account a : accounts) {
if (a.owner.equals(name)) {
return true;
}
}
return false;
} |
f4863b55-ddcd-44db-ba92-5cfbf241ee37 | 8 | private void doClick(int xVal, int yVal, boolean leftClick, boolean rightClick,MouseEvent e){
int columnIndex = determineColumn(xVal);
int rowIndex = determineRow(yVal);
if(rowIndex == -1 && columnIndex != -1){
updateController(rowIndex, columnIndex);
}
// br... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.