method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9b3be2e8-edf3-4c27-a0e0-17375290d52e | 8 | protected Object doMapping(Object src, Class targetClass, MappingConfig config) {
Object newObj = null;
if (config.convertor != null) {
if (config.componentClasses != null && config.convertor instanceof CollectionConvertor) {
newObj = ((CollectionConvertor) co... |
e504531f-8059-4c44-adc1-31abfb3a4cff | 2 | public void abrirBD(String nombreBD)
{
try
{
this.bd = SqlJetDb.open(new File(nombreBD), true);
this.bd.beginTransaction(SqlJetTransactionMode.WRITE);
}
catch (SqlJetException ex)
{Logger.getLogger(BD.class.getName()).log(Level.SEVERE, null, ex);} ... |
f0ff458a-0b2a-4f8d-9261-4f8daad964d9 | 8 | public double getValue(HRMatrix hrMatrix) throws Exception {
double salary = 0;
for (ProjectInfo project : projects) {
int projectDurationInDays = 0;
// szukam najdalej wysunietej jedynki sposrod wszystkich
// zadan kazdego projektu
try {
for (int rowId = 0; rowId < hrMatrix.getRows().size(); rowId... |
a2857ade-30a3-4b7b-bd0d-a0d19e469025 | 9 | private static void getContentAsDefined(){
StringTokenizer _tempTokens;
File _tempFile = new File(FileName);
Scanner _fileScanner;
String _line;
String token;
int _tokenCount;
try {
_fileScanner = new Scanner(_tempFile);
while(_fileScanner.hasNextLine()){
_line = _fileScanner.nextLine();
if(... |
744424f2-7e72-4451-a39c-17c24f71ae16 | 9 | public String processEnglishPhonetics(String word) {
StringBuilder sb = new StringBuilder(word);
if ((word.matches("[a-zA-Z]+[1246789]?[a-zA-Z]*")) || (word.matches("[1246789]?[a-zA-Z]+"))) { //||(word.matches("[a-zA-Z]+[1246789]?[a-zA-Z]*")))
//Number Homophones e.g. gr8, 7teen, sum1
... |
22fe462d-dc7f-4b3a-ba8c-a6019d96a5af | 1 | public void crearXML(String origen, String destino) {
URL inputUrl = getClass().getResource(origen);
File dest = new File(destino);
try {
FileUtils.copyURLToFile(inputUrl, dest);
} catch (IOException e) {
e.printStackTrace();
}
} |
29e0e378-97a9-464d-93a5-6ef9eace0f4d | 9 | private synchronized Hashtable<String,User> getUsers() {
Hashtable<String,User> hashtable = new Hashtable<String,User>();
Document usersXML;
try { usersXML = XmlUtil.getDocument(usersFile); }
catch (Exception ex) {
logger.warn("Unable to parse the users file: "+usersFile);
return hashtable;
}
Elemen... |
aa8030b2-6871-46fa-9b2f-11a8cb2df18f | 6 | public Directions getDirectionFromSign(Sign sign){
Directions direction = Directions.None;
int id = getIdFromSign(sign);
if(displays.get(id).get(0).getDirection().matches("[nN]|[nN]orth")){
direction = Directions.North;
}
else if(displays.get(id).get(0).getDirection().matches("[sS]|[sS]outh")){
di... |
13853bb3-5b61-4bc3-9717-c56f8eadf152 | 6 | public STNotificationWindow(STNotificationType t, String title)
{
this.title = title;
texturePath += "window.png";
switch (t)
{
case INFO:
typePath += "normal.png";
break;
case ERROR:
typePath += "error.png";
break;
... |
bcd1ebf5-5b9f-47d6-bb58-dbbbbd677c26 | 9 | public static int getIntValue(PrintType printType)
{
switch (printType)
{
case SCREEN_CUPS: return 0;
case PAD: return 1;
case HOTSTAMP: return 2;
case OFFSET_CUPS: return 3;
case OFFSET_NAPKINS: return 4;
case DIGITAL_FLATS: return 5;
case SCREEN_NAPKINS: return 6;
case OUTSOURCED: return ... |
babbabe5-e06d-4a2a-aa27-c217905ab9c2 | 4 | public static void makeCollisionMap(){
try {
BufferedImage image = ImageIO.read(new File("map.png"));
BufferedImage output = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_ARGB);
for (int y = 0; y < image.getHeight(); y++) {
for (i... |
62bad97c-c19f-4245-870a-2f2f990b6f95 | 8 | private void cftrec4_th(final int n, final double[] a, final int offa, final int nw, final double[] w) {
int idiv4, m, nthread;
int idx = 0;
nthread = 2;
idiv4 = 0;
m = n >> 1;
if (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_4Threads()) {
nthread = 4;
... |
a4509121-5326-40f9-98d8-4ee21d49ae8d | 2 | protected void run() {
super.run();
if (validate()) {
if (!Pray.prayerActive(19))
Pray.toggle(19);
}
} |
277018c8-a5d8-48f8-aa05-dd9b5dfe635b | 9 | public void estimateLCCMode() {
for (int i = 0; i < plantImages.size(); i++) {
if (plantImages.get(i).getMode() >= LCCMode[3]
&& plantImages.get(i).getMode() <= 95)
plantImages.get(i).setLCC(5);
else if (plantImages.get(i).getMode() >= LCCMode[2]
&& plantImages.get(i).getMode() < LCCMode[3])
... |
4fe81cda-be35-4ae9-87c2-a65603611003 | 6 | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
try {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
HttpSession s... |
87ace03d-5eaa-47e5-82b1-d5aef9a39fa8 | 3 | public static final boolean aabb(double x, double y, int w, int h,
double x2, double y2, int w2, int h2) {
return x2 <= x + w
&& x2 + w2 >= x
&& y2 <= y + h
&& y2 + h2 >= y;
} |
8915b3aa-8edb-4b40-88de-af83083b43fb | 5 | @Override
public void emettre() throws InformationNonConforme {
int i = 1, j = 0;
float sum = 0.0f;
int nbBits = informationRecue.nbElements() / nbEch;
Boolean[] tabBool = new Boolean[nbBits];
for (i = 0; i < nbBits ; i++) {
for (j = 0; j < nbEch; j++) {
sum += informationRecue.iemeElement((i*nbE... |
2a435454-f0c9-4f66-98fb-4616ec11429d | 4 | private void zoom(int wheelRotation, Point p) {
//System.out.println(wheelRotation);
try {
if (wheelRotation > 0) {
if (zoomLevel < maxZoomLevel) {
zoomLevel++;
Point2D p1 = transformPoint(p);
coordTransform.scale(1 ... |
e2ce6ba3-795d-4241-89ad-8c49022e0490 | 4 | public ApproachFrom[] collisionType(Positioned other)
{
ApproachFrom[] af = new ApproachFrom[2];
af[0] = ApproachFrom.NONE;
af[1] = ApproachFrom.NONE;
if (oldX() + getWidth() <= other.leftBorder())
af[0] = ApproachFrom.LEFT;
else if (oldX() >= other.rightBorder()... |
0dde7fdf-2c1f-4fc8-a11d-ae21f65c8c59 | 7 | public void actionPerformed(ActionEvent e) {
Object action = e.getSource();
if (action == mntmRestartLevel) {
if(gp != null) {
gp.restartLevel();
gp.getGameState().setScore(0);
}
} else if (action == mntmLevelSelect) {
gotoLe... |
9e941499-4806-4ddf-9eee-231220a27654 | 3 | private static Record getNewRecord(String baseformat) throws SQLException
{
String cd_extra = "AND riploc IS NOT NULL";
if (!baseformat.equalsIgnoreCase("cd"))
cd_extra = "";
String sql = "SELECT recordnumber from formats,records LEFT JOIN score_history ON recordnumber = record_id WHERE ... |
919e5c5c-5168-42e4-9a87-01fb39f52227 | 6 | public void genShield(){
rand = new Random();
shiRoll = (rand.nextInt(100)+1);
if(shiRoll <= 10){
armor = "Masterwork Buckler";
value = 165;
} else if(shiRoll <= 15){
armor = "Masterwork Light Wooden Shield";
value = 153;
} else if(shiRoll <= 20){
armor = "Masterwork Light Steel Shield";
... |
023aae6e-610e-4ebe-bd04-5d540c5f6ec5 | 2 | NotebookTxtMappedDb(final String fileName ) throws IOException {
super(fileName);
nb_txt = new NotebookTxtDb(fileName);
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
String checkVar;
while ((checkVar = br.readLine()) != null) {
... |
25d7d1d9-469f-4de3-8c1f-8e2e8348661d | 8 | private void field_tipo_comprobanteFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_tipo_comprobanteFocusLost
boolean es_componente=false;
//voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos
if (evt.getOppositeComponent()!=fecha_f... |
8c5f114b-f789-4157-ad65-cad310d1f681 | 9 | static ArrayList<Pair> surroundpr(Pair start) {
// System.out.printf("start is (%d, %d)", start.x, start.y);
ArrayList<Pair> prlist = new ArrayList();
for (int i=0; i<4; i++) {
Pair tmp0 = new Pair(start);
//Pair tmp = new Pair();
if (i==0) {
if ... |
eb16c689-843c-4a9c-8a75-9a38a78b7ee2 | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
int userId = Main.DecodeInt();
Player pClient = Environment.ClientManager.GetClient(userId);
if(pClient==null) return;
if((pClient.Flags & Server.plrOnline) == Server.plrOnline) // Is Online?
{
... |
42326437-4cf7-4b15-9de0-3dacc192bfe0 | 6 | @Override
public HashMap<String, String> read() throws ConfReaderException {
HashMap<String, String> resultMap = new HashMap<String, String>();
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder;
try {
docBuilder = docBuilderFactory.newDocume... |
097ef464-49b8-4232-8fd3-6fb281a8af13 | 7 | public Field[] getFields(Class parentClass, boolean isDeclared, String... strings) throws NoSuchFieldException {
Field[] fields = new Field[strings.length];
for (int len = 0; len < strings.length; ++len) {
String string = strings[len];
if (string != null || string != "") {
... |
57ee9a44-e6f0-487d-85fe-ef6708b643eb | 5 | public void ZoomExtents()
{
Rectangle r = null;
LinkedList<Vector2> verticies = new LinkedList<Vector2>();
switch(mEditType)
{
case Polygon:
{
ListIterator<Polygon> i = mSelectedPolys.listIterator();
while(i.hasNext())
{
verticies.addAll(i.next().GetAbsoluteVerticies());
... |
bd28e802-b3fd-4fd3-9762-51271d544590 | 6 | public static void startupGuiServer() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/POWERLOOM-SERVER/GUI-SERVER", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(... |
675b980f-152d-4e67-a3dd-83caf67f25fd | 1 | private String closeAlertAndGetItsText() {
try {
Alert alert = driver.switchTo().alert();
String alertText = alert.getText();
if (acceptNextAlert) {
alert.accept();
} else {
alert.dismiss();
}
return alertText;
} finally {
acceptNextAlert = tr... |
a46531fc-0cb0-41b8-92fa-f83fa17654c7 | 0 | public void setDefaultBackgroundColor() {
this.setBackground(this.backgroundColor);
} |
7016655a-140c-4dfc-84fb-e8f0e2f4d125 | 3 | public Map<Integer,Object> parse(String line) {
row++;
Map<Integer,Object> map = new Hashtable<>(simpleFormat.getColumns().size());
String part = "";
for(Column c:simpleFormat.getColumns()){
try {
part = line.substring(c.getBeginIndex(), c.getEndIndex()).trim();
... |
5e79f780-04d3-46ff-81f5-60febe54e3c3 | 8 | public static int[] primes(int n) {
if (n <= 2) {
int[] result = {};
return result;
}
ArrayList<Integer> list = new ArrayList<Integer>();
boolean[] array = new boolean[n];
for (int i = 3; i < n; i += 2) { // consider odds only
array[i] = true;
}
int prime = 3;
int q;
list.add(2);
... |
3027b0ed-37b9-4fe7-a772-80d58d8f035b | 0 | private void datosEstudiante(General atributos, String n, int c, String m, double nota){
//Se le dan los datos a los atributos del objeto
atributos.nombre = n;
atributos.codigo = c;
atributos.materia = m;
atributos.nota = nota;
} |
194101a7-572f-4b7a-8c30-67f216361251 | 5 | protected List<Proxy> handleResponse(HttpResponse response, List<Proxy> value, Context context) throws IOException {
if (response.getStatusLine().getStatusCode() != 200)
throw new IOException();
if (value == null) {
value = new ArrayList<Proxy>();
}
Document doc;
{
InputStream in = response.getEntity... |
c0918418-10e1-415b-a815-5ad9c48b25eb | 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... |
fc8a3a9a-7f4d-43d3-aa70-2da27500e9db | 8 | public void offer(T item) {
if(item == null) {
return;
}
synchronized(lock) {
if(queue.size()>=capacity) {
System.out.println("Reach maximum capacity...");
return;
}
queue.offer(item);
if(maxList.isEmpty()) {
// if max list is empty, append it
maxList.add(item);
} else... |
11aed893-c040-457d-b549-795c82c6ced9 | 9 | public void feedPlainPacket(ByteBuffer b, Object passThrough) {
if(!isConnected)
throw new NotYetConnectedException();
else if(isClosing || isClosed) {
throw new IllegalStateException(id+"SSLEngine is in the process of closing or is closed");
} else if(runningRunnable)
throw new IllegalStateException(id... |
2b413b4b-4647-4543-8c46-2a86fb80967d | 0 | public ProxyInfo(){
} |
5aea0516-b39a-46ad-b47c-7cd568c3ae04 | 9 | public double[][][] observeStructure(int a) {
double[][][] state = new double[rView][cView][3]; // [availability,
// color, agentScore
// or 0]
int x = aStats[a].x;
int y = aStats[a].y;
int leftx = x - cView / 2;
int lefty = y - rView / 2; // correct round?
for (int i = 0; i < ... |
68d88296-21cd-4b83-a3c8-800dfa601c55 | 9 | public static String mapFlagsString(OMMMap data)
{
StringBuilder buf = new StringBuilder(60);
if (data.has(OMMMap.HAS_DATA_DEFINITIONS))
{
buf.append("HAS_DATA_DEFINITIONS");
}
if (data.has(OMMMap.HAS_SUMMARY_DATA))
{
if (buf.length() != 0)
... |
5f37382e-9100-445b-bfce-e2861db760ed | 5 | protected int readBlock() {
blockSize = read();
int n = 0;
if (blockSize > 0) {
try {
int count = 0;
while (n < blockSize) {
count = in.read(block, n, blockSize - n);
if (count == -1)
break;
n += count;
... |
7c2f3e27-9903-492d-be12-f4c58dc7e500 | 1 | @SuppressWarnings("unchecked")
public IndexMinPQ(int maxN)
{
items = (Item[]) new Comparable[maxN + 1];
pq = new int[maxN + 1];
qp = new int[maxN + 1];
for (int i = 0; i < maxN; i++)
qp[i] = -1;
N = 0;
} |
b7e32aaf-f2df-4665-b711-1cd9f985b271 | 9 | public String getTitle(DockingWindow window) {
ArrayList viewTitles = new ArrayList();
ArrayList viewPrimary = new ArrayList();
getViews(window, viewTitles, viewPrimary, true);
int length = 0;
for (int i = 0; i < viewTitles.size(); i++) {
if (((Boolean) viewPrimary.get(i)).booleanValue()) {
... |
52274863-7c94-4429-accd-57da0720649b | 4 | public String row(int i)
throws Exception
{
int h = this.tb.height();
// Sanity check
if ((i < 0) || (i >= h))
{
throw new Exception("Invalid row " + i);
} // if the row is invalid
if (this.tb.width() > this.width)
{
throw new Exception("New TextBlock width is gr... |
20935202-bd80-4a81-b5c5-8dd37d214e09 | 9 | public void resultSetToTable(ResultSet rs, Boolean tableData) {
//Gets the results from the employee table if the ResultSet value is null.
if (rs == null) {
rs = controller.getTableData(getMenuString());
}
try {
ResultSetMetaData rsmd = rs.getMetaData();
... |
565f6d0c-314d-4ce0-a3b7-a676ff511caa | 6 | @Override
public Point getNearestTownHallXY(Point p) {
int closestX = 0;
Point townHall = new Point(0, 0);
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
if (placeab... |
25649d3f-a45e-4f49-a186-e68f7baf343f | 8 | public static void main (String[] args)
{
int[] a = new int[10000];
for (int i = 2; i < SIZE; i++)
{
int divisors = 0;
for (int j = 1; j <= (i+1)/2; j++)
if (i % j == 0)
divisors+=j;
a[i] = divisors;
}
int sum = 0;
for (int i = 2; i < SIZE; i++)
{
for (int j = i; j < SIZE; j++)
... |
9df4b8e8-efda-46d4-a07e-33c2bb55631c | 4 | public synchronized PacketReceipt getSentPacketWithSequenceNumber(int sequenceNumber) {
//ignore N/A sequence numbers
if(sequenceNumber == Packet.SEQUENCE_NUMBER_NOT_APPLICABLE)
return null;
//if the sequence number is for a packet in the future then we haven't sent it yet
int delta = Packet.deltaBetweenSeq... |
ce5e56ca-6ccc-463b-9614-efa0005ae7ef | 6 | public static void nameComponents(Class<?> clz, Object obj) {
try {
Field[] fields = clz.getDeclaredFields();
for (Field field : fields) {
if (CommonUI.isNamedComponent(field.getType())) {
field.setAccessible(true);
if (field.get(obj) != null) {
String name = (String) MethodUtils.in... |
b0a5873e-3eaf-4a5d-ab2c-56f1a91d2dd3 | 9 | public static int[] generatePrimes(int maxValue)
{
if (maxValue >= 2) // the only valid case
{
// declarations
int s = maxValue + 1; // size of array
boolean[] f = new boolean[s];
int i;
// initialize array to true.
for (i = 0; i < s; i++)
f[i] = true;
// get... |
cc3c7b6a-8a93-4a0d-8724-0eca6e9063c6 | 0 | public void clear()
{
points.removeAllElements();
result.Name = "";
result.Score = 0;
result.Index = -1;
} |
b65f053e-ba9e-4203-9bfd-154f37079617 | 5 | private int findHeaderEnd(final byte[] buf, int rlen) {
int splitbyte = 0;
while (splitbyte + 3 < rlen) {
if (buf[splitbyte] == '\r' && buf[splitbyte + 1] == '\n' && buf[splitbyte + 2] == '\r' && buf[splitbyte + 3] == '\n') {
return splitbyte + 4;
... |
d210f53a-1414-4669-ae0e-ff5161aa05da | 9 | private static void join (int a, int b) {
int x = root (a), y = root (b);
if (taken [x] == D && taken [y] == D)
throw new RuntimeException();
if (taken [x] == D) {
par [x] = y;
taken [y]++;
if (depth [x] + 1 > depth [y])
depth [y] = depth [x] + 1;
} else if (taken [y] == D) {
par [y] = ... |
ad7f6aeb-94e7-414a-9ca7-ff316939ef5e | 7 | private static List<VoieDeCirculation> calculerItineraire2(Carte c, Route depart, Route arrivee) {
List<VoieDeCirculation> chemin = new ArrayList<VoieDeCirculation>();
List<List<VoieDeCirculation>> tmp = new ArrayList<List<VoieDeCirculation>>();
List<VoieDeCirculation> best = new ArrayList<VoieD... |
94d0485b-8fa3-4d69-8d29-560c43287b8b | 5 | public int print(Graphics g, PageFormat pf, int page) throws
PrinterException
{
try {
if (page > 0) { /* We have only one page, and 'page' is zero-based */
return NO_SUCH_PAGE;
}
gHoa_don = (Graphics... |
86c01d68-7a04-4898-8d6c-8df15349fe4a | 2 | @Override
public void keyPressed(KeyEvent ke) {
//variables para saber si esta presionado o no
if(ke.getKeyCode() == KeyEvent.VK_LEFT){
bIzq = true;
}
else if(ke.getKeyCode() == KeyEvent.VK_RIGHT){
bDer = true;
}
} |
e2b4b76c-6934-476b-8037-a8c0299ab6dd | 8 | public void startServer(){
//Send Html for all the clients
for(int i = 0;i< 4*this.number_of_clients;i++){
try{
establishInitialConnection();
if(html_sent==this.number_of_clients)
break;
}catch(FileNotFoundException e){
System.out.println("Cannot establish initial connection. FileNotFoundE... |
780a5e7d-62cb-4ed1-bd91-86b845b2eecb | 0 | @Override
public void endSetup(Attributes atts) {
} |
3d30fc63-74f0-497b-bc0e-73a5d113b931 | 8 | public static void dcopy_j (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%7;
for (i = 0; i < m; i++) {
dy[i... |
4a5112f0-2a6d-4f27-b29d-261ee970697d | 3 | public boolean execCpwQuery(String user, String newPass, boolean admin) {
Connection conn = plugin.getDbCtrl().getConnection();
PreparedStatement ps = null;
try {
String sql = String.format("UPDATE `%s` SET `password` = ? WHERE `id` = ?",
plugin.getDbCtrl().getTable(Table.ACCOUNT));
ps = conn.prepareS... |
334cf024-1ee2-4dfd-8d13-0747daf83abf | 7 | private void btnApostarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnApostarActionPerformed
if (carreraAbierta != null) {
Jugador j = new Jugador(0, txtUsuario.getText().toString(), txtPass.getText().toString());
j = fachada.login(j);
if (j != null) {... |
7250cbf7-24f4-4131-9348-eef8bd95a878 | 5 | public int getDeletePercentage(Player player) {
if (plugin.getWorldGuardClass().isWorldGuardReady()) {
RegionManager regionManager = wgPlugin.getRegionManager(player
.getWorld());
if (regionManager != null) {
ApplicableRegionSet set = regionManager
.getApplicableRegions(player.getLocation());
... |
cc9cb2f5-63f1-4993-a5db-c930d6cf2775 | 8 | @Override
public float evaluate(double x, double y) {
//convert from poinkare to Klein
if (!isKlein){
double k = 1+x*x+y*y;
if (k>2)
return -1;
x=x*2/k;
y=y*2/k;
}
//first project point from the t=1 plane to the t^2-x^2-y^2 = 1 plane.
double d2 = 1 - Utils.sqr(x) -Utils... |
e369b234-7885-421d-888b-4374a43b79dc | 2 | public static void main(String[] args) throws MessagingException {
File backupLocation = new File("/home/to_move/");
File archiveLocation = new File("/home/server/backup/");
try {
File oldestBackupDir = findOldestBackup(backupLocation);
... |
78fd0c56-4dab-4499-873b-f25a03287046 | 1 | public void addClassAnalyzer(ClassAnalyzer clazzAna) {
if (innerAnalyzers == null)
innerAnalyzers = new Vector();
innerAnalyzers.addElement(clazzAna);
getParent().addClassAnalyzer(clazzAna);
} |
84a1c490-8eb5-4443-9f4b-83b0b60f67ad | 5 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane = new javax.swing.JScrollPane();
DefaultMutableTreeNode top =
new DefaultMutableTreeNode("HelpDesk");
createNodes(... |
4cf28eb3-4ba5-4b82-adaf-b9a2c319ce31 | 5 | private void generateXml() throws Exception {
try {
String fileName = inputFile.getName().split("\\.")[0];
File outputFile = new File(outputFolder, fileName + ".xml");
Element rootElement = new Element(fileName + "List");
for (List<String> lines : data) {
... |
7ffe4f21-0d67-4ad6-af61-e8ba381c945e | 7 | private void toistaAani() {
try {
URL url = Aanet.class.getResource(this.soundName+".wav");
AudioInputStream stream = AudioSystem.getAudioInputStream(url);
AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(url);
AudioFormat format = f... |
2288f0bb-2d54-41ba-acd2-eaf1f067a89e | 5 | @Override
public void onDataEntered(String entry) {
if (entry == null || entry.length() == 0) {
return;
}
super.onDataEntered(entry);
String[] tokens = Utils.tokenize(entry.trim(), " ");
String operator = tokens[0];
String operand = entry.replace(operator, "").trim();
UserCommandLineAction cmd ... |
791bfa41-0f27-4133-95e6-7ec1abdb7085 | 5 | protected void handleControlPropertyChanged(final String PROPERTY) {
if ("UPDATE".equals(PROPERTY)) {
update();
} else if ("RESIZE".equals(PROPERTY)) {
resize();
update();
} else if ("PREF_SIZE".equals(PROPERTY)) {
aspectRatio = getSkinnable().getP... |
828757c0-9d0d-4a21-9226-914bc18b9fc5 | 3 | @Override
public OggPacket write() {
int len = 64;
if (versionMajor == 4) {
len = 80;
}
byte[] data = new byte[len];
IOUtils.putUTF8(data, 0, MAGIC_FISHEAD_STR);
IOUtils.putInt2(data, 8, versionMajor);
IOUtils.putInt2(data, 10, versionMinor);
... |
7eea8182-6efb-4ed4-a81f-d008eb15f0b1 | 7 | @Override
public void unInvoke()
{
Item I=null;
if(affected instanceof Item)
I=(Item)affected;
super.unInvoke();
if((canBeUninvoked())&&(I!=null)&&(I.owner() instanceof MOB)
&&(!I.amWearingAt(Wearable.IN_INVENTORY)))
{
final MOB mob=(MOB)I.owner();
if((!mob.amDead())
&&(CMLib.flags().isInTheGa... |
b139f971-eca5-45c2-b4a7-b1e388d7560d | 3 | public static void noSpace(String string) throws JSONException {
int i, length = string.length();
if (length == 0) {
throw new JSONException("Empty string.");
}
for (i = 0; i < length; i += 1) {
if (Character.isWhitespace(string.charAt(i))) {
throw... |
15dcb997-e71c-4676-b66f-30c90e47554e | 9 | private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
ColorModel colorModel = null;
// Read serialized form from the stream.
ColorSpace cs = null;
// Switch on first int which is a flag indicating the class.
switch((int)in.readInt())... |
e1e9714e-b884-417a-add6-62294075c1b6 | 7 | public static boolean cheapEmptyTermP(LogicObject self) {
if (Logic.skolemP(self)) {
{ Proposition definingproposition = ((Skolem)(self)).definingProposition;
if ((definingproposition != null) &&
(Proposition.collectionofPropositionP(definingproposition) &&
(definingpropositi... |
8d769800-df8e-4dca-9fc6-55453af905c8 | 9 | public void run() {
Set<Address> sent=new HashSet<>(); // list of all unicast dests we already sent a beacon msg
boolean mcast_sent=false;
for(Map.Entry<Short,Entry> entry: ids.entrySet()) {
Short rsvp_id=entry.getKey();
Entry val=entry.getValue(... |
089dba1c-92f0-4c48-8505-609958026bd1 | 4 | public double estimateHandStrength() {
OpponentEntry currentEntry = opponentLogger.getLastEntry(playerID);
if (currentEntry == null || currentEntry.getAction().action == ACTION.FOLD) {
return -1;
}
for (OpponentEntry entry : entries) {
if (entry.equals(currentEntry)) {
return entry.getHandStrength()... |
52475255-3df2-4111-acef-ca0eed612ae2 | 3 | public static void main(String[] args) throws Exception{
String dictFile = "words.txt";
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line;
TopQueue topQueue;
if(args.length == 1) {
dictFile = args[0];
}
else if(... |
14764608-143d-4ef9-a297-711c7e9795b4 | 7 | protected static SensorPost locateNewPost(SurveyStation parent) {
final World world = parent.world() ;
final int numAttempts = 5, bonus = parent.structure.upgradeLevel(
SurveyStation.SENSOR_PERIMETER
) ;
float range = World.SECTOR_SIZE / 2f, spacing = 10 ;
range *= 1 + bonus ;
final S... |
eb7a411d-1bfc-446a-b299-fc57cda2a369 | 0 | public void chercher(){
String nom = (String) this.vue.getjComboBoxChercher().getSelectedItem();
String [] libelle = nom.split(" ", 0);
Visiteur unVisiteur = DaoVisiteurJPA.selectOneByNomPrenom(em, libelle[0], libelle[1]);
afficherVisiteur(unVisiteur);
} |
7f01785c-e583-4050-b937-1a4483cf31e0 | 9 | private boolean currentBlockType(){
boolean error = false;
switch(parseTokenList.get(i).getText()){
case "integer":{
for(TokenParser token: listOfNewVariable){
token.setType("integer");
}
listOfNewVariabl... |
73d439af-c668-4423-983d-27c233892523 | 5 | public static int randomSelect(List<Integer> list, int index) {
Random rand = new Random();
int partIndex = rand.nextInt(list.size());
int q = list.get(partIndex);
int qIndex = list.indexOf(q);
List<Integer> partitionList = new ArrayList<Integer>();
partitionList.add(q)... |
3a7d540e-ed55-4a05-80e0-76cce8f55a9b | 1 | @Override
public int compareTo(final Decimal other)
{
if (other == this)
{
return 0;
}
else
{
return 1;
}
} |
436d7ac8-8ed0-4ca8-8b99-0945d079c242 | 7 | public void paintComponent(Graphics g){
super.paintComponent(g);
this.setBackground(Color.PINK);
int size = 25;
for(int x = 0; x < Globals.width; x++){
for(int y = 0; y < Globals.height; y++){
g.setColor(new Color((int)(Globals.heightmap[x][y]),(int)(Globals.heightmap[x][y]),(int)(Globals.heightmap[x][y]... |
7c8fa249-0f76-446e-b5ce-38c3b7e9f921 | 8 | public static List<? extends SymbolDrawer> getDrawer(Object obj) throws MalformedURLException {
if (obj == null)
return Collections.EMPTY_LIST;
else if (obj instanceof SymbolDrawer)
return Collections.singletonList((SymbolDrawer)obj);
else if (obj instanceof Icon)
... |
a7a6ae22-d991-441f-bb66-21c3da41bdcd | 8 | private void updateAccelerations(TrainsGame game)
{
// TODO combine these into a method somehow
int accelCollisions = 0;
Rectangle r = getEndBox(End.HEAD);
for (Player player : game.getPlayers())
{
if (player != this)
accelCollisions += player.checkCollisions(r);... |
979912f4-a84c-4d0d-a6b6-e2cac515af4e | 0 | public void setCardArea(int x, int y, int w, int h) {
cardArea = new Rectangle(x, y, w, h);
} |
a9d8c2eb-fabd-4194-a913-01cb5888b248 | 5 | private MaterialPattern fromMaterial(Object value) {
if (value instanceof Integer) {
Integer material = (Integer) value;
if (material > -1) {
return new MaterialPattern(material);
} else {
logger.warning("Invalid material " + material + " (mus... |
42cbbfe9-bd8c-4d1f-a403-80bb58eb6e59 | 0 | void f() {
} |
80f6f152-d900-4a62-a5a8-18424fbe178c | 4 | public void paintPage(JPanel panel, int first, int last){
Graphics canvas = panel.getGraphics();
canvas.setPaintMode();
//while in bounds
int maxX = paint.getWidth();
int maxY = paint.getHeight();
PDFTextStripper stripper;
try {
stripper = new PDFTextStripper();
stripper.setStartPage(fir... |
d8d1ce40-e9a0-44c2-844e-dce60e8d27df | 4 | @Override
public int[] getData()
{
if (ptr != 0) {
return null;
} else {
if (isConstant()) {
if (length > getMaxSizeOf32bitArray()) return null;
int[] out = new int[(int) length];
for (int i = 0; i < length; i++) {
... |
1d8d9b51-b0f3-4a23-987e-5c7b84a53fde | 3 | @Override
public void run() {
try {
if (programProcess == null
|| ProcessCheck.checkProcessEnd(programProcess))
programProcess = Runtime.getRuntime().exec(pname);
} catch (Exception e) {
// windows下面, 执行的命令如果出现异常,异常信息会乱码,尝试用了GBK等编码,还是不行
... |
226297ff-0aa7-419e-abab-8463fa211331 | 6 | private void drawCoordinateStroke(int x0, int y0, int x1, int y1)
{
for(int x = x0; x <= x1; x++)
{
for(int y = y0; y <= y1; y++)
{
if(x < width && x > 0 && y < height && y > 0)
{
image.setRGB(x, y, Color.black.getRGB());
... |
b9aa3da8-c3fe-4e3f-995a-522888d5ae69 | 0 | public void setParentLayer(Layer parentLayer) {
this.parentLayer = parentLayer;
} |
365a9974-03d7-42e0-bab7-58d6a640093a | 8 | public void actionPerformed(ActionEvent event) {
setVisible(true); // show something
Object source = event.getSource();
if (source == selectFile) {
//Enable previewer.
chooser.setAccessory(this.previewer);
chooser.addPropertyChangeListener(previewer);
... |
81558440-4b2c-4508-836e-1906c99f64d2 | 2 | public void removeOnetimeLocals() {
cond = cond.removeOnetimeLocals();
if (type == FOR) {
if (initInstr != null)
initInstr.removeOnetimeLocals();
incrInstr.removeOnetimeLocals();
}
super.removeOnetimeLocals();
} |
14a120a3-0785-4e2e-844a-4c5360b8fd20 | 0 | public void setImgName(String name){
imgName = name;
} |
bbea5c99-6eed-4bea-a22c-b2064f765f0b | 4 | private void reload() {
if (gui.connected) {
firstLoad();
try {
mainTablePane.reload();
if (referenceTable != null) {
for (TablePane reference : referenceTable) {
reference.reload();
}
firstloaded = true;
}
} catch (SQLException e) {
gui.handleSQLException(e);
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.