text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static void launch_missile(War war) {
if (war.getLaunchers().isEmpty()) {
System.out.println("\n\tNo available Launchers");
} else {
EnemyLauncher user_launcher = null;
System.out.println("Destination of the missile: ");
String destination = scanner.nextLine();
System.out.println("Damage of t... | 5 |
private int readEscape(int c) throws IOException {
// assume c is the escape char (normally a backslash)
c = in.read();
int out;
switch (c) {
case 'r':
out = '\r';
break;
case 'n':
out = '\n';
break;
... | 5 |
public int getPixel(int x, int y) {
if (x < 0 || x >= width || y < 0 || y >= height)
return -1;
return pixels[x + y * width];
} | 4 |
public void updateColors() {
for(int y = 0; y < 9; y++) {
for(int x = 0; x < 9; x++) {
int value = MainMenu.game.getBoard().getTile(x, y).getValue();
//If there is a value in the tile
if(value > 0) {
//and it is not a tile that cannot be update... | 8 |
@Override
public void mouseMoved(MouseEvent e) {
mx = e.getX();
my = e.getY();
//TODO Delete this soon...
if(e.getSource() == home) {
fractionInfo();
} else if(e.getSource() == host) {
decimalInfo();
} else if(e.getSource() == join) {
integerinfo();
} else if(e.getSource() == refresh) {
mi... | 4 |
@GET
@Path("/userlogin")
@Produces("text/xml")
public Response getUser(@QueryParam("username") String username, @QueryParam("password") String password) {
User user = db.getUser(username);
if(user != null) {
boolean validUser = db.validate(user, password);
if(validUser) {
token = nextSessionId();
A... | 2 |
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
CategoryPlot cp = getPlot();
if (cp == null) {
return null;
}
if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {
CategoryDataset dataset = cp.getDataset(datasetIndex);
... | 8 |
protected boolean collision(double xa, double ya) {
boolean solid = false;
for (int c = 0; c < 4; c++) {
double xt = ((x + xa) - c % 2 * 15) / 16;
double yt = ((y + ya) - c / 2 * 15) / 16;
int ix = (int) Math.ceil(xt);
int iy = (int) Math.ceil(yt);
if (c % 2 == 0) ix = (int) Math.floor(xt);
if (c ... | 5 |
private void tworzNowaGre() {
campaign.setIntroText(projectTabPane.introTextList);
campaign.setOutroText(projectTabPane.outroTextList);
campaign.setGameTitle(projectTabPane.getGameTitle());
campaign.setGameDate(projectTabPane.getGameDate());
campaign.setIntroPics(rewriteJListToArrayList(projectTabPane.introPi... | 2 |
public T dequeue() {
if (isEmpty())
throw new QueueUnderflowException("Helpful msg.");
T ans = front.getInfo();
front = front.getLink();
if (front == null)
rear = null;
return ans;
} | 2 |
private boolean playSound(File file) {
boolean ret = false;
AudioInputStream in = null;
try {
in = AudioSystem.getAudioInputStream(file);
} catch (Exception e) {
logger.log(Level.WARNING, "No audio input stream for: "
+... | 7 |
public Move chooseMove(State s) {
// remember who we are (evalState likes to know that)
me = s.whoseTurn();
// get a list of possible moves
MyList moves = s.findMoves();
// return if there are no moves
if (moves.size() == 0)
return null;
// introduce some randomness
Collections.shuffle(moves);
// Ite... | 3 |
public void findWeights(int row, double[][] mean){
double[] neww = new double[m_Dimension];
double[] oldw = new double[m_Dimension];
System.arraycopy(m_Change[row], 0, neww, 0, m_Dimension);
//for(int z=0; z<m_Dimension; z++)
//System.out.println("mu("+row+"): "+origin[z]+" | "+newmu[z]);
doubl... | 9 |
public String[] getAttributeNames() {
String[] s = new String[attributes.length];
for (int i = 0; i < attributes.length; i++) {
s[i] = attributes[i].name;
}
return s;
} | 1 |
public MakeCommandTree() throws CreateCMDTreeErrorException
{
CMDLIST = new HashMap< String, Integer >();
IfStack = new Stack< CommandNode >();
WhileStack = new Stack< CommandNode >();
SwitchStack = new Stack< Byte >();
CMDLIST.put( "if", 1 );
CMDLIST.put( "else", 2 );
CMDLIST.put( "endif", 3 );... | 6 |
public dbConn(String FD)
{
try
{
lstPeople = new LinkedList<People>();
this.fdName = FD;
this.connection = DriverManager.getConnection("jdbc:sqlite:" + FD );
this.connected = true;
this.statement = connection.prepareStatem... | 2 |
public synchronized void addBooks(Set<StockBook> bookSet)
throws BookStoreException {
if (bookSet == null) {
throw new BookStoreException(BookStoreConstants.NULL_INPUT);
}
// Check if all are there
for (StockBook book : bookSet) {
int ISBN = book.getISBN();
String bookTitle = book.getTitle();
St... | 9 |
private void initListeners() {
ToolsTableListener listener = new ToolsTableListener(toolsTable, toolsTableModel, this);
toolsTable.getSelectionModel().addListSelectionListener(listener);
toolsTable.addMouseListener(listener);
toolsTable.addMouseMotionListener(listener);
server... | 7 |
private int[][] readSamples(ByteBuffer buf) {
// calculate the number of samples in the table
int size = 1;
for (int i = 0; i < getNumInputs(); i++) {
size *= getSize(i);
}
// create the samples table
int[][] samples = new int[size][getNumOutputs()];
... | 7 |
void workLift() {
/*
* this replaces togglelift - after hugh's helpful comments
*/
if (cloud != null || circuit != null) return;
Hill h = null;
if (app.landscape != null) h = app.landscape.getHillAt(flyingDot.p);
if (h != null) {
setCircuit(h.getC... | 6 |
public static String readConfig(String key) {
String propertyValue = null;
try {
if (config == null) {
initialize();
}
propertyValue = config.getProperty(key);
} catch (Exception exception) {
exception.printStackTrace();
}
return propertyValue;
} | 2 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
if (active(request)) //if there is an active user
{
if (request.getRequestURI().equals(request.getContextPath() + "/following")) //if no string occurs after following/
{
List<User... | 3 |
public void setEditable(boolean editable) {
for (int d1 = 0; d1 < dimension; d1++) {
for (int d2 = 0; d2 < dimension; d2++) {
pIn[d1][d2].setEditable(editable);
}
}
} | 2 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 5 |
public double[] instanceToSchema(Instance inst,
MiningSchema miningSchema) throws Exception {
Instances miningSchemaI = miningSchema.getMiningSchemaAsInstances();
// allocate enough space for both mining schema fields and any derived fields
double[] result = new doub... | 7 |
private void populateForm()
{
if(this.group.getId() > 0)
{
//txtName.setText(this.group.getName());
this.name = this.group.getName();
this.level_id = this.group.getLevel().getId();
this.teacher = this.group.getTeacher();
this.capacity = this.group.getCapacity();
this.schedule_list = this.group.ge... | 1 |
private void sort(int[] array){
for(int i = 1; i<array.length; i++ ){
int minInd = i-1;
for(int j = i; j<array.length; j++){
if(array[minInd] > array[j]){
minInd = j;
}
}
swap(array, minInd, i-1 );
}
... | 3 |
public static int ladderLength2(String start, String end, Set<String> dict) {
List<String> nodes = new ArrayList<String>();
nodes.add(start);
nodes.add(end);
for (String val : dict) {
if (!nodes.contains(val)) nodes.add(val);
}
List<GraphNode> graph = generateGraph(nodes);
//pri... | 8 |
private void computeAverageClassValues() {
double totalCounts, sum;
Instance instance;
double [] counts;
double [][] avgClassValues = new double[getInputFormat().numAttributes()][0];
m_Indices = new int[getInputFormat().numAttributes()][0];
for (int j = 0; j < getInputFormat().numAttributes();... | 8 |
public void start() {
System.out.println("************************************************************************");
System.out.println(" AddressBook ");
System.out.println(" *A:add new User Address ");
Syste... | 8 |
public String execute(Map<Integer, Record> records) {
Record rec = records.get(this.recordID);
boolean ok = false;
if (super.subject.charAt(0) == 'N') {
if (super.subject.equals(rec.nurseID) || super.departmentID.equals(rec.departmentID)) {
ok = true;
}
} else if (super.subject.charAt(0) == 'D') {
... | 8 |
public void setVolumePercentage(int percentage) {
if((percentage <= 100) && (percentage >= 0)) {
mediaPlayer.setVolume(percentage);
}
else {
System.err.println("Cannot supply a volume below 0 or above 100");
}
} | 2 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Set<MOB> h=properTargets(mob,givenTarget,false);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth floating."));
return false;
}
if(!super.invoke(mob,commands,... | 7 |
@Override
public void forcePeaceAllFightingAgainst(final MOB mob, final Set<MOB> exceptionSet)
{
final Room R=mob.location();
if(R==null)
return;
for(Enumeration<MOB> m=R.inhabitants();m.hasMoreElements();)
{
final MOB M=m.nextElement();
if((M!=null)
&&(M.getVictim()==mob)
&&(M!=mob)
&&((exc... | 7 |
public static void main(String[] args) throws IOException {
System.out.println();
System.out.println("Start Time: " + new Timestamp(System.currentTimeMillis()));
long startTime = System.currentTimeMillis();
_testSet.clear();
for (int i = 0; i < args.length; ++i) {
if (args[i].equals("-f")) test(new File(args[... | 6 |
private void searchPaths(Graph graph, Object start, Object searched,
ArrayList<Object> visited) {
if (visited == null) {
visited = new ArrayList<Object>();
visited.add(start);
}
ArrayList<Object> nodes;
if (visited.get(visited.size() - 1) instanceof Station) {
nodes = ((Station) (visited.get(visit... | 9 |
public int insertEmployee(Employee emp) throws UnauthorizedUserException,
BadConnectionException, DoubleEntryException {
String username;
username = generateEmpUsername(emp.getFirstName(), emp.getLastName(), emp.getPhone());
try {
PreparedStatement pStmnt = con.... | 8 |
@Test
public void conwaySimple1() {
x = 3;
y = 3;
rule = new RuleSet("23/3");
grid = new Grille(x, y, rule);
boolean[][] originalValue = {{true, false, true}, {false, false, false}, {true, false, true}};
grid.setBooleans(originalValue);
Grille expectedGrid =... | 0 |
public Memory(int size, int instructionsStartAddress, int dataStartAddress, int accessTime) {
if (size < 128 || size > 4194304)
throw new IllegalArgumentException("Memory size must be greater than 128B and less than 4MB");
if (!Helpers.isPowerOf2(size))
throw new IllegalArgumentException("Memory size (" + ... | 7 |
public String toString() {
String[] colors = { "Rot", "Gruen", "Blau" };
String result = "";
for (int c = 0; c < 3; c++) {
result += "Die " + colors[c] + "-Werte des Bildes: \n";
for (int x = 1; x <= width; x++) {
for (int y = 1; y <= height; y++) {
result += Math.round(getPixel(x, y, c) * 1000) / ... | 3 |
public boolean doT2(FlowBlock succ) {
/*
* check if this successor has only this block as predecessor. if the
* predecessor is not unique, return false.
*/
if (succ.predecessors.size() != 1 || succ.predecessors.get(0) != this)
return false;
checkConsistent();
succ.checkConsistent();
if ((GlobalO... | 6 |
private double testDynamicArrayInserts(int inserts) {
System.out.println("Testing dynamicArray with " + inserts + " inserts");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
dynamicArray = new DynamicArray();
st... | 3 |
public int getTargetX() {
return targetX;
} | 0 |
@Override
public void run(){
while(true){
try {
sock = server.accept();
String IP = returnIP(sock.getRemoteSocketAddress().toString());
InstantMessenger.remUser = db.getName(IP);
System.out.println(InstantMessenger.remUser);
... | 4 |
public boolean check() {
boolean good = true;
good = (good ? checkForRequiredHeaders() : false);
good = (good ? checkForSubscription() : false);
good = (good ? checkForEncryption() : false);
good = (good ? Category.checkForLegalCategory(aThis.headerMap) : false);
good = (... | 8 |
private static void drawCards(GameState state, ArrayList<Integer> availibleCards,
int numCards)
{
if(availibleCards.size() < numCards)
{
throw new RuntimeException("not enough cards to draw from the deck!");
}
Random cardPicker = new Random();
for(int i = 0; i < numCards-1; i++)
{
int card ... | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SiteBoundaryCategory)) {
return false;
}
SiteBoundaryCategory other = (SiteBoundaryCategory) object;
if ((this.... | 5 |
public static char[] rotate(char[] state, Character face, int turns) {
// Turning it by any number of turns mod 4 would be wasting CPU cycles
if (turns % 4 == 0) {
return state;
}
int[] thisFace = FACES.get(face);
int[] theSides = Cube.SIDES.get(face);
// Error checking to verify that the given character... | 3 |
private void parseRequestParameterFromString(String string) {
// /this/is/the/path?name1=value1&name2=value2....
while (string.length() > 0) {
int indexEqual = string.indexOf("=");
int indexNext = string.indexOf("&");
if (indexEqual == -1) {
break;
}
String paramName = string.substring(0, indexEq... | 4 |
public void visit_if_icmplt(final Instruction inst) {
if (longBranch) {
final Label tmp = method.newLabel();
addOpcode(Opcode.opc_if_icmpge);
addBranch(tmp);
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
addLabel(tmp);
} else {
addOpcode(Opcode.opc_if_icmplt);
addBranc... | 1 |
public static File findCurrentModuleDir(String directory)
{
// will find something by traversing up
File current = new File(directory);
if (current.getName().equalsIgnoreCase("."))
{
// strange bugfix here...
current = current.getParentFile();
}
... | 7 |
public static String post(String url, List<NameValuePair> params) {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
if (params != null) {
try {
httpPost.setEntity(new UrlEncodedFormEntity(params,"UTF-8"));
} catch (UnsupportedEncodingException e) {
... | 5 |
@Override
public void keyReleased(KeyEvent e) {
if(e.getKeyCode()==KeyEvent.VK_LEFT||e.getKeyCode()==KeyEvent.VK_A)left=false;
if(e.getKeyCode()==KeyEvent.VK_RIGHT||e.getKeyCode()==KeyEvent.VK_D)right=false;
if(e.getKeyCode()==KeyEvent.VK_UP||e.getKeyCode()==KeyEvent.VK_W)up=false;
if(e.getKeyCode()==KeyEvent.... | 8 |
void killErosion(int x, int y, GameWorld gw) {
gw.map[y][x].erosion += 20;
if (gw.map[y][x].erosion > 100 && gw.map[y][x].type != Tile.Type.PIT) {
lp: for (int dy = -1; dy < 2; dy++) {
if (y + dy < 0 || y + dy >= gw.map.length) { continue; }
for (int dx = -1; dx < 2; dx++) {
if (x + dx < 0 || x + dx... | 9 |
private boolean jj_3R_30() {
if (jj_3R_31()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3_13()) { jj_scanpos = xsp; break; }
}
return false;
} | 3 |
public AnefodiasmoiAdd() {
/* kartela prosthikis anefodiasmwn*/
con = new Mysql();
setTitle("Prosthiki Anefodiasmou"); //titlos para8yrou
/* vgazei to para8uro sto kedro tis othonis me diastaseis 300x220 */
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
this.setBounds(dim.width/2-150, dim.heig... | 1 |
public static boolean deleteUnit(String name) {
if(listUnits.containsKey(name)) {
Unit unit = listUnits.get(name);
if(unit instanceof ReferenceUnit) {
if(unit.getType().getUnits().size() > 1) {
// si le type à d'autres... | 3 |
public void visitMemRefExpr(final MemRefExpr expr) {
if (expr instanceof FieldExpr) {
visitFieldExpr((FieldExpr) expr);
} else if (expr instanceof StaticFieldExpr) {
visitStaticFieldExpr((StaticFieldExpr) expr);
} else if (expr instanceof ArrayRefExpr) {
visitArrayRefExpr((ArrayRefExpr) expr);
}
} | 3 |
public static void main(String[] args) throws Exception {
boolean mt = false;
for(int c=0; c<2; c++) {
long lall = 0, tall = 0;
for(File f : new File("resources/testdata/").listFiles()) {
RandomAccessFile raf = new RandomAccessFile(f, "r");
byte[] data = new byte[(int) raf.length()];
raf.read... | 5 |
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... | 6 |
private static Node index(Node left, Node right)
{
try
{
Object collection = left.getArgument().asObject();
Object result;
if (collection.getClass().isArray())
{
int index = getIndex(right, Array.getLength(collection));
result = Array.get(collection, index);
}
else if (collection instance... | 5 |
public StdImage createDragImage(Point dragOrigin) {
Graphics2D gc = null;
StdImage off2 = null;
mDrawingDragImage = true;
mDragClip = null;
StdImage off1 = createImage();
mDrawingDragImage = false;
if (mDragClip == null) {
mDragClip = new Rectangle(dragOrigin.x, dragOrigin.y, 1, 1);
}
try {
off2... | 4 |
public byte[] toByteArray(){
try{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
out = new ObjectOutputStream(bos);
out.writeObject(this);
byte[] yourBytes = bos.toByteArray();
try{
bos.close();
out.close();
}catch(Exception e){System.out.println("A M... | 2 |
protected void loadReactionlikeEvent2Input() {
String name = "ReactionlikeEvent_2_input";
String fileName = dirName + name + ".txt";
if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'");
int i = 1;
for (String line : Gpr.readFile(fileName).split("\n")) {
// Parse line
String re... | 7 |
private void drawMenu() {
int i = menuOffsetX;
int j = menuOffsetY;
int k = menuWidth;
int l = anInt952;
int i1 = 0x5d5447;
Graphics2D.fillRect(l, j, i, i1, k);
Graphics2D.fillRect(16, j + 1, i + 1, 0, k - 2);
Graphics2D.drawRect(i + 1, k - 2, l - 19, 0, j... | 8 |
public static ArrayList<Achievement> updateAchievement(User user) {
ArrayList<Achievement> records = AchievementRecord.getAchievementsByUserID(user.userID, PRACTICE_TYPE);
ArrayList<Achievement> newAchievements = new ArrayList<Achievement>();
for (int i = 0; i < getAllAchievements().size(); i++) {
Achievement ... | 5 |
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "kick", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
if (args.length == 0)
return false;
String msg = plu... | 8 |
public double scale(double i){
if(i>0){
i = (i-0.1)*10.0/9.0;
if(i < 0)
i = 0;
}
else if(i<0){
i = (i+0.1)*10.0/9.0;
if(i > 0)
i = 0;
}
return i;
} | 4 |
private boolean argumento() {
//<argumento> ::= <id> <compl_tipo_parametro>
//<compl_tipo_parametro> ::= <acesso_campo_registro> | <acesso_matriz>| <chamada_funcao> | λ
//<acesso_campo_registro> ::= ”.” <id>
//<acesso_matriz> ::= “[“ <indice> “]” <acesso_matriz> | λ
//<indice> :... | 8 |
public int intern(Object k){
int hash = hash(k);
int mask = cap - 1;
int bkt = (hash & mask);
int bhash = hopidx[bkt<<2];
int slot;
Object bkey;
if(bhash == 0)
slot = bkt << 2;
else
{
if(hash == bhash)
{
bkey = keys[hopidx[(bkt<<2) + 1]];
if(k.equals(bkey))
return hopidx[(bkt<<2) + 1];
}... | 7 |
public static int getStandardDeviationParamIndex(String accession) {
if (INTENSITY_STD_SUBSAMPLE1.getAccession().equals(accession)) {
return 1;
} else if (INTENSITY_STD_SUBSAMPLE2.getAccession().equals(accession)) {
return 2;
} else if (INTENSITY_STD_SUBSAMPLE3.getAccess... | 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 feel.
* For details see http://down... | 6 |
void selfTrain(Instance testInst) {
int maxInstances = this.maxInstancesOption.getValue();
int poolSizeRatio = poolSizeOption.getValue();
int poolLimit = maxInstances / poolSizeRatio;
int poolCount = 0;
VotedInstancePool vInstPool = ActiveClusterBaggingASHT.getVotedInstancePool()... | 7 |
public void actionPerformed(ActionEvent event)
{
String entry = entryField.getText().trim();
if(entry.length() > 1 && entry.charAt(entry.length()-1) == '%')
entry = entry.substring(0,entry.length()-1);
if(event.getActionCommand().equals("Update"))
{
if(entry.equals(""))
JOptionPane.showMessageD... | 8 |
public List<String> splitWords(String source) {
StringTokenizer stringTokenizer = new StringTokenizer(source,delimiters);
List<String> list = new ArrayList<String>();
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
list.add(token);
}
return list;
} | 1 |
public static String escape(String msg) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < msg.length(); i++) {
char c = msg.charAt(i);
if (c != '\n' && (c < 32 || c >= 127)) {
c = '?';
}
sb.append(c);
}
return sb.t... | 4 |
private void drawGrid(Graphics g, Point p1, Point p2, Point p3, Point p4, int gridSizeX, int gridSizeY, int zUnit) {
g.setColor(Color.LIGHT_GRAY);
if (gridSizeX > 0) {
int x = p4.x + gridSizeX, xD = p1.x + gridSizeX;
int y = p4.y, yD = p1.y;
while (x < p3.x) {
g.drawLine(x, y, xD, yD);
x += gridSiz... | 9 |
public void updateFromBoard(Board board){
setTitle("Connect Four" + ((playerRed)?"(Red Move)": "(Blue Move)"));
for(int i =0;i<ConnectFour.COLUMNS;i++){
for(int j=0;j<ConnectFour.ROWS;j++){
buttons[i][j].setText(board.getBoardArray()[i][j]);
if(board.getBoardArray()[i][j]!=null){
switch(board.getBoa... | 8 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
frames = new AnalysatorFrames();
structuresBase = new ArraysDataBase();
fileBase = new FileDataBase();
... | 1 |
private void loadEvent(String filename) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(
getClass().getResourceAsStream(filename), "UTF-8"));
String line;
while ((line = br.readLine()) != null) {
// 空行は読み飛ばす
... | 9 |
public void visitFieldInsn(final int opcode, final String owner,
final String name, final String desc) {
if (mv != null) {
mv.visitFieldInsn(opcode, owner, name, desc);
}
execute(opcode, 0, desc);
} | 1 |
public ClassNode(ClassInfo info, ClassEditor editor) {
this.info = info;
this.editor = editor;
fields = new FieldNode[info.fields().length];
for(int i=0; i<fields.length; i++) {
FieldInfo fieldInfo = info.fields()[i];
fields[i] = new FieldNode(this, fieldInfo, editor.context().editField(fieldInfo));
... | 2 |
private static void generateReturnCode(String returnType, CodeVisitor cv) {
if (returnType.equals("V")) {
cv.visitInsn(POP);
cv.visitInsn(RETURN);
} else if (isPrimitive(returnType)) {
int opcode = IRETURN;
String type;
String meth;
if (returnType.equals("B")) {
type = "java/lang/Byte";
me... | 9 |
public void load(String filename) throws IOException {
if (settings.size() > 0)
settings.clear();
FileInputStream fstream = new FileInputStream("properties/" + filename);
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
... | 3 |
public String toString() {
Annotation[] a = getAnnotations();
StringBuffer sbuf = new StringBuffer();
int i = 0;
while (i < a.length) {
sbuf.append(a[i++].toString());
if (i != a.length)
sbuf.append(", ");
}
return sbuf.toString();... | 2 |
boolean isPalindrome(String str, int s, int e) {
if (s == e)
return true;
for (int i = s, j = e; i < j; ++i, --j) {
if (str.charAt(i) != str.charAt(j)) {
return false;
}
}
return true;
} | 3 |
public void update()
{
// This section ensures that we have the right children, without constantly removing/adding them,
// which causes user-unfriendly behaviors (unselection etc)
{
Set<Component> text_area_components = new HashSet<Component>();
for(Component c : text_area.getComponents())
text_... | 6 |
@Override
public void run() {
while(!terminer){
try {
if(in.ready()){
message = in.readLine();
MonInterface.fabrique.decoderTrame(message);
System.out.println("Trame CAN reçu");
}
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("fermeture thread");
/... | 3 |
public void printlnEntradas(){
for(Nodo<Rama_Hoja> iterador = _entradasDelArbol.getHead(); iterador != null; iterador = iterador.getSiguiente()){
System.out.println(iterador.getDato().getIdentificador());
}
} | 1 |
public void enableVoteButtons(boolean s) {
for (Card value : View.cards.values()) {
value.vote.setEnabled(s);
}
} | 1 |
public static void writeBytesToFile(File theFile, byte[] bytes) throws IOException {
BufferedOutputStream bos = null;
try {
FileOutputStream fos = new FileOutputStream(theFile);
bos = new BufferedOutputStream(fos);
bos.write(bytes);
} finally {
if... | 2 |
@Override
protected void toASCIIGnuStep(StringBuilder ascii, int level) {
indent(ascii, level);
NSObject[] array = allObjects();
ascii.append(ASCIIPropertyListParser.ARRAY_BEGIN_TOKEN);
int indexOfLastNewLine = ascii.lastIndexOf(NEWLINE);
for (int i = 0; i < array.length; i++... | 9 |
protected void end() {} | 0 |
public static String genSlaveFilename(String master_filename, String prefix_name, String ext_name)
throws MyException {
String true_ext_name;
int dotIndex;
if (master_filename.length() < 28 + FDFS_FILE_EXT_NAME_MAX_LEN) {
throw new MyException("master filename \"" + mast... | 8 |
@OnLoad
public void onLoad() {
ScheduleModel sched = DataStore.getSchedule(getRes_schedId());
if(sched!=null) this.res_sched = sched;
} | 1 |
public String Logar(String protocolo) throws SQLException{
String resultado[] = protocolo.split("-");
for(Cliente tmp : clientes.ProcurarTudo()){
if(tmp.getLogin().equals(resultado[1]) && tmp.getSenha().equals(resultado[2])){
return "LoginValido... | 3 |
public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Invalid input file.");
}
String line;
int sum;
while (inputScanner.hasNextLine()) {
line = inputScanner.nextLine();
... | 4 |
@Override
protected void updateTick(final EntityHandler caller) {
Map<Long, Entity> others = caller.getEntityMap();
if (pos.x < 0 || pos.x > Constants.WIDTH)
kill();
if (pos.y < 0 || pos.y > Constants.HEIGHT)
kill();
// do not check for collision if last collision was too short before
if (!timerBreak... | 9 |
public static void main(String args[]) {
if (args.length < 4) {
usage();
}
int cacheSize = Integer.parseInt(args[0]);
String diskName = args[1];
int diskSize = Integer.parseInt(args[2]);
StringBuffer shellCommand = new StringBuffer(args[3]);
f... | 8 |
@Override
public Converter put(String key, Converter value) {
Converter v = super.put(key, value);
if (v != null) {
throw new IllegalArgumentException("Duplicate Converter for "
+ key);
}
return v;
} | 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.