text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int findNearestBondIndex(int x, int y) {
if (modelManager.frame == null)
return -1;
Bond[] bonds = modelManager.frame.bonds;
if (bonds == null)
return -1;
int bondCount = modelManager.frame.bondCount;
if (bondCount <= 0)
return -1;
int xA, yA, zA, xB, yB, zB;
double distSq;
float width;
... | 8 |
public int getEventId() {
return eventId;
} | 0 |
public void setCurrentMap(int map){
this.currentMap = map;
} | 0 |
public double getUserBalance(String uid) {
Node userNode = getUserNode(uid);
if (userNode != null) {
NamedNodeMap attr = userNode.getAttributes();
Node nodeAttr = attr.getNamedItem("balance");
return Double.parseDouble(nodeAttr.getTextContent());
} else {
... | 1 |
public static void main(String[] args) throws Exception {
br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
int T = readInt();
while (T-- > 0) {
N = readInt();
int M = readInt();
map = new boolean[... | 8 |
public static Pokemon useTMHM(Pokemon selectedPokemon, Item item)
{
if (!hasItem(item))
return selectedPokemon;
if (item.effect1 == Item.Effect.TM || item.effect1 == Item.Effect.HM)
{
selectedPokemon = Mechanics.teachMove(selectedPokemon,item,moveNo);
if (!itemCancel)
decrementItem(item);
else
... | 4 |
public boolean removePop(StructuredBlock last) {
/*
* There are three possibilities:
*
* PUSH method_invocation() POP[sizeof PUSH] to: method_invocation()
*
* With java1.3 due to access$ methods the method_invocation can already
* be a non void store instruction.
*
* PUSH arg1 PUSH arg2 PO... | 8 |
private String readUTF(int index, final int utfLen, final char[] buf) {
int endIndex = index + utfLen;
byte[] b = this.b;
int strLen = 0;
int c;
int st = 0;
char cc = 0;
while (index < endIndex) {
c = b[index++];
switch (st) {
c... | 7 |
public void store() {
String content = HTML.formatXML(XML_HEADER + rootElement);
Path path = FileSystems.getDefault().getPath(".", FILENAME);
try {
Files.write(path, content.getBytes(), StandardOpenOption.CREATE,
StandardOpenOption.TR... | 1 |
@Override
public void onEndPage(PdfWriter writer, Document document) {
boolean HeaderEnable = false;
boolean FooterEnable = false;
//Controllo se devo impostare l'header
for (int i = 0; i < this._MyHeaderItemList.size(); i++) {
HeaderEnable = ((HeaderEnable) || (this._M... | 6 |
public static List<Laureate> filterByLivingYearRange(
List<Laureate> inputList, String startYear, String endYear) {
List<Laureate> outputList = new ArrayList<Laureate>();
int sYear = Integer.getInteger(startYear);
int eYear = Integer.getInteger(endYear);
// parse input, kee... | 5 |
public int maximalRectangle(char[][] matrix) {
int rows = matrix.length;
if (rows == 0) {
return 0;
}
int cols = matrix[0].length;
//create histogram matrix
int[][] histogram = new int[rows][cols];
int max = 0;
for (int i = 0; i < rows... | 9 |
@Override
public Status execute(String command) throws MenuException {
switch (command) {
case "E":
difficulty = "E";
break;
case "M":
difficulty = "M";
break;
case "H":
difficulty = "H";
... | 3 |
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
if(value != null && value.trim().length() > 0) {
Long id = Long.parseLong(value);
return dao.Abrir(id) ;
}
else {
return null;
}
} | 2 |
public static String getMouseName(int mouseCode) {
switch (mouseCode) {
case MOUSE_MOVE_LEFT: return "Mouse Left";
case MOUSE_MOVE_RIGHT: return "Mouse Right";
case MOUSE_MOVE_UP: return "Mouse Up";
case MOUSE_MOVE_DOWN: return "Mouse Down";
case MOUSE... | 9 |
public void setMinCount(int newMin) {
if (headCount < newMin) {
GlobalOptions.err
.println("WARNING: something got wrong with scoped class "
+ clazzAnalyzer.getClazz() + ": " + newMin + ","
+ headCount);
new Throwable().printStackTrace(GlobalOptions.err);
headMinCount = headCount;
} else... | 2 |
private void placeLives(int count) {
Random rand = new Random();
while (count > 0) {
int pos = rand.nextInt(WIDTH_FIELDS * HEIGHT_FIELDS);
IField field = fieldsMatrix[pos / WIDTH_FIELDS][pos % WIDTH_FIELDS];
if (field.getType().equals("building") && !field.hasLife()
&& !field.hasAmmo()) {
field.... | 4 |
public void performAction() {
if (isConnected()) {
boolean first = getOutput()[0].getStatus();
if (this.isTurnedOn() && inputAction==1) {
if (getInput()[0].getStatus()) {getOutput()[0].setStatus(true);}
else {getOutput()[0].setStatus(false);}
}
else {
... | 6 |
@Override
public void setValue(Object o) {
// property of this frame must have data type Long
this.playCounter=(Long)this.convertObject(o);
} | 0 |
final void method3643(Canvas canvas, int i, int i_177_) {
do {
try {
anInt7544++;
if (aCanvas7626 == canvas)
throw new RuntimeException();
if (aHashtable7577.containsKey(canvas))
break;
if (!canvas.isShowing())
throw new RuntimeException();
try {
Class var_class = Class.forName("... | 8 |
public void sendMessage(String message) {
try {
_remoteObj.sendMessage(_username, _receiver, message, ServerInterface.CLIENT);
} catch (RemoteException e) {
if(connect()) {
sendMessage(message);
return;
}
System.out.println("Error while sending message");
}
} | 2 |
public final void atributos() throws RecognitionException {
try {
// fontes/g/CanecaSemantico.g:228:2: ( ^( ATRIBUTOS_ ( atributo )* ) )
// fontes/g/CanecaSemantico.g:228:4: ^( ATRIBUTOS_ ( atributo )* )
{
match(input,ATRIBUTOS_,FOLLOW_ATRIBUTOS__in_atributos690);... | 9 |
public AnimMissile(float width, float height, float size) {
anim_missile = new Animation();
SpriteSheet sp_fire = null;
try {
sp_fire = new SpriteSheet("resources/blue_fire_ball.png", 81, 46,
new Color(0, 0, 0), 1);
} catch (SlickException e1) {
e1.printStackTrace();
}
in... | 3 |
public <T> T connect(Class<T> serviceInterface) throws IOException {
if (!serviceInterface.isInterface()) {
throw new IllegalArgumentException("serviceInterface must be of interface type!");
}
try {
socket = new Socket(this.serverHost, this.serverPort);
output... | 5 |
protected void fixBlock( Point pos, short[][] block, byte imageNo ) {
for ( int y = 0; y < Block.MAX_Y; y++ ) {
for ( int x = 0; x < Block.MAX_X; x++ ) {
if ( block[ y ][ x ] == 1 ) {
if ( pos.y + y < 0 ) {
continue;
}
_grid[ pos.y + y ][ pos.x + x ] = 1;
_grid... | 4 |
public static void GetFieldValue(Persistent obj, Field field, Object nodeValue, String subscript, NodeReference node)
{
Object fieldAsObj = null;
try {
fieldAsObj = field.get(obj);
if (Persistent.class.isAssignableFrom(field.getType()))
{
Persistent fieldAsPersistentObject;
try {
... | 6 |
public void breadthFirstTraversal(){
LinkedQueueClass<Integer> queue =
new LinkedQueueClass<Integer>();
boolean[] visited;
visited = new boolean[gSize];
for (int ind = 0; ind < gSize; ind++)
visited[ind] = false; //initialize the array
... | 6 |
public Problem(DataBean newDB) {
startTime = System.currentTimeMillis();
switch (newDB.alg) {//determine algorithm to run
case 1:
reachedGoal = DepthFirstSearch(newDB.initState);
break;
case 2:
reachedGoal = BreadthFirstSearch(newD... | 8 |
public static void main (String args[]) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line = reader.readLine();
int number = Integer.parseInt(line);
line = reader.readLine();
StringTokenizer st = new StringTokenizer(line);
Queue<String>[] queueNumb... | 7 |
public static void main(String[] args)
{
CrazyProblem problem = new CrazyProblem();
// 1) Change default settings as needed
Genejector.getSettings().setScoreLimit(2);
Genejector.getSettings().setPopulationSize(500);
// [ListingStart][L1]
Genejector.getSettings().addClass("genejector.examples.CrazyKeyring"... | 6 |
public void checkCollision(GameObject object) {
// check with other game objects
if (!object.dead) {
for (GameObject otherObject : objects) {
if (!(object instanceof Asteroid && otherObject instanceof EnergyShield)) {
if (object.hittable(otherObject)
... | 6 |
private int score(int[] bowl){
int sum=0;
for(int i=0;i<12;i++){
sum+=pref[i]*bowl[i];
}
return sum;
} | 1 |
public static void main(String[] args) {
SendPromotionMail sendPromotionMail = new SendPromotionMail();
Facade facade = Facade.getInstance();
Client client1 = new Client("Diego", "111", "diego.so@dce.ufpb.br", 28,
10, 1988);
Client client2 = new Client("Diego2", "222", "diego.sou@dce.ufpb.br",
29, 10,... | 3 |
public void keyTyped(KeyEvent keyEvent) {
Iterator<PComponent> it = components.iterator();
while (it.hasNext()) {
PComponent comp = it.next();
if (shouldHandleKeys) {
if (comp.shouldHandleKeys())
comp.keyTyped(keyEvent);
}
... | 7 |
private boolean jj_3R_29() {
if (jj_3R_77()) return true;
return false;
} | 1 |
public void updateZoomMap(int zoomCell){
BufferedImage[] images = new BufferedImage[19];
images[0] = determineImage(zoomCell);
for (int k = 0; k < 6; k++){
images[k+1] = determineImage(match.getWorld().getNeighborCell(match.getWorld().getCell(zoomCell), k).getCellID());
Cell interCell;
switch(k){
... | 7 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
Crossfire window = new Crossfire();
window.frmCrossfire.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} | 1 |
@Override
public void update(GameContainer container, int delta) throws SlickException
{
Input input = container.getInput();
player1.move(input, walls, delta);
if (input.isKeyDown(Input.KEY_ENTER))
{
SendText();
}
send(player1.getUpdate());
... | 3 |
public String getLastSheetName()
{
String sheetname = this.sheetname; // 20100217 KSC: default to 1st sheet
if( parent_rec != null )
{
WorkBook wb = parent_rec.getWorkBook();
if( (wb != null) && (wb.getExternSheet() != null) )
{
String[] sheets = wb.getExternSheet().getBoundSheetNames( ixti );
... | 5 |
private void collectNumbers()
{
mNumbers.clear();
mNumberId = 0;
TileValue value;
final int size = mField.getWidth() * mField.getHeight();
for (int tile = 0; tile < size; tile++ )
if (mField.getMaskValue(tile).isOpen())
{
value = mField.getTileValue(tile);
if ( !value.isBomb() && !value.isEmpty... | 5 |
public Mysql(){
/*
* kanei thn sundesh me thn vash sthn dimiourgia tou antikeimenou
*/
try{
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/askisi9?useUnicode=true&characterEncoding=UTF-8&";
conn = DriverManager
.getConnection(url
+ "use... | 1 |
private static String getSetString(String s) {
if (s == null)
return "{ }";
StringBuffer sb = new StringBuffer("{ ");
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '!')
c = Universe.curProfile.getEmptyString().charAt(0);
sb.append(c);
if (i != s.length() - 1)
sb.appe... | 4 |
private boolean isBundle() {
// only need the first 7 to check if it is a bundle
String bytesAsString = new String(bytes, 0, 7);
return bytesAsString.startsWith("#bundle");
} | 0 |
public String submit() {
// Calculate and save the ship date
int days = Integer.valueOf(shippingOption).intValue();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, days);
setShipDate(cal.getTime());
if ((cart.getTotal() > 100.00) && !specialOffer.is... | 5 |
@Override
public String[] extend(String basePreAlign, String basePostAlign, String extend, String[] table) {
ArrayList<Integer> inserts = new ArrayList<Integer>();
char[] basePost = basePostAlign.toCharArray();
char[] basePre = basePreAlign.toCharArray();
int j = 0;
for(int i... | 6 |
public static void cleanUp() throws InterruptedException
{
boolean success = false;
int loop = 0;
traceln(STDOUT, DEBUG, "Cleaning...");
if( DOWNLOADS_TMP_DIRECTORY.exists() )
{
do {
success = FileUtils.recursiveDelete(Settings.DOWNLOADS_TMP_DIRECTORY);
Thread.sleep(50);
} while( success ... | 6 |
@Override
public void run() {
boolean done = false;
int waitTime = 500;
try {
Packet pack = new Packet("GETCHUNK", "1.0", fileID, chunkNo, 0, null, null);
DistributedBackupSystem.cManager.sendPacket(pack, CommunicationManager.Channels.MC);
do {
try {
Thread.sleep(waitTime);
} catch (In... | 9 |
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} | 1 |
public Iterator getLoopedOpenDocumentIterator() {
return getOpenDocumentIterator(indexOfOpenDocument(mostRecentDocumentTouched));
} | 0 |
private static String getStep(PathCell start, PathCell end,boolean isPushingBox){
if(end.getRow()-start.getRow()<0){
return isPushingBox?"N":"n";
}else if(end.getRow()-start.getRow()>0){
return isPushingBox?"S":"s";
}
if(end.getColumn()-start.getColumn()<0){
return isPushingBox?"E":"e";
}else i... | 8 |
public ArrayList<String> get_result_statement(StringBuilder sb) {
// Get Result From Each Block And Add Into An ArrayList, Update DB
Pattern p4 = Pattern
.compile(
"(/750)|((RESULT:)(.*?)\\.\\s\\.\\s\\.)|((RESULT: )((.*?)ORDN))|(/700)|((Result : )((.*?)\\s{5}))",
Pattern.DOTALL);
Matcher m4 = p4.m... | 5 |
@Test
public void testCalculateSunVector() {
final TLE tle = new TLE(LEO_TLE);
Assert.assertFalse(tle.isDeepspace());
final Satellite satellite = SatelliteFactory.createSatellite(tle);
DateTime timeNow = new DateTime("2009-06-01T00:00:00Z");
for (int day = 0; day < 30; day++) {
final SatPos satPos = ... | 7 |
public void waitUntil(boolean v) throws InterruptedException{
// wait only if the value is not already v
if (value != v){
// set the until value (field) to v
until_value = v;
// mark waiting
waiting = true;
// recheck the condition
if (value != v){
// wait while the wait flag is true... | 7 |
public void setPrpFecmod(Date prpFecmod) {
this.prpFecmod = prpFecmod;
} | 0 |
public static void insertSort(int[] array) {
for (int j = 1; j < array.length; j++) {
int key = array[j];
int i = j - 1;
while (i >= 0 && array[i] > key) {
array[i + 1] = array[i];
i--;
}
if (i != j - 1) {
array[i + 1] = key;
}
}
} | 4 |
public boolean effectiveBooleanValue(XPathContext context) throws XPathException {
int count = 0;
SequenceIterator iter = operand.iterate(context);
while (true) {
Item item = iter.next();
if (item == null) {
break;
}
if (item instan... | 9 |
public void visitInnerClass(final String name, final String outerName,
final String innerName, final int access) {
cp.newUTF8("InnerClasses");
if (name != null) {
cp.newClass(name);
}
if (outerName != null) {
cp.newClass(outerName);
}
if (innerName != null) {
cp.newUTF8(innerName);
}
cv.visi... | 3 |
public void solve() {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
BigInteger[] a = new BigInteger[50];
a[0] = BigInteger.ZERO;
a[1] = BigInteger.ONE;
for (int i = 2; i < a.length; i++) {
a[i] = a[i - 1].add(a[i - 2]);
}
BigInteger res = BigInteger.ZERO;
for (int ... | 2 |
public void initEngineAndBuffers() throws NoSuchAlgorithmException,
KeyStoreException, KeyManagementException, SSLException,
IOException {
if (mode == FTPConnection.AUTH_SSL_FTP_CONNECTION
|| mode == FTPConnection.IMPLICIT_SSL_FTP_CONNECTION)
context = SSLCont... | 8 |
public double[] getMinMax(){
double min = Double.MAX_VALUE;
double max = -Double.MAX_VALUE;
if(multiTrace)
{
for(int i = 0;i<multiColumnData.length;i++)
{
ArrayList<Double> l = (ArrayList<Double>)multiColumnData[i];
for(double d : l... | 8 |
private int select( int maxEingabe )
{
int eingabe = -1;
while ( eingabe < 0 || eingabe > maxEingabe )
{
Anzeige.zeigeStringAn( "Auswahl eingeben:" );
try
{
eingabe = Integer.parseInt( getEingabe() );
}
catch ( NumberFormatException nfEx )
{
System.out.println( "Es wurde keine Zahl eing... | 3 |
public Instances[] getEnsembleTrainingData(Instances classInstances, int noOfClasses) {
DoubleVector weights = new DoubleVector();
Instances[] resultData = new Instances[NoOfClusters];
ArrayList attList = Collections.list(classInstances.enumerateAttributes());
attList.add(classInstances.... | 7 |
public int getLeftmostData( )
{
if (left == null)
return data;
else
return left.getLeftmostData( );
} | 1 |
public static boolean deleteInfo(String title){
boolean flag=false;
try{
contct=connector.getConnection();
Sttt=contct.prepareStatement("delete from bk where title ='"+title+"'");
if(Sttt.executeUpdate()==1)flag=true;
}catch(SQLException e){
System.out.println(e.getMessage());
}
connector... | 2 |
private static HashMap<Integer, Holder> getMap(File file, int dataColNum) throws Exception
{
HashMap<Integer, Holder> map = new HashMap<Integer, Holder>();
BufferedReader reader = new BufferedReader(new FileReader(file));
reader.readLine();
for(String s = reader.readLine(); s != null && s.trim().length()... | 7 |
@Override
public void componentMoved(ComponentEvent arg0) {
// TODO Auto-generated method stub
} | 0 |
@Override
public void onMessage( String message )
{
System.out.println( "SERVER: " + message );
ServerUser u = currentClient.attachment();
if (u == null)
{
currentClient.close();
}
else
{
for (ServerUser otherUser : userMap.values(... | 2 |
public ConsoleTools() {} | 0 |
private int determineSquareKey(final int xPosition, final int yPosition) {
final List<Vehicle> groundVehicles = map.getGroundlevelVehicles(xPosition, yPosition);
final List<Vehicle> skyVehicles = map.getSkylevelVehicles(xPosition, yPosition);
switch (map.getType(xPosition, yPosition)) {
case SEA:
if (grou... | 8 |
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (roundEnv.processingOver()) {
// We're not interested in the postprocessing round.
return false;
}
Set<? extends Element> rootElements = roundEnv
.getElementsAnnotatedWith(Serializ... | 9 |
public ArrayList<String> letterCombinations2(String digits) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
HashMap<Integer, ArrayList<String>> map = new HashMap<Integer, ArrayList<String>>();
for (int i = 2; i <= 6; ++i) {
char b... | 3 |
public void update(long deltaMs) {
onCurrentFrame += deltaMs;
if(onCurrentFrame >= frameDelay) {
currentFrame++;
currentFrame %= frames.size();
onCurrentFrame = 0;
}
} | 1 |
@Test
public void testGetRad() {
System.out.println("getSumm");
assertEquals(1.0, new Cylinder(3,1,2.8).getRad(), 0.00001);
} | 0 |
public static Serializable getObject(byte[] data) {
if (data == null) {
return null;
}
ObjectInputStream readS;
Serializable c;
try {
readS = new ObjectInputStream(new ByteArrayInputStream(data));
c = (Serializable) readS.readObject();
... | 6 |
@Override
@XmlElement(name="vorname")
public String getVorname() {
return this.vorname;
} | 0 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (obj.getClass() == ProductoCantidad.class) {
ProductoCantidad p = (ProductoCantidad) obj;
if (codigo == p.getProduct... | 5 |
private void doUpdateCY(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String chengYuanId = StringUtil.toString(request.getParameter("chengYuanId"));
if(!StringUtil.isEmpty(chengYuanId)) {
boolean isSuccess = true;
// ObjectMapper... | 4 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RequestDispatcher rd;
HttpSession session = request.getSession();
String eventId = request.getParameter("eventId");
int seatRequested = Integer.parseInt((String)request.getParameter("noOfTic"))... | 2 |
private boolean findDepthSanityCheck(){
ArrayList<InputNeuron> inputs=findInputs();
ArrayList<OutputNeuron> outputs=findOutputs();
for(int i=0;i<inputs.size();i++)
if(inputs.get(i).getDepth()!=0){
System.out.println("Input depth not right");
return fal... | 9 |
private Text getField(String key) throws IOException {
try {
return new Text(next.getString(key));
} catch (JSONException ex) {
throw new IOException(ex);
}
} | 1 |
void computeDisplayTexts (GC gc) {
if ((parent.getStyle () & SWT.VIRTUAL) != 0 && !cached) return; /* nothing to do */
int columnCount = parent.columns.length;
if (columnCount == 0) return;
for (int i = 0; i < columnCount; i++) {
gc.setFont (getFont (i, false));
computeDisplayText (i, gc);
}
} | 4 |
@Override
public void run() {
Wrapper obj;
synchronized (this) {
while (true) {
if (que.isEmpty()) {
try {
System.out.println("start to wait");
wait();
} catch (Interr... | 9 |
@Override
public String getToolTipForCell(Object cell)
{
String tip = "<html>";
mxGeometry geo = getModel().getGeometry(cell);
mxCellState state = getView().getState(cell);
if (getModel().isEdge(cell))
{
tip += "points={";
if (geo != null)
{
List<mxPoint> points = geo.getPoints();
... | 8 |
static int entrance(List<Point> points,int k){
int size=points.size();
Map<String,Integer> indexHash=new HashMap<>();//坐标hash
Map<String,Point> pointHash=new HashMap<>();//point hash
for(int i=0;i<size;++i){
Point p=points.get(i);
indexHash.put(p.x+","+p.y,i);
... | 8 |
private void startTimer()
{
btnCancel.setEnabled(true);
btnStart.setEnabled(false);
model.setTime(getTimeFromSPinners());
recentList.addItem(getTimeFromSPinners());
recentList.saveItems();
updateRecentMenu();
timer.start();
timeDirection = 0;
i... | 1 |
public static void main(String [] args) {
// assuming that 1-1-2 is not a triangle, (2-2-1 is not an AET) so starting with 2-2-3
long cumulativePerim = 0;
int countOfAETris = 0;
for (int i = 1; i < ((long) (1000000000/3)+2); i++) { // sloppy, see *** below
int j = i + 1;
double area = 0.0;
boolean i... | 5 |
public void update(Observable observable, Object change) {
if (observable instanceof Board && change instanceof Turn) {
// A turn was had - was it by our player's team?
Turn turn = (Turn) change;
if (turn.getTeam() == player.getTeam()) {
if (turn instanceof Pass)
addPassText();
... | 9 |
public void run() {
Socket s = null;
try {
s = ss.accept();
DataInputStream dis = new DataInputStream(s.getInputStream());
DataOutputStream dos = new DataOutputStream(s.getOutputStream());
model.addPlayer("Fred");
while (true) {
// read commands and return random response
char c = (char)dis.r... | 8 |
@Override
public void run() {
double unprocessedTicks = 0.0;
double nsPerTick = 1000000000.0/tps;
double unrenderedFrames = 0.0;
double nsPerFrame = 1000000000.0/fps;
long lastTime = System.nanoTime();
long lastFpsTime = System.currentTimeMillis();
... | 7 |
private static int getCharWidth(char c) {
int charWidth = 6;
if(width5.indexOf(c) >= 0) {
charWidth = 5;
}
if(width4.indexOf(c) >= 0) {
charWidth = 4;
}
if(width3.indexOf(c) >= 0) {
charWidth = 3;
}
if(width2.indexOf(c) >= 0) {
charWidth = 2;
}
if(width1.indexOf(c) >= 0) {
charWidth =... | 5 |
private void nextRun() throws IOException {
out.setLength(0);
type = null;
token = null;
int c = in.peek();
if (c == -1) {
type = Type.END;
return;
}
clearSpace();
c = in.peek();
if (c == -1) {
type = Type.EN... | 7 |
@Override
public String askForNewGame() {
HttpGet request;
try {
request = new HttpGet(new URI("http", null, SERVER, PORT, NEW_URL, null,
null));
} catch (URISyntaxException e1) {
throw new RuntimeException(e1);
}
HttpResponse response;
try {
response = client.execu... | 4 |
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)
tree.getLastSelectedPathComponent();
if (node == null) return;
Object nodeInfo = node.getUserObject();
if (node.isLeaf()) {
BookInfo book = (Bo... | 6 |
static String toHex8String(int pValue)
{
String s = Integer.toString(pValue, 16);
//force length to be eight characters
if (s.length() == 0) {return "00000000" + s;}
else
if (s.length() == 1) {return "0000000" + s;}
else
if (s.length() == 2) {return "000000" + s;}
else
if (s.lengt... | 8 |
public Object clone() {
return new Matrix(this);
} | 0 |
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] src = {7,6,8,3,4,5,3,2,1,8,9};
int start = 0;
int end = src.length-1;
int index = patition(src,start,end);
int k =4;
while( index != k){
if(index > k){
end = index - 1;
index = patition(src,start,end);
}else{
... | 3 |
private LinkDecor getDecors2(String s) {
// System.err.println("s2=" + s);
if (s == null) {
return LinkDecor.NONE;
}
s = s.trim();
if ("|>".equals(s)) {
return LinkDecor.EXTENDS;
}
if (">".equals(s)) {
return LinkDecor.ARROW;
}
if ("^".equals(s)) {
return LinkDecor.EXTENDS;
}
if ("+".e... | 7 |
public static int[] maxIndex(double[] __array) throws Exception {
ArrayList best_list = new ArrayList();
double best_val=Double.NEGATIVE_INFINITY;
double val;
int[] RET;
int _MAX = __array.length;
for (int i=0; i < _MAX; i++) {
val = __array[i];
i... | 5 |
public ComponentState getState(){
CTaskState state = cTaskContext.getTaskState();
if(state.equals(CTaskState.CInit))
return ComponentState.INIT;
else if(state.equals(CTaskState.CPreOperational))
return ComponentState.PRE_OPERATIONAL;
else if(state.equals(CTaskState.CFatalError))
return ComponentState.F... | 7 |
public void inicio(InstituicaoCooperadora instituicaocooperadora)
throws Exception
{
salvar = new JButton("Salvar");
id = new JTextInt(instituicaocooperadora.getId());
id.setEditable(false);
id.setEnabled(false);
nome = new JTextField(instituicaocooperadora.getNome() == null ? ""
: instituicaocooperad... | 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.