text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main(String[] args) {
Miner miner = new Miner(458, "Bob");
MinersWife wife = new MinersWife(82, "Elsa");
MinersSon son = new MinersSon(50, "Billy");
try {
for(int i=0; i<40; ++i){
miner.update();
wife.update();
son.update();
Thread.sleep(800);
}
// System.err.println ... | 2 |
public void setRight(Node child) {
right = child;
if (child != null) {
child.parent = this;
}
} | 1 |
private void doAction(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession();
String forwardPage = errorPage;
Map<String, String[]> params = request.getParameterMap();
String action = request.getParameter("action");
sessio... | 7 |
public Vector<String[]> getData() {
return data;
} | 0 |
@Override
public void dispose() {
this.listModel = null;
this.previewList = null;
this.lblPreviewLabel = null;
this.lblBaseInfoLabel = null;
this.btnApplyButton = null;
this.btnEditButton = null;
this.btnDeleteButton = null;
this.list = null;
t... | 1 |
public void setPersonId(int personId) {
this.personId = personId;
} | 0 |
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] A = new int[]{0,0,0,2,5,7,40,50,100,120,200,300,350,370,380,355,390,400,800,432,450,500};
int n = A.length;
int[] B = new int[n+1];
int INF = 100000000;
int cur_lis_len = 1;
B[0] = 1;
for(int i = 1; i < n; i++ ){
int ma... | 7 |
public static void launchScoreDialog(final Context context, final String score, final String displayScore, final String levelId, final Drawable gameIcon,
final String gamePackage, final boolean fromSdk, final boolean skipModalDialog) {
final Float scoreF = Float.parseFloat(score);
final Sha... | 9 |
public CardType getType() {
return type;
} | 0 |
@Override
public SquareMatrix getIdentityMatrix() {
int size = getRowsNumber();
try {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
if (i == j) {
setElementAt(i + 1, j + 1, 1);
} else {
setElementAt(i + 1, j + 1, 0);
}
}
}
} catch (OutOfBoundsException... | 4 |
@Override
public void paintComponent (Graphics g) {
super.paintComponent(g);
if (state == 0) { //main menu
} else if (state == 1) { //load save menu
g.drawRect(0, 0, getWidth(), getHeight());
} else if (state == 2) { //options screen
} else if (state == 3) { //... | 5 |
*/
public Iterator iterator() {
final Iterator iter = super.iterator();
return new Iterator() {
Object last = null;
public boolean hasNext() {
return iter.hasNext();
}
public Object next() {
last = iter.next();
return last;
}
public void remove() {
if (last == nul... | 1 |
private void updateStateTellNotExist(List<Keyword> keywords, List<String> terms, List<String> approval, boolean inAden, boolean askPrice) throws WrongStateClassException {
if( approval.isEmpty()) {
if( keywords.isEmpty() ) {
DialogManager.giveDialogManager().setInErrorState(true);
return;
}
CanteenInf... | 6 |
public static void comp() {
int i1 = 123;
int i2 = 123;
int i3 = 456;
if (i1 == i2) {
System.out.println("i1とi2は等しい");
}
if (i1 != i3) {
System.out.println("i1とi3は等しくない");
}
if (i1 < i3) {
System.out.println("i3はi1より大... | 8 |
@Before
public void setUp() throws Exception
{
_underTest = new Player("Tester");
} | 0 |
private static int runProcess(String[] cmd, String[] environment,
InputStream in, OutputStream out,
OutputStream err)
throws IOException
{
Process p;
if (environment == null) {
p = Runtime.getRuntime().exec(cmd);... | 9 |
private String setFax( String line){
Pattern p = Pattern.compile("(fax)?.*[0-9\\.\\s]+(fax)?", Pattern.CASE_INSENSITIVE);
Pattern p2 = Pattern.compile("([0-9])");
Matcher m, m2;
int nbNumeric = 0;
String result=null;
if(null!=line && line.length()>0){
m = p.matcher(line);
if(m.find() && line.length()>... | 9 |
public static void shellSort(Comparable [] array,int increment){
int index=0;
int bounder=index+increment;
int innerIndex=0;
while(index < array.length && index < bounder)
{
//单次的插入排序程序
for(innerIndex = index+increment;innerIndex<array.length-increment;innerIndex=innerIndex+increment){
... | 6 |
public void keyPressed(KeyEvent w) {
int code = w.getKeyCode();
if (code == KeyEvent.VK_A) {
left = true;
right = false;
dx = -SPEED;
} else if (code == KeyEvent.VK_D) {
right = true;
left = false;
dx = SPEED;
} else... | 4 |
public int hashCode()
{
final int MOD_ADLER = 65521;
int a = 1;
int b = 0;
String nodeStr = Integer.toString(startIndex);
String offsetStr = Integer.toString(startOffset);
String vStr = versions.toString();
int hDataLen = data.length+nodeStr.length()
+offsetStr.length()+vStr.length();
char[] hashDat... | 5 |
public static void aesOfbCrypt(byte[] data, byte[] iv) {
//Maple's OFB is done in piecemeal every 1460 bytes (I'm guessing it has
//to deal with maximum segment size). First piece is only 1456 bytes
//because the header, although not encrypted, adds 4 blocks to the first
//segment.
BlockCipher ciph = aes256.g... | 4 |
@Override
public void handleMessages(Inbox inbox) {
while (inbox.hasNext()) {
Message msg = inbox.next();
if (msg instanceof PackHelloOldBetEtx) {
PackHelloOldBetEtx a = (PackHelloOldBetEtx) msg;
handlePackHello(inbox.getSender(), inbox.getReceiver(), a);
}else if (msg instanceof PackReply... | 3 |
static final void method3385(int i, int i_0_, int i_1_, int i_2_, int i_3_, int i_4_, int i_5_, boolean bool, int i_6_) {
anInt3582++;
if (!CacheNode_Sub15.method2379(7015, i)) {
if ((i_4_ ^ 0xffffffff) == 0) {
for (int i_7_ = 0; i_7_ < 100; i_7_++)
Class195.aBooleanArray2387[i_7_] = true;
} else {
... | 9 |
public void startServer(){
//read network configuration
Configuration config;
try{
config = new PropertiesConfiguration("network.cfg");
} catch (ConfigurationException e) {
try{
config = new PropertiesConfiguration("network.cfg.default");
... | 9 |
public static String pad(String s) {
if (s.length() == 0) return " ";
char first = s.charAt(0);
char last = s.charAt(s.length()-1);
if (first == ' ' && last == ' ') return s;
if (first == ' ' && last != ' ') return s + " ";
if (first != ' ' && last == ' ') return " " + s;... | 9 |
public static void playSound(String filename) {
try {
// From file.
AudioInputStream stream = AudioSystem.getAudioInputStream(
filename.getClass().getResource(filename));
// At present, ALAW and ULAW encodings must be converted to
// P... | 4 |
public void clear() {
accessTimes.clear();
map.clear();
}//clear | 0 |
@Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + (int) (this.id ^ (this.id >>> 32));
hash = 97 * hash + this.numeroEtudiant;
hash = 97 * hash + (this.prenom != null ? this.prenom.hashCode() : 0);
hash = 97 * hash + (this.nom != null ? this.nom.hashCode() : 0... | 5 |
public int GetCLFishing(int ItemID) {
if (ItemID == 10755) {
return 100;
}
if (ItemID == 10757) {
return 100;
}
if (ItemID == -1) {
return 1;
}
String ItemName = GetItemName(ItemID);
if (ItemName.startsWith("Fishing cape")) {
return 100;
}
if (ItemName.startsWith("Fishing hood")) {
return 1... | 5 |
@Override
public NormalLikeDistribution[] getOrderDistributions(double mean, double sd) {
double periodMean = mean/(forerun+1);
double periodSd = Math.sqrt(((sd*sd)/(forerun+1)));
NormalDistribution orderDistribution = new NormalDistribution(periodMean, periodSd);
RealSinglePointDistribution emptyOrder = new R... | 2 |
public boolean accountMatch(String name, String password) {
if (User.getUserByUsername(name) == null)
return false;
Encryption e = new Encryption();
String hashedPassword = e.generateHashedPassword(password);
try {
String statement = new String("SELECT password FROM " + DBTable +" WHERE username = ?");
... | 3 |
public static void main(String arg[]) {
try {
MmsParamsReader mp = new MmsParamsReader(new java.io.FileReader(arg[0]));
ParameterSet mps = mp.read();
System.out.println ("Dimensions = " + mps.getDims());
System.out.println ("Parameters = " + mps.getParams());
... | 2 |
public void breadthFirst() {
int start = 0;
int end = 0;
graph[0].setIdentified();
queue[end] = graph[0];
end++;
while (start != end) {
Node u = queue[start];
start++;
for (int i = 0; i < size; i++) {
Node v = u.getNode... | 7 |
public void setWait(){
wait = true;
} | 0 |
public Collection interfaces(final Type type) {
final TypeNode node = getImplementsNode(type);
if (node != null) {
final List list = new ArrayList(implementsGraph.succs(node));
final ListIterator iter = list.listIterator();
while (iter.hasNext()) {
final TypeNode v = (TypeNode) iter.next();
iter... | 2 |
public boolean conditionMatches(CombineableOperator combinable) {
return (type == POSSFOR || cond.containsMatchingLoad(combinable));
} | 1 |
public void saveSimulation(String fname) {
if (sim != null) {
try {
Path td = Files.createTempDirectory("PDTemp_");
List<WorldDescriptor> worldsToSave = sim.getWDStack();
for (int i = 0; i < worldsToSave.size(); i++) {
WDLoader loader = new JAXBWDLoader(td + "/"
+ Integer.toString(i) + ".xm... | 5 |
public void damage(int amt)
{
if(state == STATE_IDLE)
state = STATE_CHASE;
health -= amt;
if(health <= 0)
state = STATE_DYING;
} | 2 |
private void btnFinalizarVendActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizarVendActionPerformed
try {
if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) {
Funcionario f = (Funcionario) jcbFuncionarioVend.getSelectedI... | 3 |
public void actionPerformed(ActionEvent arg0) {
Component apane = environment.tabbed.getSelectedComponent();
JComponent c=(JComponent)environment.getActive();
SaveGraphUtility.saveGraph(apane, c,"GIF files", "gif");
} | 0 |
public void init(Map attributes) throws InvalidKeyException {
synchronized(lock) {
if (currentKey != null) {
throw new IllegalStateException();
}
Integer bs = (Integer) attributes.get(CIPHER_BLOCK_SIZE);
if (bs == null) { // no block size was specified.
... | 6 |
public static void main(String args[]){
//Creating a colour scheme to test the renderer with
Colour[] colours = new Colour[5];
final int MAP_SIZE = 5;
for (int i=0; i<MAP_SIZE; i++) {
switch (i) {
case 0: Colour black = new Colour("#000000");
colours[i]... | 6 |
public static void printGRNToFile(final String fileName, final Grn grn, final double[][] results) {
NumberFormat formatter = new DecimalFormat("###.#########");
try{
File file =new File(fileName);
//if file doesnt exists, then create it
boolean created = false;
if(!file.exists()){
... | 8 |
private void ConvertToCell(int x, int y)
{
Color basic = this.grid[x][y].getBackground();
Color a = new Color(255, 255, 255);
Color b = new Color(147, 208, 81);
Color c = new Color(52, 153, 51);
Color d = new Color(1, 73, 0);
Color e = new Color(231, 31, 27);
... | 7 |
public static void main(String[] args) throws Exception {
String env = null;
if (args != null && args.length > 0) {
env = args[0];
}
if (! "dev".equals(env))
if (! "prod".equals(env)) {
System.out.println("Usage: $0 (dev|prod)\n");
... | 8 |
void readFrequencies() throws Exception {
int totalFrequencyCount = 0;
int atomCountInFirstModel = atomSetCollection.atomCount;
float[] xComponents = new float[5];
float[] yComponents = new float[5];
float[] zComponents = new float[5];
discardLinesUntilContains("FREQUENCY:");
while (line !=... | 7 |
public void read(BufferedReader buff)
{
try
{
while(buff.ready())
{
line = buff.readLine();
piecePlace = pattern[0].matcher(line);
pieceMove = pattern[2].matcher(line);
castle = pattern[1].matcher(line);
if(piecePlace.find())
{
String chessPiece = piecePlace.group("ChessPie... | 6 |
exact(int N, int[][] m){
this.sets = new ArrayList();
nodes = new HashSet();
for (int i = 0;i < N; i++)
nodes.add(i);
matr = m;
size = N;
ss = new int[size];
} | 1 |
private static boolean updateJoinCardinality(Join j,
Map<String, Integer> tableAliasToId,
Map<String, TableStats> tableStats) {
DbIterator[] children = j.getChildren();
DbIterator child1 = children[0];
DbIterator child2 = children[1];
int child1Card = 1;
... | 9 |
protected boolean checkIfDivide(int previousToken){
if (previousToken == TokenNameIdentifier || previousToken == TokenNameStringLiteral ||
previousToken == TokenNameCharacterLiteral ||
previousToken == TokenNameIntegerLiteral ||
previousToken == TokenNameDoubleLiteral ||
previousToken == TokenNameLongLite... | 9 |
@Override
public void actionPerformed(ActionEvent ae) {
String comm = ae.getActionCommand();
switch (comm) {
case START_SERVER_AC:
if (electionsServer != null) {
System.err.println("Duplicate StartServer request in ServerFrame.actionPerformed(ActionEve... | 5 |
public int parseSDStatus(){
if(len<17) return 0;
//Starts with SD
int sdtext=17;
if(startsWithSD()){
int idx = indexOf('/');
if(idx == -1) return 0;
int done;
int total;
try {
done = Integer.parseInt(subSequence(sdtext, idx).toString());
int idx2 = indexOf('\n',idx+1);
if(idx2 == -1){... | 8 |
private boolean save() {
String name = informationPanel.getName().trim();
String source = informationPanel.getSource().trim();
int time = informationPanel.getTime();
int calories = informationPanel.getCalories();
int portions = informationPanel.getPortions();
if ( name ... | 9 |
protected void receive(String line) {
if(line.startsWith(FILE_START_MAP)){
String name = TEMP_FOLDER_PATH+"map.smap";
FileTools.saveFromInput(new File(name), in, bufferSize);
Map map = new Map(new File(name));
game.init(map, this);
send(READY);
msg = "Now waiting for other players to be ready";
}
... | 6 |
private void addChildren(JsonElement fromElement, JsonElement toElement) {
if (fromElement instanceof JsonObject && toElement instanceof JsonObject) {
JsonObject fromObject = (JsonObject) fromElement;
JsonObject toObject = (JsonObject) toElement;
for (Entry<String, JsonElement> entry : fromObje... | 5 |
public static MoodleGroup[] getGroupsFromCourseId(long id) throws MoodleRestGroupException, UnsupportedEncodingException, MoodleRestException {
Vector v=new Vector();
MoodleGroup group=null;
StringBuilder data=new StringBuilder();
String functionCall=MoodleCallRestWebService.isLegacy()?M... | 8 |
@Override
public void solve(DenseMatrix64F b, DenseMatrix64F x) {
if( b.numCols != x.numCols || b.numRows != numRows || x.numRows != numCols) {
throw new IllegalArgumentException("Unexpected matrix size");
}
int numCols = b.numCols;
double dataB[] = b.data;
doub... | 7 |
public boolean isBreakpointSet() {
return breakpointSet;
} | 0 |
public ByteVector putByte(final int b) {
int length = this.length;
if (length + 1 > data.length) {
enlarge(1);
}
data[length++] = (byte) b;
this.length = length;
return this;
} | 1 |
public void addChangeListener(ChangeListener listener) {
listeners.add(listener);
} | 0 |
public void setHorasteoricas(Tempo horasteoricas) {
this.horasteoricassemanais = horasteoricas;
} | 0 |
void Expr() {
printer.startProduction("Expr");
if (StartOf(3)) {
BaseExpr();
if (StartOf(4)) {
op();
BaseExpr();
this.generator.commandOp(this.currentContext.previousOp);
printer.endProduction("Expr");
} else if (la.kind == 6 || la.kind == 10) {
printer.endProduction("Expr");
} e... | 6 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor()==CMMsg.TYP_PUSH)||(msg.targetMinor()==CMMsg.TYP_PULL))
&&(msg.target() instanceof Item)
&&(juggles.contains(msg.target(... | 9 |
public static String translate(String str) {
if(!turnedon)
return str;
String res = "";
URL url = url(str);
if(url == null)
return str;
try {
final HttpURLConnection uc = (HttpURLConnection) url
.openConnection();
uc.setRequestMethod("GET");
uc.setDoOutput(true);
try {
String ... | 6 |
public static List<Field> inVars(Class<?> comp) {
List<Field> f = new ArrayList<Field>();
for (Field field : comp.getFields()) {
In in = field.getAnnotation(In.class);
if (in != null) {
Role r = field.getAnnotation(Role.class);
if (r != null && Ann... | 5 |
public void add(int[] bowl) {
assert(nkindfruits == bowl.length);
if (nfruits == 0)
nfruits = sum(bowl);
assert(nfruits == sum(bowl));
nround++;
history.add(bowl);
scoreHistory.add(dot(bowl, pref));
assert(nround == history.size());
} | 1 |
public boolean isOptOut() {
synchronized(optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.ge... | 4 |
static public boolean isWrapperClass (Class type) {
return type == Integer.class || type == Float.class || type == Boolean.class || type == Long.class || type == Byte.class
|| type == Character.class || type == Short.class || type == Double.class;
} | 7 |
@Override
public FREObject call(FREContext c, final FREObject[] args) {
final InAppPurchaseExtensionContext context = (InAppPurchaseExtensionContext) c;
context.executeWithService(new Runnable() {
@Override
public void run() {
InAppPurchaseExtension.logToAS("Getting products from the native store ..."... | 9 |
@Override
public void mouseClick(double x, double y) {
_tempToClick.clear();
for (MenuButton but : _buttons) {
if (but.isMouseWithin(x, y)) {
_tempToClick.add(but);
}
}
if (_tempToClick.size()==0)
return;
_tempToClick.get(_tempToClick.size()-1).actionOnClick();
} | 3 |
private static Move BackwardLeftForWhite(int r, int c, Board board){
Move backwardLeft = null;
if( r>=1 && c>=1 &&
board.cell[r-1][c-1] == CellEntry.empty
)
{
backwardLeft = new Move(r,c, r-1, c-1);
}
return backwardLeft;
} | 3 |
private void scanDir(File dir, List<LessFileStatus> lstAddedLfs) {
if (!dir.isDirectory())
throw new BugError("Bad directory: " + dir);
File[] subf = dir.listFiles();
if (subf != null) {
for (File f : subf) {
if (f.isFile())
scanFile(f.getName(), f, lstAddedLfs);
}
}
} | 4 |
private void addNewWormSprites() {
Collection<Worm> worms = getFacade().getWorms(getWorld());
if (worms != null) {
for (Worm worm : worms) {
WormSprite sprite = getWormSprite(worm);
if (sprite == null) {
createWormSprite(worm);
}
}
}
} | 3 |
@Override
public void paintComponent(final Graphics g) {
// Check if we have a running game
super.paintComponent(g);
g.setColor(this.getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
if (this.model != null) {
// Draw all tiles by going over them x-wise and y-wise.
for (int i = 0; i < this.... | 3 |
public static AIMerger getInstance() {
return instance;
} | 0 |
private void updateNPCs(Buffer stream, int amount) {
actorsToUpdateCount = 0;
playersObservedCount = 0;
updateNPCMovement(stream);
updateNPCList(amount, stream);
updateNPCBlock(stream);
for (int k = 0; k < actorsToUpdateCount; k++) {
int npcId = actorsToUpdateIds[k];
if (npcs[npcId].lastUpdateTick != ... | 5 |
@EventHandler
public void MagmaCubeHunger(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.getMagmaCubeConfig().getDouble("MagmaCube... | 6 |
public void dribbleToGoal(ObjBall ball) {
if(stayInBounds()) {
ObjGoal goal = mem.getOppGoal();
if((goal != null) && (mem.getPosition().x < 35.0)) {
kickToPoint(ball, new Polar(5.0, (goal.getDirection() - ball.getDirection())));
}
else if((goal != null) && (mem.getPosition().x >= 35.0)) {
... | 7 |
public ShipChassis readChassis(InputStream stream) throws IOException, JAXBException {
log.trace("Reading ship chassis XML");
// Need to clean invalid XML and comments before JAXB parsing
BufferedReader in = new BufferedReader(new InputStreamReader(stream, "UTF8"));
StringBuilder sb = new StringBuilder();
S... | 6 |
public JSONArray toJSONArray(JSONArray names) throws JSONException {
if (names == null || names.length() == 0) {
return null;
}
JSONArray ja = new JSONArray();
for (int i = 0; i < names.length(); i += 1) {
ja.put(this.opt(names.getString(i)));
}
re... | 3 |
public float getImporte() {
return importe;
} | 0 |
protected CityHall() {} | 0 |
@Override
public boolean verifier() throws SemantiqueException {
super.verifier();
if(gauche.isBoolean()){
setBoolean();
if(!droite.isBoolean()) GestionnaireSemantique.getInstance().add(new SemantiqueException("Expression droite arithmetique, booleenne attendue pour le ET lig... | 3 |
public void solicitudRealizada(final int idSolicitud){
logger.info("Id Solicitud " + idSolicitud);
getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Query query = session.createQuery("update Pos... | 0 |
public List<PwdItem> GetItems() {
List<PwdItem> pwdlist=new ArrayList<PwdItem>();
if (this.connection == null) {
return null;
}
try {
Statement stmt = null;
stmt = this.connection.createStatement();
int count = 0;
//... | 4 |
public boolean checkEntrance(Vehicle vehicle)
{
for (int i = 0; i < vehicleCount(); i++)
{
if (m_vehicles.get(i).getState() == Vehicle.State.INSIDE)
{
float theta = m_vehicles.get(i).getTheta();
float dist = getRadius() * (theta - vehicle.getTheta());
float dist2 = getRadius() * (float) Math.abs(... | 6 |
public char firstNonRepeating(String s) {
char return_char = 0;
if (s == null || s.isEmpty()) {
return 0;
}
int[] arr = new int[256];
for (char i : s.toCharArray()) {
int index = (int) i;
arr[index]++;
}
for (char i : s.toCharArray()) {
int index = (int) i;
if (arr[index] == 1) {
return... | 5 |
public CheckResultMessage checkTF04(int day) {
int r1 = get(20, 2);
int c1 = get(21, 2);
int r2 = get(23, 2);
int c2 = get(24, 2);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r1 + 3, c1 + day, 2).abs().compar... | 5 |
public static UnitType getTier(int tier, CastleType type)
{
for (UnitType i: UnitType.values()) {
System.out.println ("unit "+i.level+", "+i.castle);
if (i.level == tier && i.castle == type) {
return i;
}
}
return null;
} | 3 |
Welcome() throws PropertyVetoException {
setResizable(false);
setTitle("BOLSA DE EMPLEOS REP.DOM");
setIconImage(Toolkit.getDefaultToolkit().getImage(Welcome.class.getResource("/InterfazGrafica/Images/Encontrar-Trabajo.jpg")));
setForeground(new Color(0, 0, 0));
setFont(new Font("Tahoma", Font.BOLD, 15));
s... | 0 |
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out
.println("Please type in your score in percentage (0 to 100).");
float score = s.nextFloat();
s.close();
if (score >= 100) {
System.out.println("Your grade is A+");
} else if (score >= 90) {
System.out.println(... | 6 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost, msg);
if ((System.currentTimeMillis() - lastClanCheck) > TimeManager.MILI_HOUR / 2)
{
if ((clanID().length() > 0)
&& (owner() instanceof MOB)
&& (!amDestroyed()))
{
if ((CMLib.clans().getCl... | 9 |
public String toString() {
Stack<String> stack = new Stack<>();
StringBuilder full = new StringBuilder();
Set<Integer> powers = terms.keySet();
for (int power : powers) {
StringBuilder sb = new StringBuilder();
double coefficient = terms.get(power);
s... | 5 |
public void showTable() {
waitlb1.setVisible(true);
l.remove(0);
if (!l.isEmpty()) {
content = new String[l.size()][l.get(0).split(";").length];
for (int i = 0; i < l.size(); i++) {
content[i] = l.get(i).split(";");
}
for (int i = 0; i < l.size(); i++) {
for (int j = 0; j < content[i].length; ... | 6 |
@Override
public void serialEvent(SerialPortEvent event) {
if(event.isBREAK())
{
if(state!=SerialState.Disconnected)
{
disconnect();
System.out.println(">>Break);"); //$NON-NLS-1$
}
}
if(event.isERR())
{
if(state!=SerialState.Disconnected)
{
disconnect();
System.out.print... | 5 |
public void switchPanel(Screen screen)
{
cardLayout.show(cardPanel, screen.name());
switch (screen)
{ case CAMPUS:
campus.requestFocus();
campus.continueClasses();
break;
case CLASS:
classroom.requestFocus();
break;
case MINISPLASH:
miniSplash.requestFocus();
break;
case BATT... | 9 |
public Boolean secondUp()
{
if (time.getSeconds() < 59)
{
time.setSeconds(time.getSeconds() + 1);
} else
{
if (time.getMinutes() < 59)
{
time.setSeconds(0);
time.setMinutes(time.getMinutes() + 1);
} else
... | 3 |
public void setOptions(String[] options) throws Exception {
String tmpStr;
String[] tmpOptions;
setChecksTurnedOff(Utils.getFlag("no-checks", options));
tmpStr = Utils.getOption('C', options);
if (tmpStr.length() != 0)
setC(Double.parseDouble(tmpStr));
else
setC(1.0);
tmp... | 7 |
public boolean insertAt(int index, E element) {
if (indexOK(index)) {
if (index == 0) {
addFirst(element);
} else {
expandArrayCapacityBy(1);
System.arraycopy(array, index, array, index+1, array.length - index - 1);
array[index] = element;
}
return true;
}
return false;
} | 2 |
public static String compileAlgorythm(String commandLine){
BufferedReader bufDone;
BufferedReader bufError;
String stringDone = "";
String stringError = "";
try{
Process compile = Runtime.getRuntime().exec(commandLine);
bufDone = new BufferedReader(new In... | 5 |
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.