text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean camposobrigatoriospreenchidos() {
if (TfCodFuncionario.getText().equals("") || TfFuncionario.getText().equals("")) {
msg.CampoObrigatorioNaoPreenchido(LbNotificacao, "Informe qual funcionário realizou o atendimento nesta venda!");
TfCodFuncionario.grabFocus();
... | 8 |
void processKeyReleased(KeyEvent e) {
getModel().runKeyScript(KeyEvent.KEY_RELEASED, e.getKeyCode());
boolean b = false;
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
keyPressedCode = keyPressedCode ^ UP_PRESSED;
b = true;
break;
case KeyEvent.VK_DOWN:
keyPressedCode = keyPressedCode ^ DOWN_PRESS... | 7 |
private void initFileActions()
{
copyToOption.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
// Return value will be JFileChooser.AP... | 9 |
@Override
public void run() {
BackupFile file = DistributedBackupSystem.fManager.getFileByName(filename);
int curChunk=0;
if(file != null) {
System.out.println("File exists");
for(curChunk=0;curChunk<file.getNumChunks();curChunk++) {
try {
DistributedBackupSystem.tManager.executeTask(TaskManager.T... | 3 |
@Override
public void deserialize(Buffer buf) {
houseId = buf.readInt();
if (houseId < 0)
throw new RuntimeException("Forbidden value on houseId = " + houseId + ", it doesn't respect the following condition : houseId < 0");
modelId = buf.readShort();
if (modelId < 0)
... | 7 |
public void update() {
key.update();
if (key.up) y++;
if (key.down) y--;
if (key.left) x++;
if (key.right) x--;
} | 4 |
public void printShuffle(Graphics g) {
int q = 0;
int z = 250;
String name = null;
//basically the same code, just using the shuffled deck
for (int i = 0; i < deck.length; i++) {
if (deck[i].cardValue == 1) {
name = "A" + deck[i].suit;
} else if (deck[i].cardValue == 11) {
name = "J" + deck[i... | 6 |
public synchronized static void deletePoll(String id, String mail) {
try {
XStream xstream = new XStream(new DomDriver());
File remFile = new File((String) Server.prop.get("pollFilePath"));
Polls[] allPolls = (Polls[]) xstream.fromXML(remFile);
List<Polls> retList = new ArrayList<Polls>(Arrays.asList(a... | 4 |
protected long toLong(Object value) {
long number;
if (value instanceof Long) {
number = (Long) value;
} else if (value instanceof Integer) {
number = ((Integer) value).longValue();
} else if (value instanceof Short) {
number = ((Short) value).longValu... | 6 |
public void printList(){
System.out.println("Name: " + this.name + ", Age: " + this.age + ", Illness: " + this.illness);
if (nextPatient != patientListStart){
nextPatient.printList();
}
} | 1 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnCreate) {
int amount = 0;
try {
amount = Integer.parseInt(txfAmount.getText().trim());
}
catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(TraysCDialog.this,
"Please enter a valid number f... | 7 |
public void delete(T t) {
for(ListNode<T> node=head; node!=null&&node.next!=null; node=node.next) {
ListNode<T> nextNode = node.next;
if(nextNode.value.equals(t)) {
if(nextNode == tail) {
tail = node;
tail.next = null;
} else {
node.next = node.next.next;
}
}
}
} | 4 |
@EventHandler(ignoreCancelled = true)
public void onSignChange(final SignChangeEvent change) {
if (!change.getPlayer().hasPermission("kiosk.create")) return;
final Sign state = (Sign) change.getBlock().getState();
for (int i = 0; i < change.getLines().length; i++)
state.setLine... | 6 |
public static void initCells() throws IOException
{
GameConverter.cellStrings = new String[48];
GameConverter.cellStrings[0] = "WATER_UPLEFT_UP_UPRIGHT_LEFT_RIGHT_DOWNLEFT_DOWN_DOWNRIGHT";
GameConverter.cellStrings[1] = "WATER_UPLEFT_UP_UPRIGHT_LEFT_RIGHT_DOWNLEFT_DOWN_DOWNRIGHT_SPARKS";
GameConverter.cellStri... | 7 |
public Reserve getPieces() {
return pieces;
} | 0 |
public boolean Exist(String Tea_ID, String PassCode) {
try {
StringBuffer sql = new StringBuffer();
sql.append(" select * from teacher where");
sql.append(" tea_ID='");
sql.append(Tea_ID);
sql.append("' && teacher_Passcode='");
sql.append(P... | 2 |
@EventHandler
public void SilverfishSpeed(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSilverfishConfig().getDouble("Silverfi... | 6 |
public static String cmdInterpreter(String[] arg) {
try {
// String[] cmd = new String[arg.length + 2];
// System.arraycopy(BASH_CMD, 0, cmd, 0, BASH_CMD.length);
// System.arraycopy(arg, 0, cmd, BASH_CMD.length, arg.length);
for (String str : arg)
System.out.print(str + " ");
Process p = Runti... | 3 |
public Color getColor() {
try {
int newR = Integer.parseInt(jTextField1.getText());
int newG = Integer.parseInt(jTextField2.getText());
int newB = Integer.parseInt(jTextField3.getText());
int newA = Integer.parseInt(jTextField4.getText());
r = newR;
... | 1 |
@Override
public int hashCode() {
final int PRIME = 31;
int result = super.hashCode();
result = PRIME * result + ((attendees == null) ? 0 : attendees.hashCode());
result = PRIME * result + day;
result = PRIME * result + ((description == null) ? 0 : description.hashCode());
result = PRIME * result + endHour... | 8 |
public String getToolTip() {
return "Undoer - Click anywhere in the editor pane after clicking me.";
} | 0 |
State (String name, int id) throws IllegalArgumentException{
outgoingTransitions = new ArrayList<Transition>();
incomingTransitions = new ArrayList<Transition>();
prop = new State_Properties();
dfsNum = 0;
this.id = id;
if (name == null)
throw new IllegalArgum... | 1 |
private void checkForAsyncExecutionFailure(List<Future<?>> asyncs) throws ProcessExecutionException {
for (Future<?> async : asyncs) {
if (!async.isDone())
continue;
awaitAsyncExecution(async);
}
} | 4 |
public boolean tierraInvadida() {
NaveAlien n1;
int x = NUM_FILAS-1, y = NUM_COLUMNAS-1;
boolean tierraInvadida = false;
boolean continuarComprobando = true; //con comprobar una nave nos llega
while(x >= 0 && continuarComprobando) {
while(y >= 0 && continuarComprobando) {
n1 = listaN... | 6 |
public void setLocation_id(String location_id) {
this.location_id = location_id;
setDirty();
} | 0 |
public static void question3() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("What is your favourite day of the week?");
questionNumberLabel.setText("3");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
r... | 0 |
public boolean isCatched() {
return catched;
} | 0 |
public void addValue(String key, String errorMessage) {
if(errorMap.get(key) == null){
ArrayList<String> list = new ArrayList<String>();
list.add(errorMessage);
errorMap.put(key, list);
}
else {
errorMap.get(key).add(errorMessage);
}
} | 1 |
private DMemeGrid convertToGridB(Map mp) {
DMemeGrid grid = new DMemeGrid();
int rowIdx = 0;
int colIdx = 0;
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
Map... | 4 |
@Override
public void startElement(String s, String s1, String elementName, Attributes attributes) throws SAXException {
// if current element is book , create new book
// clear tmpValue on start of element
if (elementName.equalsIgnoreCase("book")) {
bookTmp = new Book();
... | 2 |
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... | 6 |
@Test
public void depthest21opponent5()
{
for(int i = 0; i < BIG_INT; i++)
{
int numPlayers = 6; //assume/require > 1, < 7
Player[] playerList = new Player[numPlayers];
ArrayList<Color> factionList = Faction.allFactions();
playerList[0] = new Player(chooseFaction(factionList), new SimpleAI());
... | 5 |
@Basic
@Column(name = "amount")
public double getAmount() {
return amount;
} | 0 |
public Puzzle read(String input) {
List<Integer> data = getData(input);
switch (data.size()) {
case 1:
return new Puzzle1(data);
case 4:
return new Puzzle2(data);
case 16:
return new Puzzle4(data);
case 81:
return new Puzzle9(data);
default:
throw new IllegalArgumentException("Illegal size ... | 4 |
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
} | 0 |
public BufferedImage getImage() {
return image;
} | 0 |
public SemanticRec gen_assign_cast(SemanticRec left, SemanticRec right)
{
Type leftType = getTypeFromSR(left);
Type rightType = getTypeFromSR(right);
SemanticRec returnRec = null;
if (leftType == rightType)
{
//no cast needed
returnRec = right; //the ... | 5 |
public void preCombo(){
currentComboNo--;
if(currentComboNo >= 1){
spatial.getControl(LabelControl.class).changeText(comboList());
if(comboNumber == 4){
if(StoredInfo.level < 3){
spatial.getControl(LabelContro... | 7 |
public static void main(String[] args) {
Launcher launcher = new Launcher();
launcher.initializeLogger(); // Couldn't think of anywhere else to put it
try {
launcher.showWelcomeView();
} catch(Exception ex) {
JOptionPane.showConfirmDialog(null,
"There was an error!\n" + ex.getMessage(), "Error!", JOp... | 1 |
private static boolean containsEmbeddedWhitespace(String value) {
int state = 0;
for (int i = 0, len = value.length(); i < len; i++)
switch (value.charAt(i)) {
case ' ':
case '\t':
case '\r':
case '\n':
if (state == 1)
state = 2;
break;... | 8 |
public Ray[][] initializeRays(double x, double y, double z, Screen screen, int xres, int yres){
Vector3D origin = new Vector3D(x,y,z);
Ray[][] rays;
//<= used as we want neat behaviour on bad exceptions rather than returning say a [50][0] array
if (screen ==null || xres <=0 || yres <= 0){rays = new Ray[0][0];}
... | 6 |
private void checkPause()
{
// double check
if (paused)
{
synchronized (state)
{
// Actually pausing?
if (state.has(Pausing))
{
// Pause!
state.set(Paused);
// Notify all listeners of pause.
notifier.proxy().onServicePause(this, interrupt);
// Wait for t... | 2 |
@Test
public void WhenAddingCollection_ExpectContainedSizeChange()
throws UnknownHostException {
int level = localhost_.getHostPath().length();
RoutingTable table = new RoutingTable();
table.setLocalhost(localhost_);
Assert.assertTrue(table.levelNumber() == level);
... | 1 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... | 9 |
@Override
public void connectToClient(DiscoveredClient client) {
try {
new ChatGUI(client);
} catch (IOException e) {
System.out.println("Failed to connect!");
e.printStackTrace();
}
} | 1 |
public boolean isListening() {
return listening;
} | 0 |
public void desconectar(long target) {
for (int i = 0; i < connections.getLength(); i++) {
Connection connection = connections.get(i);
if (connection.getTarget()==target) {
connection.desconectar();
connections.remove(i);
XmlToolkit.crearDe... | 2 |
public StartScreen()
{
super("Go"); // renames the top of the frame
goBackground = new ImageIcon("gopic.png"); // sets the board I made as an image icon
JPanel topPane = new JPanel(); // new jpanel
topPane.setPreferredSize(new Dimension(500, 565)); // sets the size of the panel
add(topPane, BorderLayout... | 0 |
private void getTilesInBombDir(int x, int y, int xdir, int ydir, List<Tile> tiles){
for(int i = 1; i < 4; ++i){
int xx = x + (i * xdir), yy = y + (i * ydir);
if(xx < 0 || xx >= w || yy < 0 || yy >= h) break;
Tile t = map[xx][yy];
if(t.type == Tile.CLEAR || t.type == Tile.BREAKABLE) tiles.add(t);
if(t.t... | 9 |
@Override
public ArrayList<Edge> getEdgeList()
{
if (isParsed)
{
return edges;
} else
{
initiateParsing();
return edges;
}
} | 1 |
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... | 6 |
public static int Action(Client joueur) {
int tempDette = 0;
int choiceInt = -1;
boolean wrong = true;
boolean quit = true;
do {
System.out.println("Que voulez vous faire?"
+ "\n pour dormir tapez 1"
+ "\n pour appeler le room s... | 8 |
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 fe... | 6 |
public boolean answer(int answer)
{
int answerTime = timer.getSeconds();
if (answer == getCurrentCount())
{
if (answer >= 17)
newTurn();
else
addCard();
timer.resetTimer();
timer.startTimer();
scor... | 3 |
@Override
public boolean isComponent(JsonObject jsonObject) {
return jsonObject.get("hidey") != null &&
jsonObject.get("show-mcr") != null &&
jsonObject.get("type").getAsString().equals("coord");
} | 2 |
public void saveMessage(MessageDTO messageDTO) throws DataProcessingException {
MailBox sender = mailBoxDAO.find(messageDTO.getSender());
if (sender == null) {
logger.warn("Mailbox with email " + messageDTO.getSender() + " does not exist");
throw new DataProcessingException(ExceptionType.mailBoxDoesNotExist);... | 3 |
public boolean end() {
return i == items.length;
} | 0 |
public static TypeType arrayElementTypeFor(ClassData classData) {
if (classData == refArrayClassData) {
return TypeType.REF;
} else if (classData == boolArrayClassData) {
return TypeType.BOOLEAN;
} else if (classData == byteArrayClassData) {
return TypeType.BY... | 9 |
@Test
public void testReceiveTimeout_MessageAlreadyPresent() {
try {
consumer = new AbstractMessageConsumer(mockTopic) {
};
} catch (DestinationClosedException e) {
fail("Unexpected exception on constructor");
}
assertNotNull(mockTopic.getTopicSubscriber());
try {
Message msg = new MockMessage("T... | 3 |
public double checkSpeed() {
double dx = this.getDeltaX("BALL");
speedX = hitCounter * 0.3;
if(dx < 0) {
dx = -speedX;
}
if(dx > 0) {
dx = speedX;
}
if(dx == 0) {
dx = 0.3;
}
return dx;
} | 3 |
private <T, R> R convert(ConvertType convertType, TypeConverter<T, R> typeConverter, T source, Class<R> targetClass) {
switch (convertType) {
case identity:
return (R) source;
case none:
return null; // TODO: later, return default null
case converter:
return typeConverter.convert(source);
case... | 4 |
@Override
public void init() {
log("Behave test. Usage : ant test-interactive-behave -Dpath=poly|ellipse|bspline");
log("Current parameter:"+getParam()+":");
Color stage_color = new Color(0xcc, 0xcc, 0xcc, 0xff);
Color rect_bg_color = new Color(0x33, 0x22, 0x22, 0xff);
Color rect_border_color = new Color(0, ... | 7 |
private String readString() throws EncodingException
{
int handle = readInt();
boolean inline = ((handle & 1) != 0);
handle = handle >> 1;
if (inline)
{
if (handle == 0)
return "";
byte[] data = readBytes(handle);
String str;
try
{
str = new String(data, "UTF-8");
}
catch (Uns... | 3 |
public static Iterable<FileEntry> listFilesRelativeToClass(Class<?> clazz, String subdirectory) throws IOException {
ArrayList<FileEntry> list = new ArrayList<FileEntry>();
CodeSource src = clazz.getProtectionDomain().getCodeSource();
if (src == null) {
return list;
}
... | 9 |
public static boolean reflectGraphicsEnvironmentISHeadlessInstance(Object graphicsEnvironment, boolean defaultReturnIfNoMethod) {
try {
Class clazz = graphicsEnvironment.getClass();
Method isHeadlessInstanceMethod = clazz.getMethod("isHeadlessInstance", new Class[]{});
if (is... | 3 |
@Override
public Iterator<Term> iterator() {
return new BSTIterator<Term>(this);
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> alread... | 9 |
public static boolean textureExists(String s)
{
File f = R2DFileUtility.getResource(s);
if(f.exists() && f.isFile() && f.getName().endsWith(".png"))
return true;
else
return false;
} | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Trayectoria other = (Trayectoria) obj;
if (estacionDestino == null) {
if (other.estacionDestino != null)
return false;
} else if (!estac... | 9 |
public int get_check_info()
{
int return_val = 0;
cur_phoneName = jtext_phone_name.getText().trim();
cur_phoneNum = jtext_phone_number.getText().trim();
cur_phoneAddress= jtext_address.getText().trim();
cur_phoneAddress = cur_phoneAddress.replaceAll("\n", " ");
i... | 5 |
public void printDirectedDegreeDistribution(LinkSet L){
LinkSetNode N;
L.initTreeTraversal();
Map<Integer,Integer> inDegree = new HashMap<Integer,Integer>();
Map<Integer,Integer> outDegree = new HashMap<Integer,Integer>();
Set<Integer> nodeSet = new HashSet<Integer>();
... | 7 |
public final void write(File xmlFile, ArrayList<Person> firsts,
ArrayList<Person> recurrings) throws Exception {
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
doc.setXmlSta... | 4 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Please, input arithmetic expression: ");
String equation = in.nextLine();
int counter = 0;
//go:{
for (int i = 0; i < equation.length(); i++) {
if (equation.charAt(i) == '(') {
counter++;
} else if (e... | 6 |
public static ReservaEstado create(String estado) {
ReservaEstado pedidoObject = null;
String nomeClasse = "br.com.implementacaoObserverWeb.state."
+ "PedidoEstado" + estado;
Class classe = null;
Object object = null;
try {
classe = Class.forName(nomeClasse);
object = classe.newInstance();
} catch... | 2 |
public CycList readCycList()
throws IOException {
int size = readInt();
if (trace == API_TRACE_DETAILED) {
debugNote("readCycList.size: " + size);
}
CycList cycList = new CycList(size);
for (int i = 0; i < size; i++) {
cycList.add(readObject());
}
if (trace == API_T... | 3 |
@Override
public int compareTo(Ban ban) {
// not exactly equal but already exists
if (!ban.player.equalsIgnoreCase(this.player)) {
if (this.until.after(ban)) {
return 1;
} else if (this.until.before(ban)) {
return -1;
}
... | 3 |
private static boolean isPrime( int n )
{
if( n == 2 || n == 3 )
return true;
if( n == 1 || n % 2 == 0 )
return false;
for( int i = 3; i * i <= n; i += 2 )
if( n % i == 0 )
return false;
return true;
} | 6 |
public static void main (String args[])
{
System.out.println("Welcome to the Movie List Application.");
System.out.println("There are 100 movies on the list.");
Scanner sc = new Scanner(System.in);
String choice = "y";
ArrayList<Movie> myListOfMovies = createArrayList();
... | 4 |
@EventHandler
public void onSignClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (e.getAction()==Action.RIGHT_CLICK_BLOCK||e.getAction()==Action.LEFT_CLICK_BLOCK) {
Block b = e.getClickedBlock();
if (b.getType()== Material.SIGN_POST||b.getType()==Material.WALL_SIG... | 8 |
public String value() {
return value;
} | 0 |
public static void main(String[] args) {
Utility util = new Utility();
//util.splitWords("[Not a question!] radcombobox in client side");
File indexFile = new File("d:\\hadoop-2.2.0\\etc\\hadoop\\words.txt");
File contentFile = new File("d:\\hadoop-2.2.0\\etc\\hadoop\\content.txt");
Map<String, String> indexM... | 1 |
public void attaquer(Positions pos)
{
if (this.plateau.getPlateau()[pos.getLigne()][pos.getColonne()] == EtatDesCases.LIBRE)
return;
Joueur joueurAttaque;
if (this.joueurEnCours == this.joueur1)
joueurAttaque = this.joueur2;
else
joueurAttaque = this.joueur1;
Perso persoSurPlateau = joueurAttaque.ge... | 6 |
public static PDFDecrypter createDecryptor
(PDFObject encryptDict, PDFObject documentId, PDFPassword password)
throws
IOException,
EncryptionUnsupportedByPlatformException,
EncryptionUnsupportedByProductException,
PDFAuthenticationFailureException ... | 9 |
private void processGridletSubmission(Sim_event ev)
{
if (trace_flag)
{
System.out.println(super.get_name() +
": received an SUBMIT_GRIDLET event. Clock: " + GridSim.clock());
}
/***********
We have to submit:
- the gridlet whose id c... | 8 |
@Test
public void exceededCapacityTest() {
Student student1 = null;
Student student2 = null;
try {
student1 = familyService.findStudent(1);
student2 = familyService.findStudent(2);
} catch (InstanceNotFoundException e) {
fail("Activity not exists");
}
Activity activity = new Activity("Baloncesto... | 2 |
private void resize() {
size = getWidth() < getHeight() ? getWidth() : getHeight();
width = getWidth();
height = getHeight();
if (width > 0 && height > 0) {
canvasBkg.setWidth(size);
canvasBkg.setHeight(size);
canvasFg.setWidth(size);
c... | 3 |
@Override
public List<Integer> save(List<Tourist> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Tourist bean) -> {
Object[] obj = new Object[6];
obj[0] = be... | 1 |
public Object getElement(int index) {
LinkedElement<E> elem = findElement(index);
if (elem != null) {
return elem.getObj();
}
return null;
} | 1 |
public boolean isUnity()
{
if (!isEmpty())
return first.next == null;
return false;
} | 1 |
public void move(){
if(destination != null){
if(location.x != destination.x){
if(Math.abs(location.x - destination.x) <= speed){
location.x = destination.x;
} else {
location.x += (location.x < destination.x) ? speed : -speed;
}
}
if(location.y != destination.y){
if(Math.abs(locatio... | 8 |
private void displayPlayAgain(String message) {
System.out.println("TicTacToeGameGUI::displayPlayAgain()");
int reply = JOptionPane.showConfirmDialog(null, message, message,
JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
m_game = new TicTacToeGame(m_playerOne, m_playe... | 3 |
private void loadRIBFromFile(String ribFilename) {
try {
logger.info("loading RIB from " + ribFilename);
FileReader fr = new FileReader(ribFilename);
BufferedReader br = new BufferedReader(fr);
String str = br.readLine();
int routes_total = 0;
int routes_read = 0;
while (str != null) {
... | 9 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... | 6 |
StringBuffer generateLayoutCode() {
StringBuffer code = new StringBuffer();
code.append("\t\tStackLayout stackLayout = new StackLayout ();\n");
if (stackLayout.marginWidth != 0) {
code.append("\t\tstackLayout.marginWidth = " + stackLayout.marginWidth + ";\n");
}
if (stackLayout.marginHeight != 0) {
code... | 5 |
public BiCliqueGraph findBipartiteComplementAndVertexCoverComplement(HashSet<Integer> maximalCliqueK1, HashSet<Integer> maximalCliqueK2, Graph OrigGraph)
{
//Take bipartite complement from two maximal cliques and arrange the graph with minimal memory
int clique1Size = maximalCliqueK1.size();
int clique2Size = ... | 8 |
public boolean newJudge(String one, String two) {
char[] oneChar = one.toCharArray();
char[] twoChar = two.toCharArray();
if (twoChar.length > oneChar.length + 1) {
return false;
}
for (int i = 0; i < oneChar.length; i++) {// start from c
int otherSize = i;// count other char which is not in one
bo... | 9 |
private void updateAllVQ() {
int c = movie.getCapacity();
for (int i = 0; i < numberOfAtoms; i++) {
try {
atom[i].updateVQ();
} catch (Exception e) {
atom[i].initializeVQ(c);
atom[i].updateVQ();
}
}
if (obstacles != null && !obstacles.isEmpty()) {
RectangularObstacle obs = null;
synch... | 7 |
public static void main(String[] args) throws FileNotFoundException {
Map<Integer, UserPreferences> treeMapUP = new TreeMap<Integer, UserPreferences>();
Map<Integer, ItemPreferences> treeMapIP = new TreeMap<Integer, ItemPreferences>();
readFile(treeMapUP, treeMapIP);
System.out.println("Op basis van users\... | 1 |
public int getInt(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number
? ((Number)object).intValue()
: Integer.parseInt((String)object);
} catch (Exception e) {
throw new JSONException("JS... | 2 |
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.