text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public String getAnswerText() {
return isChecked ?
exceptionClass.getSimpleName() + " is checked exception"
: exceptionClass.getSimpleName() + " is unchecked exception";
} | 1 |
public void comb_filter(final float[] exc,
final int esi,
final float[] new_exc,
final int nsi,
final int nsf,
final int pitch,
final float[] pitch_gain,
... | 8 |
public double[] getEigenEnergy() {
if (eigenEnergy != null) {
return eigenEnergy;
}
ArrayList<Double> eigenEnergyList = new ArrayList<Double>();
// Among all intervals we are looking for those which are truly quantum wells, they bring all the information.
for (int i ... | 7 |
public void RemoveListener() {
if (UI.instance != null && action.length > 1) UI.instance.menugrid.listeners.remove(action[1]);
} | 2 |
private ItemFactory(){
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MyString)) {
return false;
}
MyString other = (MyString) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else... | 6 |
public static void main(String[] args) {
long sum = 0L;
Map<Integer, String> names = new HashMap<>();
names.put(1, "one");
names.put(2, "two");
names.put(3, "three");
names.put(4, "four");
names.put(5, "five");
names.put(6, "six");
names.put(7, "seven");
names.put(8, "eight");
names.put(9, "nine"... | 4 |
private CtMethod findOriginal(CtMethod m, boolean dontSearch)
throws NotFoundException
{
if (dontSearch)
return m;
String name = m.getName();
CtMethod[] ms = m.getDeclaringClass().getDeclaredMethods();
for (int i = 0; i < ms.length; ++i) {
String orgN... | 5 |
public static Map<Integer, List<Double>> robustnessParallel(Map<Server, Set<Application>> connections, int runs, int direction, int type) {
Map<Integer, List<Double>> result = new HashMap<>();
ExecutorService es = Executors.newCachedThreadPool();
List<Callable<List<Double>>> callables = new Arra... | 7 |
private void ImportContactActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ImportContactActionPerformed
try{
this.FileChooser.setVisible(true);
int returnVal = this.FileChooser.showOpenDialog(this);
if (returnVal == FileChooser.APPROVE_OPTION) {
... | 2 |
public static void writeVarInt(ByteBuf byteBuf, int varInt) {
int part;
while (true) {
part = varInt & 0x7F;
varInt >>>= 7;
if (varInt != 0) {
part |= 0x80;
}
byteBuf.writeByte(part);
if (varInt == 0) {
... | 3 |
@Override
public void execute(DebuggerVirtualMachine dvm) {
dvm.setStepOutPending(true);
dvm.setRunning(true);
} | 0 |
private static void dotGenerator() {
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("which dot");
pr.waitFor();
boolean canDo = (pr.exitValue() == 0);
if (!canDo) {
System.err
.println("dot is not installed on this machine will not be able to generate png file");
} else {
... | 5 |
public void stepFoward(){
if(isRemovable)return;
xySpeed.y *= friction;
bounds.y += xySpeed.y;
xySpeed.x *= friction ;
bounds.x += xySpeed.x;
if(getSpeed() > MAX_SPEED){
double tempAngle = getMotionAngle();
xySpeed.x = Math.cos(tempAngle) * MAX_SPE... | 6 |
private void fillHive() {
for (int i = 0; i < _populationCapacity; i++) {
boolean newBeeIsWorker = _currentWorkerBeePopulation < _currentPopulation * WORKER_BEE_PERCENTAGE;
Bee newBee = _simulation.beeFactory().createBee(this, newBeeIsWorker);
register(newBee, getName() + "." + (newBeeIsWorker ? "WorkerBee" ... | 3 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
public Query<T> where(Predicate<T> predicate) throws Exception
{
WhereIterable rs = new WhereIterable(this._source, predicate);
return new Query<T>(rs);
} | 0 |
private static int subsequentCoins(int[][] board, int x, int y, int dx, int dy, int playerID) {
int newX = x + dx;
int newY = y + dy;
if ((newX >= 0 && newX < board.length) && (newY >= 0 && newY < board[0].length) && board[newX][newY] == playerID) {
return 1 + subsequentCoins(board, ... | 5 |
public int hashCode() {
return (int)(18 *((color == null) ? 0 : color.hashCode()));
} | 1 |
private void gcovParser(String gcovFile) {
TestCase testCase = parseTestCase(gcovFile);
if (achieveCoincidentalCorrectness == true)
achieveCoincidentalCorrectness(testCase);
int totalBlockCnt = 0;
int totalCoverBlockCnt = 0;
for (Statement st: testCase.getStatements())
{
if (st.isBlock())
{... | 9 |
private final String[] encodeFilter(final Short[] cbf) {
ArrayList<String> ccbf = new ArrayList<String>();
// find best compression rate by iteratively filling whole word
String word = new String();
int ncells = 0;
int i = 0;
// sth wrong here when working with pruned tables.
while (i<cbf.length) {
St... | 3 |
/* */ public void playCached(String userName) {
/* */ try {
/* 65 */ if ((userName == null) || (userName.length() <= 0)) {
/* 66 */ userName = "Minefieldien";
/* */ }
/* 68 */ this.launcher = new Launcher();
/* 69 */ this.launcher.customParameters.put("userName", us... | 3 |
private void createDepthCharts(int teamNumber,
int setNumber,
int[][] sortedPlayers,
Connection database)
{
int positionNumber=sortedPlayers[0][1];
int positionDepth=1;
for(int currentPlayer=0;c... | 6 |
public void actionPerformed(ActionEvent event)
{
JMenuItem menuItem = (JMenuItem)event.getSource();
if(menuItem.getName().equals("editShapeItem"))
{
EditDialog edit = new EditDialog(this, manager);
edit.setSize(450, 175);
edit.setEnabled(true);
edit.setVisible(true);
}
else if(menuItem.getName()... | 7 |
public void set(T value, int i)
{
coordonnees.set(i&1, value);
} | 0 |
public void updateHighScores( Player player ) {
int lowestIndex = highScores.size();
Score currentPlayer;
currentPlayer = new Score(0, player.getPlayerName(), player.getScore());
for ( int i = (highScores.size() - 1); i >= 0; i-- ) {
if ( currentPlayer.getScore() > highScore... | 6 |
@Override
public void setCredits(double credits) {
if(credits < 0.5 || credits > 4.0) {
JOptionPane.showMessageDialog(null,
"Error: credits must be in the range 0.5 to 4.0");
System.exit(0);
}
this.credits = credits;
} | 2 |
@Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns * columns;
if (boardPositionRow > 0){
//It's not the first row.
in... | 1 |
public static StringBuffer loadOneFile(String fileName) {
String line;
BufferedReader inFile = null;
StringBuffer myBuffer=new StringBuffer();
if (fileName==null) {
return myBuffer;
}
try {
InputStream in = new FileInputStream(fileName);
InputStreamReader reader = new... | 7 |
private static BufferedImage flip(BufferedImage image, boolean horizontal, boolean vertical) {
int width = image.getWidth(), height = image.getHeight();
if (horizontal) {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width / 2; ++x) {
int tmp = im... | 6 |
public int getTile(int x, int y){
if(x < 0 || y < 0 || x >= width || y >= height){
return -1;
}
return data.get((y * width) + x);
} | 4 |
private void run_aux() throws ProtboxException, IOException {
try {
if (Constants.verbose) {
logger.info("WatchService for " + root.toString() + " started.");
}
while (!Thread.currentThread().isInterrupted()) {
try {
WatchK... | 9 |
private int access(int arrayIndex, int smpNodeIndexFrom, int numCPUFrom, int startTime){
int i;
for(i = 0;i<syncObjs[arrayIndex].size() && startTime>syncObjs[arrayIndex].get(i).startTime;i++){
}
//must be put after i-1 and before i
Sync so = new Sync();
so.fromNumCPU = numCPUFrom;
so.fromSMPNodeIndex = sm... | 7 |
public void start() {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
String NomScoreboard = UtilChatColor.colorizeString(Language.getString("Language.Scoreboard.Name... | 4 |
@Override
public void addMessageToDB() {
try {
String statement = new String("INSERT INTO " + DBTable +"" +
"(uid1, uid2, time, qid, bestScore, isRead) VALUES (?, ?, NOW(), ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, fromUser);
stmt.setInt(2, toU... | 1 |
String getElementSymbol() {
if (elementSymbol == null)
if (atomName != null) {
int len = atomName.length();
int ichFirst = 0;
char chFirst = 0;
while (ichFirst < len && !isValidFirstSymbolChar(chFirst = atomName.charAt(ichFirst)))
++ichFirst;
switch (len - ichFirst) {
case 0:
brea... | 8 |
public static void UpperTitle(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement stmnt... | 4 |
@Override
public boolean equals(Object object) {
if (object == null || !(object instanceof PComponent))
return false;
PComponent comp = (PComponent) object;
return comp.getX() == x &&
comp.getY() == y &&
comp.getWidth() == width &&
com... | 6 |
@Override
public void deserialize(Buffer buf) {
bonesId = buf.readShort();
if (bonesId < 0)
throw new RuntimeException("Forbidden value on bonesId = " + bonesId + ", it doesn't respect the following condition : bonesId < 0");
int limit = buf.readUShort();
skins = new shor... | 5 |
public ArrayList<Board> expandChildren(COLOR childColor) {
Board root = this;
ArrayList<Board> children = new ArrayList<Board>();
//System.out.println("EXPANDING CHILDREN...");
for(int i = 0; i < root.boardSize; i++)
{
for(int j = 0; j < root.boardSize; j++)
{
if(root.board.get(i).get(j).color =... | 3 |
public static double toDegrees(double x)
{
if (Double.isInfinite(x) || x == 0.0) { // Matches +/- 0.0; return correct sign
return x;
}
// These are 180/PI split into high and low order bits
final double facta = 57.2957763671875;
final double factb = 3.14589482087... | 2 |
public static void main(String[] args) {
//initializing data memory
init();
Scanner scan = new Scanner(System.in);
boolean menu = true;
//display the main menu
while (menu) {
System.out.println("=========================================");
System.out.println("========== Con... | 5 |
@Override
public List<String> getPermissions(Plugin plugin, Player player, ReplicatedPermissionsContainer data)
{
List<String> permissionsList = new ArrayList<String>();
if (this.modList.contains(data.modName))
{
for (String checkPerm : data.permissions)
{
Permission perm = new Permission(checkPerm... | 4 |
static private final int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 40:
return jjStopAtPos(0, 23);
case 41:
return jjStopAtPos(0, 24);
case 44:
return jjStopAtPos(0, 31);
case 46:
return jjStartNfaWithStates_0(0, 22, 85);
case 47:
... | 6 |
public void addVertexSet(VertexSet s){
Iterator<City> it = s.iterator();
while(it.hasNext()){
City tmp = it.next();
if(!containsID(tmp.getID())){
addVertex(tmp);
}
}
} | 2 |
public static StatisticReturnObject pairedTTest(List<? extends Number> list1, List<? extends Number> list2)
throws Exception
{
if( list1.size() != list2.size())
throw new Exception("Lists must be of equal size");
List<Double> diffs = new ArrayList<Double>();
for( int x=0; x < list1.size(); x++ )
... | 6 |
private String generate_ct(char[] keyed_alphabet,char[][] trans_block, int[] num_k, String plain)
{
String plain_l=plain.toLowerCase();
StringBuilder sb=new StringBuilder();
int init_num=num_k.length<5?num_k.length:5;
for(int i=0;i<init_num;i++)
{
sb.append(num_k[i]);
}
assert(num_k.length==plain.leng... | 4 |
public void deletar(T t) throws ValidacaoException, ConstraintViolationException {
try {
transacao = session.beginTransaction();
session.clear();
session.flush();
session.delete(t);
transacao.commit();
} catch (org.hibernate.exception.Constrain... | 2 |
public void startGame() {
if(players.size() == 2) {
board.addPiece(new Piece(PieceColor.BLACK, 3, 3));
board.addPiece(new Piece(PieceColor.BLACK, 4, 4));
board.addPiece(new Piece(PieceColor.WHITE, 3, 4));
board.addPiece(new Piece(PieceColor.WHITE, 4, 3));
for(Player p : players)... | 2 |
private void fetchSubscribedCategoryList(HttpSession session) {
StudentBean bean = (StudentBean)session.getAttribute("person");
StudentDao dao=new StudentDao();
HashMap<String, Boolean> categoryMap = new HashMap<String, Boolean>();
List<String> nonSubscribed = dao.fetchCategories(bean.getUserid(), "NotSubscribe... | 2 |
private void showConfigInfo (StringBuffer buf)
{
try {
Configuration config = dev.getConfiguration ();
String tmp = config.getConfiguration (0);
int value;
buf.append ("<b>");
if (info.getNumConfigurations () != 1)
buf.append ("Current ");
buf.append ("Configuration</b><br>... | 5 |
public void processFire(AbstractTank tank) throws Exception {
bullet = new Bullet(tank.getX() + 25, tank.getY() + 25,
tank.getDirection());
int covered = 0;
int step = 1;
while (bullet.getX() > 0 && bullet.getX() <= 576 && bullet.getY() > 0
&& bullet.getY() <= 576) {
while (covered < 64) {
if (... | 9 |
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
// Draw the six tiles of a player's hand
for (int i = 0; i < game.getPlayer(playerIndex).getHand().size(); i++) {
double centerx = (30 + HEX_WIDTH / 2);
double centery = 30 + HEX_HEIGHT / 2 + 80 * i;
Color shading = Color.BLACK;
... | 7 |
private void rawroom(Rectangle rec) {
for (int y = rec.y; y < rec.y + rec.height; y++) {
for (int x = rec.x; x < rec.x + rec.width; x++) {
if (data[y][x] == null) {
if (y == rec.y || x == rec.x || y == rec.y + rec.height - 1 || x == rec.x + rec.width - 1) {
... | 7 |
public void messageIn(String x){
Messages.add(0, x);
if(Messages.size()>MAXMSGS){
Messages.remove(MAXMSGS);
}
} | 1 |
public GenerateNodesDialog(GUI p){
super(p, "Create new Nodes", true);
GuiHelper.setWindowIcon(this);
cancel.addActionListener(this);
ok.addActionListener(this);
Font f = distributionModelComboBox.getFont().deriveFont(Font.PLAIN);
distributionModelComboBox.setFont(f);
nodeTypeComboBox.setFont(f);
con... | 3 |
static double[][] add(double[][] matrix1, double[][] matrix2){
double[][] sum = new double[matrix1.length][matrix1[0].length];
for(int i = 0; i < sum.length; i++)
for(int j = 0; j < sum[0].length; j++)
sum[i][j] = matrix1[i][j] + matrix2[i][j];
return sum;
} | 2 |
public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
Unicalc unicalc = new Unicalc();
Map<String,Quantity> env = QuantityDB.getDB();
while (true)
{
System.out.print("input> ");
String input = console.nextLine();
if (input.equals("")) break;... | 2 |
public static boolean droppedLoot(){
int lootRad = Global.lootRadius;
Tile location = Global.deathLocation;
if(location!= null){
Area lootZone = new Area(new Tile(location.getX() + lootRad, location.getY() + lootRad, Game.getPlane())
,new Tile(location.getX() - lo... | 9 |
public static void main( String[] args ) throws Exception {
String sceneName = null;
HDRExposure sum = null;
int avgSpp = 0;
for( String arg : args ) {
if( arg.endsWith(".dump") ) {
String dumpFilename = arg;
File dumpFile = new File(dumpFilename);
sceneName = dumpFile.getName();
sceneName = ... | 9 |
public void attemptClose() {
DockContainer dc = getDockContainer();
if (dc != null) {
dc.attemptClose(mDockable);
}
} | 1 |
public void update(Category cat) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.update(cat);
session.getTransaction().commit();
} catch (Exception e) {
JOptionPane.sho... | 3 |
public static Predicate.Op getOp(String s) throws simpledb.ParsingException {
if (s.equals("="))
return Predicate.Op.EQUALS;
if (s.equals(">"))
return Predicate.Op.GREATER_THAN;
if (s.equals(">="))
return Predicate.Op.GREATER_THAN_OR_EQ;
if (s.equals("... | 9 |
public V get(K key) {
searchElement(key);
if (_searchHolder == null) {
return null;
}
return _searchHolder.value;
} | 1 |
public static int brightness(int color)
{
int red = (color & RED_MASK) >> 16;
int green = (color & GREEN_MASK) >> 8;
int blue = (color & BLUE_MASK);
double brightness = red*red*0.241 + green*green*0.691 + blue*blue*0.068;
return (int)brightness;
} | 0 |
public CharacterPiece(Game.Character character){
this.character = character;
// decide colour
switch (character) {
case MissScarlet:
startingPosition = new int[]{16,0};
colour = Color.red; break;
case ProfPlum:
startingPosition = new int[]{0,5};
colour = new Color(190, 60, 220); break;
c... | 6 |
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (rotation == 1) {
g.drawLine(0, 100, 95, 100);
g.drawLine(105, 100, 200, 100);
g.drawLine(95, 70, 95, 130);
g.drawLine(105, 90, 105, 110);
if (emf!=0) {
... | 8 |
public int getCurrentRoom(Point playerPos) {
Integer currentRoom = 0;
//It looks trough every room and compares their location in the level to the players.
for (int i = 0; i < getRoomList().size(); i++) {
if(playerPos.getX() >= getRoomList().get(i).getPos().getX() && playerPos.getX() <= (getRoomList().get... | 5 |
public static ListNode insertionSortList(ListNode head) {
if (null == head || null == head.next) return head;
ListNode p = head.next;
head.next = null;
ListNode r = head, rp = r, fp = null;
while (null != p) {
rp = r;
fp = null;
while (null != rp) {
if (p.val < rp.val) {
break;
}
fp... | 6 |
public static int executeShellCommand(String command, StringBuilder stderrString) {
int exitVal = -1;
try {
Process proc = Runtime.getRuntime().exec(command);
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
... | 3 |
private void fixHeap( int parent ) {
int child = smallestChild( parent );
// while the parent has a child and the parent's element
// is greater than the element in either child
while ( ( child != NO_CHILD ) &&
( comparator.compare( heap[child],
heap[pare... | 2 |
public source_pktNum lookForSrcPktNum(int src, int glID)
{
source_pktNum srcPktNum;
for (int i = 0; i < source_PktNum_array.size(); i++)
{
srcPktNum = (source_pktNum) source_PktNum_array.get(i);
if ((srcPktNum.getSourceID() == src) && (srcPktNum.getGridletID() == gl... | 3 |
public void updateServerModel(ServerModel newServerModel) {
this.serverModel = newServerModel;
gameModel = new GameModel(newServerModel);
HashMap<String, CatanColor> playerColorMap = this.getPlayerColorMap();
if(serverModel != null) {
log = new ArrayList<client.communication.CommsLogEntry>();
for(LogEn... | 3 |
public void animation(Canvas canvas) {
update();
//Buffer strategy
if (canvas.getBufferStrategy()==null) {
canvas.createBufferStrategy(3);
}
draw(canvas.getBufferStrategy().getDrawGraphics());
canvas.getBufferStrategy().show();
} | 1 |
public void setRecommendation(String recommendation) {
this.recommendation = recommendation;
} | 0 |
@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 TaxonObservationPublic)) {
return false;
}
TaxonObservationPublic other = (TaxonObservationPublic) object;
if (... | 5 |
void setExampleWidgetAlignment () {
int alignment = 0;
if (leftButton.getSelection ()) alignment = SWT.LEFT;
if (centerButton.getSelection ()) alignment = SWT.CENTER;
if (rightButton.getSelection ()) alignment = SWT.RIGHT;
if (upButton.getSelection ()) alignment = SWT.UP;
if (downButton.getSelection ()) ali... | 5 |
public void mouseSingleClicked(Point p){
//update current index
curr=mygraph.findIndex(p);
//insert location mode
if(mode==INSERTLOC){
int result=mygraph.addLoc(p);
if(result==(mygraph.getCurr()-1)){
curr=mygraph.getCurr()-1;
changeNotify();
}
}
//delete locatio... | 9 |
public T getColor() {
return color;
} | 0 |
private IMode getMode(char[] password, int state) {
String s = properties.get("salt");
if (s == null) {
throw new IllegalArgumentException("no salt");
}
byte[] salt = Util.toBytesFromString(s);
IBlockCipher cipher = CipherFactory.getInstance(properties.get("cipher"));
if (ci... | 9 |
public RealDef(final LocalExpr var) {
this.var = var;
if (StackPRE.DEBUG) {
System.out
.println("new def for " + var + " in " + var.parent());
}
} | 1 |
private void gererCollision(ControlleurObjets controlleur) {
for (int i = 0; i < controlleur.objets.size(); i++) {
ObjetJeu temp = controlleur.objets.get(i);
if (temp.getId() == IdObjet.TirNormal) {
if (contact().intersects(temp.contact())) {
... | 9 |
public boolean equals(Quaternion rhs) {
return (w_ == rhs.w_ && x_ == rhs.x_ && y_ == rhs.y_ && z_ == rhs.z_);
} | 3 |
public ContaCorrente pesquisar (int numero)
{
for(int i=0;i < this.capacidade; i++)
if (this.aContas[i] != null && this.aContas[i].getNumero() == numero)
return this.aContas[i];
return null;
} | 3 |
@Override
public boolean exists() {
try {
URL url = getURL();
if (ResourceUtils.isFileURL(url)) {
// Proceed with file system resolution...
return getFile().exists();
}
else {
// Try a URL connection content-length header...
URLConnection con = url.openConnection();
customizeConnectio... | 8 |
public
void removeEntity( final long someId )
throws NoSuchEntityException {
//
DataCore db = _dataCenter.getDataCore();
//if there is no entity with the given id
if( ! db.getEntity_Data_Table().containsKey( someId ) ) {
//throw an exception
throw new... | 3 |
private void insertProtStores(final Block block, final HashSet tryPreds,
final ResizeableArrayList defs) {
final Tree tree = block.tree();
// Visit all LocalExprs in block. Recall that LocalExpr
// represents a reference to a local variable. If the LocalExpr
// defines the variable, then added it to the def... | 6 |
public static void main(String[] args) {
// TODO Auto-generated method stub
int count =1;
boolean sosuu;
int [] num = new int[1000];
int [] cnt = new int[1000];
for(int i=2;i<=num.length;i++){
if(i>2&&i%2==0){
continue;
}else{
sosuu =isSosu(i);
if(sosuu == true){
cnt[count-1]=i;
... | 6 |
public void miniMap(Graphics g){
double xmapTileSize = 3 ;
int mapTileSize = (int) xmapTileSize;
int alignRightSize = Commons.WIDTH - (mapTileSize * mapSize.getX());
//Draws base
for(int y = 0; y < mapSize.getY(); y++){
for(int x = 0; x < mapSize.getY(); x++){
if(col[x][y]){
//draw grey box on mi... | 4 |
public static void main(String args[]) {
BallContainer ballContainer = new BallContainer();
ballContainer.appendBall(new Ball("red"));
ballContainer.appendBall(new Ball("blue"));
ballContainer.appendBall(new Ball("yellow"));
Iterator ite = ballContainer.iterator();
while (ite.hasNext()) {
Ball ball = (Ba... | 1 |
public JPanel getStatustextInTileChangesMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.statustextTilePanel;
} | 1 |
public int attackNormal( Character opponent ) {
int damage = (int)( (_strength * _attack) - opponent.getDefense() );
//System.out.println( "\t\t**DIAG** damage: " + damage );
if ( damage < 0 )
damage = 0;
opponent.lowerHP( damage );
return damage;
}//end attack | 1 |
void drawMandel() {
Graphics g = getGraphics();
int width = getWidth();
int height = getHeight();
pixels = new Color[width][height];
double xstep = DIV / width;
double ystep = DIV / height;
double y = Y_START;
for (int j = 0; j < height; y += ystep, j++) {
double x = X_START;
for (int i = 0; i < w... | 5 |
public void setMergeCombineFunc(MergeInShuffle mergeInShuffle, ReducerCounters counters) {
long inputRecsInPreviousMerges = 0;
long outputRecsInPreviousMerges = 0;
List<InMemoryShuffleMerge> list = mergeInShuffle.getInMemoryShuffleMerges();
InMemoryShuffleMerge info = null;
for(int i = 0; i < list.size(); i+... | 4 |
private boolean chercheEquipement(String equipement, String annotation)
{
if(annotation.equals("arme"))
{
for(AEquipement i : ArrayListArme)
{
if(i.getClass().getSimpleName().equals(equipement)) return true;
}
return false;
}
... | 9 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((!CMLib.flags().canBeHeardSpeakingBy(invoker(), mob))
||((invoker()!=null)&&(mob.location()!=invoker().location()))||(!CMLib.flag... | 7 |
public void jouer(String nomJoueur, int nombreDeTourMaximum)
{
this.nombreDePionsADecouvrir = NOMBRE_DE_PIONS_A_DECOUVRIR_PAR_DEFAUT;
this.combinaisonAleatoire = new Combinaison(this.nombreDePionsADecouvrir);
// Affichage
for (int numeroDuTour = 1; numeroDuTour <= nombreDeTourMaximum; numeroDuTour++)
{
... | 3 |
public boolean checkFrequency(Player player, double frequency) throws IOException{
File myFile = new File("plugins/CakesMinerApocalypse/frequencies.txt");
if (myFile.exists()){
Scanner inputFile = new Scanner(myFile);
String setFrequency = "";
while (inputFile.hasNextLine()){
String name = inputFile.ne... | 7 |
public void attack (Character ch){
if (this.element.getName() == "air"){
ch.addHP(-(this.AirStrike()));
}
if (this.element.getName() == "earth"){
ch.addHP(-(this.EarthStrike()));
}
if (this.element.getName() == "fire"){
ch.addHP(-(this.FireStrike()));
}
if (this.element.getName() == "water"){
... | 5 |
private ROM(String fileName) {
this.fileName = fileName;
buffer = ByteBuffer.allocate(4096);
try {
File file = new File(fileName);
if(!file.isFile())
throw new InvalidFilePathException("Not a valid file name: " + fileName);
// checks if file ... | 7 |
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.