text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void paintInfo(Graphics2D g2) {
g2.setColor(Color.BLACK);
int x = MARGIN_X;
int y = WAVE_INFO_SPACE_TO_TOP;
g2.drawString("Current WaveNr: " + enemyGroups.getCurrentGroupNr() + " Time to next Wave " +
stringConverter((int) board.getCountdownToNextWave()), x, y)... | 1 |
public void setPrivate(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int mod = methodInfo.modifiers();
if (flag) {
mod |= Modifiers.PRIVATE;
} else {
mod &= ~Modifiers.PRI... | 2 |
int getScheduleFitness(Schedule s){
int scheduleFitness = 0;
for (RoomScheme[] schedule : s.schedule) {
for (RoomScheme sch: schedule) {
scheduleFitness += sch.getFitness();
}
} return scheduleFitness;
} | 2 |
private synchronized void resize(int newSizeColumns, int newSizeRows)
{
TerminalCharacter [][]newCharacterMap = new TerminalCharacter[newSizeRows][newSizeColumns];
for(int y = 0; y < newSizeRows; y++)
for(int x = 0; x < newSizeColumns; x++)
newCharacterMap[y][x] = new Ter... | 7 |
public void checkFields (LYNXsys system) { // check textfields method
for (int i = 0; i < system.getUsers().size(); i++) { // loop through all users
if (system.getUsers().get(i).getFirstName().equalsIgnoreCase(getFirstName().getTextField().getText()) && // if user exists (all fields match)
system.getUsers().g... | 4 |
private Map<CustomEnchantment, Integer> getValidEnchantments(ArrayList<ItemStack> items) {
Map<CustomEnchantment, Integer> validEnchantments = new HashMap<CustomEnchantment, Integer>();
for (ItemStack item : items) {
ItemMeta meta = item.getItemMeta();
if (meta == null) continue;... | 7 |
public eOrientation getOrientation() {
if (rdbHorizontal.isSelected()) {
return eOrientation.Horizontal;
}
return eOrientation.Vertical;
} | 1 |
public boolean isHurdle(int positionX, int positionY) {
boolean hasHurdle = false;
for (int i = 0; i < hurdleFactory.getQuantityOfHurdles(); i++) {
if (hurdleFactory.getHurdle(i).position.getX() == positionX && hurdleFactory.getHurdle(i).position.getY() == positionY) {
hasHur... | 3 |
public void saveStats(GameState gameState) {
queryLock.lock();
try {
for (Player player: gameState.players) {
if (player.username.equals("guest")) continue;
String command = "UPDATE players " +
"SET total_games = total_games + 1," +
"num_kills = num_kills + ?," +
"num_deaths = num_deaths +... | 5 |
public boolean checkValidate() {
boolean coma = false, parallel = false, openTok_brace = false, first = true;
int outNum = 0, inNum = 0;
// while(lex.nextToken() != null) {
while(!lex.End()) {
lex.nextToken();
Token token = lex.currentToken();
... | 9 |
public static int checkField(int luaState, Object obj, String fieldName)
throws LuaException
{
LuaState L = LuaStateFactory.getExistingState(luaState);
synchronized (L)
{
Field field = null;
Class objClass;
if (obj instanceof Class)
{
objClass = (Class) obj;
}
... | 5 |
public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder( );
int caso = 1;
for(String line; (line = in.readLine())!=null; caso++){
if(line.equals("0 0")) break;
StringTokenizer st = new StringTo... | 9 |
int zeller(final int year, final int month, final int day) {
/*
* 蔡勒(Zeller)公式: 用于推算某个日期为星期几
*
* 仅适用于1582年10月5日以及之后
* 参考:格里高利历
*
* w = ([c/4] - 2c + y + [y/4] + [13(m+1)/5] + d - 1) mod 7
*
* c = (int) (year / 100)
* y = y... | 8 |
public void UpdateProjeto(Projeto projeto) throws SQLException, ExcecaoprojetoExistente {
ProjetoDAO projetDAO = new ProjetoDAO();
Projeto projet = new Projeto();
projet = projetDAO.selectUmProjeto(projeto.getNome());
if (projet == null || projet.getIdProjeto() == projeto.getIdProjeto(... | 2 |
public void setFormula(String[] formula) {
int dim = 1;
if (formula != null)
dim = formula.length;
else
formula = new String[] { "0" };
if (numSpinner != null)
numSpinner.setCrt(dim);
if (numField != null)
numField.setText("" + dim);
this.formula = formula;
display();
} | 3 |
private void updateObservers() {
setChanged();
notifyObservers();
} | 0 |
public static <T, ID> MappedCreate<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo) {
StringBuilder sb = new StringBuilder(128);
appendTableName(databaseType, sb, "INSERT INTO ", tableInfo.getTableName());
sb.append('(');
int argFieldC = 0;
int versionFieldTypeIndex = -1;
// first we coun... | 9 |
public void var_read(String path) throws IOException {
FileInputStream is = null;
DataInputStream dis = null;
try{
is = new FileInputStream(path);
dis = new DataInputStream(new BufferedInputStream(is));
senones = (int)dis.readFloat();
gaussian = (int)dis.readFloat();
var = new float[senones][gaussi... | 6 |
@Override
public AttributeValue getExampleAttributeValue(Example e) {
int playerToken = e.getResult().currentTurn;
int opponentToken = 3 - playerToken;
int height = e.getBoard().height; // 6
int width = e.getBoard().width; // 7
int center = width / 2;
int playerScore = 0;
int opponentScore = 0;
... | 5 |
public int getSearchJumpLength()
{
_read.lock();
try
{
return _searchJumpLength;
}
finally
{
_read.unlock();
}
} | 0 |
public int longestConsecutive(int[] num) {
int result = 0;
HashMap<Integer, Integer> h = new HashMap<Integer, Integer>();
//put all number into the hashmap
for (int i = 0; i < num.length; i++) {
h.put(num[i], null);
}
//check the longest consecutive list numb... | 5 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public int total() {
int result = 0;
String separator = "";
for (Object operando : operators) {
if (operando != null) {
System.out.print(separator + operando.toString());
if (operando.getClass().getSimpleName().equals("Summation")) {
... | 3 |
public void setPositionName(String positionName) {
this.positionName = positionName;
} | 0 |
private String decodePapPassword(byte[] encryptedPass, byte[] sharedSecret) throws RadiusException {
if (encryptedPass == null || encryptedPass.length < 16) {
// PAP passwords require at least 16 bytes
logger.warn("invalid Radius packet: User-Password attribute with malformed PAP password, length = "
... | 8 |
//@Test(expected=ReaderException.class)
public void testTooManyArgumentsFail() throws ReaderException {
ConfigurationManager.init("src/test/resources/test.json");
// No key is given, the method should throw an error
ConfigurationManager.read.getItem("test_2", "doesntexist");
} | 0 |
public void sort(int[] intArray,int left,int right){
System.out.println("您调用的算法:快速排序");
//设置关键字
int key=intArray[left];
int leftFlag=left;
int rightFlag=right;
int swapTemp;
while(leftFlag != rightFlag){
//左移操作
while(intArray[rightFlag] >= key && rightFlag > 0)
rightFlag--;
swapTemp=intArray[... | 7 |
public ButtonList() {
super();
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.add(reset);
this.add(output);
this.add(help);
} | 0 |
public void moveUp() {
if (y - v > 0) {
y -= v;
} else {
y = 0;
}
} | 1 |
public List<String> getmenuItemsCategory() {
List<String> menuItemsCategory = new ArrayList<String>() {
private static final long serialVersionUID = 3109256773218160485L;
{
try {
//Connect to database
conn = DriverManager.getConn... | 7 |
@Override
public boolean isQuestionAlreadyAnswered(String userId, Long qId) {
try {
pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(User.class, ":p.contains(userId)");
List<User> result = (List<User>) query.execute(userId);
if (result.size() > 0) {
List<Long> userActivity = result.g... | 6 |
@Override
public void doMedianBlur() {
if (imageManager.getBufferedImage() == null) return;
WritableRaster raster = imageManager.getBufferedImage().getRaster();
double[][] newPixels = new double[raster.getWidth()][raster.getHeight()];
for (int x = 1; x < raster.getWidth() - 1; x++) {
for (int y = 1; y < ras... | 7 |
public void doClick(int btn, int mod) {
if(!isActual()) return;
if (UI.instance.mapview != null) {
Coord sz = UI.instance.mapview.sz;
Coord sc = new Coord((int) Math.round(Math.random() * 200 + sz.x / 2
- 100), (int) Math.round(Math.random() * 200 + sz.y / 2
- 100));
Coord oc = position();
UI.... | 2 |
@SuppressWarnings("unchecked")
@Override
public void onResponseReceived(Request request, Response response) {
if( response.getStatusCode() == HTTP_OK )
{
try {
JSONObject jsonObject = JSONParser.parseStrict(response.getText()).isObject();
if( jsonObject != null )
{
callback.onSuccess((T)deseri... | 3 |
void move() {
System.out.println("A goose is flying");
} | 0 |
@Override
public boolean connect(String host, int port) {
log.fine("Connecting to:"+host+" on Port:"+port);
if(side == Side.CLIENT) {
if(SERVER != null) {
disconnect(SERVER);
try {
SERVER.stop();
} catch(Throwable e) {
e.printStackTrace();
}
SERVER = null;
}
socket = new Co... | 5 |
public boolean AIorPlayer(){
if (getHold()>21)
AI=true;
else
AI=false;
return AI;
} | 1 |
public void runAcceptor(){
while(!Thread.interrupted()){
Socket clientSocket;
try {
clientSocket = serverSocket.accept();
} catch (IOException e) {
LOG.severe("Error while waiting for client-connection! " + e.getMessage());
brea... | 3 |
public int namespace(String title) throws IOException
{
// sanitise
title = title.replace('_', ' ');
if (!title.contains(":"))
return MAIN_NAMESPACE;
String namespace = title.substring(0, title.indexOf(':'));
// all wiki namespace test
if (namespace.equal... | 7 |
public void basicSetWorkout(Workout myWorkout) {
if (this.workout != myWorkout) {
if (myWorkout != null){
if (this.workout != myWorkout) {
Workout oldworkout = this.workout;
this.workout = myWorkout;
if (oldworkout != null)
oldworkout.unsetParcours();
}
}
}
} | 4 |
protected void mapChildrenKeys(Set<String> output, ConfigurationSection section, boolean deep) {
if (section instanceof MemorySection) {
MemorySection sec = (MemorySection) section;
for (Map.Entry<String, Object> entry : sec.map.entrySet()) {
output.add(createPath(sectio... | 5 |
public EquationsHard()
{
this.multiply = getRandomBool();
x = randomNumber(1, Game.getHardness().getMaxNumb());
y = x * randomNumber(1, Game.getHardness().getMaxNumb() / 2);
// result * x = y; -> result = y / x;
if (multiply)
result = y / x;
// resul... | 1 |
public int getRandomNumber(int min, int max) {
return (int) Math.floor(Math.random() * (max - min + 1)) + min;
} | 0 |
@Override
public boolean equals(Object obj)
{
boolean res = false;
if (obj instanceof TableEntry)
{
TableEntry other = (TableEntry) obj;
if(other.tableName.equals(tableName))
{
if(other.dbId.equals(dbId))
{
res = true;
}
}
}
return res;
} | 3 |
private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... | 6 |
protected static void formatTimeDifference(long diff, StringBuilder b){
//--Get Values
int mili = (int) diff % 1000;
long rest = diff / 1000;
int sec = (int) rest % 60;
rest = rest / 60;
int min = (int) rest % 60;
rest = rest / 60;
int hr = (int) rest % 24;
rest = rest / 24;
int ... | 9 |
public Component getTreeCellEditorComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row) {
JCheckBox editor = null;
filter = getFilterOut(value);
if (filter != null) {
node = (DefaultMutableTreeNode) value;
editor = (JCheckBox) (super.getComponent());
ed... | 3 |
public List<Venda> listarTodas() throws Exception{
try{
PreparedStatement comando = conexao
.getConexao().prepareStatement("SELECT * FROM vendas WHERE ativo = 1");
ResultSet consulta = comando.executeQuery();
comando.getConnection().commit();
... | 2 |
public void insert(String table, ArrayList<String> fields, ArrayList<String> values) {
if(fields != null) if(fields.size() != values.size()) throw new IllegalArgumentException("The number of fields and values must correspond.");
String tableString = "`" + table + "`";
String fieldsString = fiel... | 4 |
protected Automaton getAutomaton() {
return automaton;
} | 0 |
public Game() {
board = new Board(2,4,4, new Random().nextInt(4), new Random().nextInt(4));
} | 0 |
private String checkType(Nodo chk){
String res=new String();
switch(chk.getToken()){
case Identificador:
res+=this.genCode(Nodo.KindToken.ID,((Nodo)chk.getNodo().iterator().next()),chk.getDato());
break;
case PalabraReservada:
if(ch... | 9 |
public static boolean validCastle(int myXCoor, int myYCoor, int targXCoor, int targYCoor){
if (myYCoor != targYCoor)
return false;
else{
if (myXCoor < targXCoor){
for (int i = myXCoor+1;i<targXCoor;i++){
if ( !(board.isEmpty(i,myYCoor)) ){
return false;
}
}
return true;
}
els... | 7 |
public List<V> put(K key, List<V> value) {
return this.map.put(key, value);
} | 0 |
protected void stepFWDCalc(boolean showSteps) {
if (m_currentStep == 0) {
m_btnSetOne.setEnabled(false);
m_btnSetTwo.setEnabled(false);
m_btnSetGapOne.setEnabled(false);
m_btnSetGapTwo.setEnabled(false);
m_btnPrev.setEnabled(true);
m_btnBeginning.setEnabled(... | 8 |
public static Dimension resizeToArea(int width, int height, long newArea) {
double x1 = (double) width;
double y1 = (double) height;
double a1 = (double) (x1 * y1);
double a2 = (double) newArea;
double s = (float) Math.sqrt((a2/a1));
double x2 = x1 * s;
double y2 = y1 * s;
int newX = (int) Math.ro... | 0 |
public String GetCurrentLine(int pindex) {
int tindex = pindex;
if (pindex >= length) {
tindex = length - 1;
}
while ((tindex > 0 )&& (iExpr.toCharArray()[tindex] != '\n')) {
tindex--;
}
if (iExpr.toCharArray()[tindex] == '\n') {
tinde... | 6 |
public void pokupiPodatke()
{
if(rdbtnOracle.isSelected()) {
tip = textField_Host.getText() + " - Oracle";
kon = new OracleKonekcija(textField_User.getText(), textField_Pass.getText(), textField_Host.getText(), textField_Port.getText(), textField_dbName.getText());
}
else if(rdbtnPostgresql.isSelected()) ... | 3 |
public static void main(String[] args) {
//first, let's populate the list of primes.
int a = 0, b = 2;
while (a < 1000) {
if (isPrime(b))
some_primes[a++] = b;
b++;
}
// -------------------------------------- //
... | 4 |
public ConvertPDAToGrammarAction(AutomatonEnvironment environment) {
super(environment);
} | 0 |
public void setDayBordersVisible(boolean dayBordersVisible) {
this.dayBordersVisible = dayBordersVisible;
if (initialized) {
for (int x = 7; x < 49; x++) {
if ("Windows".equals(UIManager.getLookAndFeel().getID())) {
days[x].setContentAreaFilled(dayBordersV... | 3 |
private void editorKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_editorKeyTyped
if ((evt.isControlDown() && (evt.getKeyChar() == (char) 24 || evt.getKeyChar() == (char) 22)) || (!evt.isActionKey() && !evt.isControlDown() && !evt.isAltDown())) {
updateLineNum();
if (saved) {
s... | 7 |
public int[][] getImagePixels(BufferedImage image) {
int w = image.getWidth(null);
int h = image.getHeight(null);
int[] tmpPixels = new int[w * h];
image.getRGB(0, 0, w, h, tmpPixels, 0, w);
int[][] pixels = new int[w][h];
for(int y = 0; y < h; y++) {
... | 2 |
public void setResolution(Dimension res) {
this.res = res;
if (res != null)
resolution.setText(res.width+"x"+res.height);
else
resolution.setText(" ");
} | 1 |
public static Direction getByMovement(int xa, int ya) {
if (xa < 0) return LEFT;
if (xa > 0) return RIGHT;
if (ya < 0) return UP;
if (ya > 0) return DOWN;
return NONE;
} | 4 |
private boolean checkIsCreate(String stype, GameDescription game, ArrayList<SpriteData> allSprites){
for(SpriteData sprite:allSprites){
if(spawnerTypes.contains(sprite.type) && sprite.sprites.contains(stype)){
return true;
}
for(SpriteData sprite2:allSprites){
ArrayList<InteractionData> data = ga... | 7 |
private void selectFire() {
squareSelector.reset();
squareSelector.setCriteria(new SquareCriteria() {
private final String desc = "Select: Fire";
public String getDescription() { return desc; }
public boolean isSquareValid( SquareSelector squareSelector, int roomId, int squareId ) {
if ( roomId < 0 |... | 8 |
public ResultSet searchEngineInfo(String patient_info){
try{
if(Helper.isInteger(patient_info)){
String testRecordQuery =
"SELECT p.name, p.health_care_no, t.patient_no, t.employee_no, " +
"t.test_id, t.type_id, tt.type_id, tt.test_name, t.test_date, t.result " +
"FROM patient p, test_record t, te... | 2 |
public void setId(Integer id) {
this.id = id;
} | 0 |
private boolean isValidInput(final String s) {
return s.matches("[1-9]{1}");
} | 0 |
public static MultiSearcher wrapSearcher(final Searcher s, final int edge)
throws IOException {
// we can't put deleted docs before the nested reader, because
// it will through off the docIds
Searcher[] searchers = new Searcher[] {
edge < 0 ? s : new IndexSearcher(makeEmptyIndex(0), true),
... | 6 |
public void addPatient(Patient newPatient) {
if (this.nextPatient == null) {
this.nextPatient = newPatient;
} else {
this.nextPatient.addPatient(newPatient);
}
} | 1 |
public void Eliminar(String pArchivo) throws Exception {
try {
//Se elimina el archivo
File fichero = new File(pArchivo);
if (!fichero.delete())
//Si no encuentra el archivo se muestra la excepcion
throw ... | 2 |
public boolean authenticate(String email, String hash)
{
initConnection();
//Check password matches for given email
String preparedString = null;
PreparedStatement preparedQuery = null;
try
{
//Prepare Statement
preparedString = "SELECT email,password FROM users WHERE email = ? AND password = ?;... | 3 |
boolean showDialog(final ImagePlus imp, final String[] list) {
final int fileCount = list.length;
String name = imp.getTitle();
if (name.length() > 4 &&
(name.substring(name.length() - 4, name.length()))
.equalsIgnoreCase(".tif"))
{
name = name.substring(0, name.length() - 4);
}
int i = name.leng... | 9 |
public Object tooltip(Coord c, boolean again) {
long now = System.currentTimeMillis();
if (!again) hoverstart = now;
if ((now - hoverstart) < 1000) {
if (shorttip == null) {
String tip = shrtTip();
if (tip == null) return null;
shorttip = RichText.render(tip, 200);
}
return (shorttip);
}... | 6 |
public SharedTorrent getTorrent() {
return this.torrent;
} | 0 |
static List<String> splitCSVLine(List<String> buf, String line){
Stream.of(line.split(";")).map(String::trim).forEach(buf::add);
if (line.endsWith(";")) {
buf.add("");
}
return buf;
} | 1 |
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in,
com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException {
super.loadFields(__in, __typeMapper);
__in.peekTag();
if (__typeMapper.isElement(__in, Case__typeInfo)) {
... | 9 |
@Override
protected void onReceive(String message) {
System.out.println("Received message: \"" + message + "\"");
Message msg = Message.parse(message);
switch(msg.getType()) {
case ID_RESPONSE:
//TODO handle id
break;
case SPAWN:
//TODO spawn entity
break;
case DESPAWN:
//TODO despaw... | 6 |
@Override
public boolean onCommand(final CommandSender sender,final Command command,final String label,final String[] args) {
if (args.length <= 1) {
return false;
}
final OfflinePlayer player = this.plugin.getServer().getOfflinePlayer(args[0]);
if (player == null) {
... | 6 |
@Override
public List<AssemblyLine> generate(Context context)
{
final List<AssemblyLine> lines = Lists.newLinkedList();
if (Compiler.debug)
{
lines.add(new Comment("Start condition term"));
}
if (children.size() == 1)
{
context.set... | 8 |
@RequestMapping(value = "/event-branch-room-event-list/{eventBranchId}", method = RequestMethod.GET)
@ResponseBody
public RoomEventListResponse eventBranchRoomEventList(
@PathVariable(value = "eventBranchId") final String eventBranchIdStr
) {
Boolean success = true;
String errorM... | 1 |
public static void chplft_draw_bg(osd_bitmap bitmap, int priority) {
int sx, sy, offs;
int choplifter_scroll_x_on = (system1_scrollx_ram.read(0) == 0xE5 && system1_scrollx_ram.read(1) == 0xFF) ? 0 : 1;
if (priority == -1) {
/* optimized far background */
/* for every ch... | 9 |
public static void displayURL(String url)
{
if (url == null || url.length() == 0)
{
url = "http://www.google.com";
}
boolean windows = isWindowsPlatform();
String cmd = null;
try
{
if (windows)
{
// cmd = 'rundll32 url.dll,FileProtocolHandler http://...'
/*
* Rundll32 doesn't like .... | 8 |
@Override
public String toString() {
StringBuffer stringBuffer = new StringBuffer();
for(int row = 0; row < getRowSize(); row++) {
for(int column = 0; column < getColumnSize(); column++) {
Integer move = getMoveAt(row, column);
String
... | 3 |
public static ComponentUI createUI(JComponent c) {
return new MetalScrollBarUI();
} | 0 |
public static boolean isSpecialTrainer(Trainer t)
{
switch(t.type)
{
case JAVA:
if(t.name.equals("BOSS"))
return true;
else
return false;
case BABB:
case ELITE:
case GYM_LEADER:
case RIVAL:
return true;
default:
return false;
}
} | 6 |
public boolean smartClick(){
boolean isClicked=isEnabled();
if(isClicked){
click();
}
return isClicked;
} | 1 |
public void removeAll() {
for (int i = 0; i < items.size(); i++) {
items.remove(i);
}
for (int i = 0; i < backgroundParticles.size(); i++) {
backgroundParticles.remove(i);
}
for (int i = 0; i < entities.size(); i++) {
entities.remove(i);
}
for (int i = 0; i < projectiles.size(); i++) {
pro... | 6 |
public String getType() {
if (this instanceof ItemCoupon) return "Item";
if (this instanceof EconomyCoupon) return "Economy";
if (this instanceof RankCoupon) return "Rank";
if (this instanceof XpCoupon) return "Xp";
else
return null;
} | 4 |
public void calcPhaseDeviation() {
// saves the result of the FFT in an object that contains the spectrum,
// real and imaginary part.
FFTComponents components = this.nextPhase();
double[] phase = new double[components.real.length];
double[] previousPhase = new double[components.real.length];
double[] anteP... | 7 |
@Override
public void update(Observable o, Object value)
{
if (o instanceof RecordManager)
{
updateLastNames(RecordManager.getInstance().getUniqueLastNames());
final GivingRecord selectedRecord = RecordManager.getInstance().getSelectedRecord();
if (selectedRec... | 9 |
private static String loadSiteUID(){
String uid = DEFAULT_SITE_USER_ID;
try{
FileInputStream fis = new FileInputStream(workingDir + SITE_UID_FILE_NAME);
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
try {
uid = reader.readLine();
} catch (IOException e) ... | 3 |
public void run(){
// If we have a list of replies from a previous repetition
// calculate suspected processes
if (lastHeartbeat != 0) {
for(int i = 0; i <= p.getNo(); i++) {
if (i != 0 && i != p.pid) {
if (!successfulReplies[i-1] && !suspectedProcesses[i-1]) {
... | 6 |
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
// totaal hoeveelheid van alle kleuren
int total = 0;
int startAngle = 0;
int arcAngle = 0;
for (Color color: stats.keySet())
{
// teller van alle kleuren worden bij elkaar opgeteld
total += stats.get(color).getCount... | 3 |
private ConcatExpr parseConcatExpr(Vector<String> tokens, int lo, int hi) {
ConcatExpr expr = new ConcatExpr();
for (int i = lo; i < hi; i++) {
String v = tokens.get(i);
if (v.length() >= 2 && v.charAt(0) == '<' && v.charAt(v.length() - 1) == '>') {
expr.addItem(v.substring(1, v.length() - 1... | 4 |
public RealDistribution realisedDemand(int t, int k) throws ConvolutionNotDefinedException{
//check if k is lower or equal than t-l_max, then all orders will be open
if (k <= t-getMaxOrderLeadTime()) return new RealSinglePointDistribution(0.0);
//check if k is bigger than t, then all orders will be realised
... | 3 |
Message getMessage(double x, double y) {
Message result = null;
for (Edge edge : edges)
for (Message message : edge.queue.getMessages()) {
if (message.isOnPoint(x, y)
&& (result == null || message.position < result.position))
result... | 5 |
private static int getAttribute(Node node, String attribname, int def) {
final String attr = getAttributeValue(node, attribname);
if (attr != null) {
return Integer.parseInt(attr);
} else {
return def;
}
} | 1 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.