text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void visit_aastore(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} | 1 |
void print(Node t, int n, boolean p)
{
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
if (p)
{
if (t.getCar() != null)
{ t.getCar().print(n, true); }
}
else
System.out... | 4 |
private static boolean comparerTabProduitsIdFourn
(Produit[] tab, int[] tabTest, int n) {
boolean pareil = true;
int i = 0;
try {
if (tab == null && tabTest == null) {
pareil = true;
} else if (tab != null && tabTest != null && ... | 9 |
@Override
public SingleObject create() {
where+=xvel;
xvel+=rand.nextBoolean()?3:-3;
xvel*=Math.abs(xvel)>10?0.8:2;
xvel*=0<where && where<stage.getWidth()?1:-1;
return new TornadoPart(where,stage.getHeight()-90,rand.nextInt(8));
} | 4 |
public AgentIO(SmallWorld smallWorld, MenuItem importMenuItem, MenuItem saveMenuItem) {
this.smallWorld = smallWorld;
this.importMenuItem = importMenuItem;
this.saveMenuItem = saveMenuItem;
} | 0 |
public boolean equals(Animation animation)
{
if(!name.equals(animation.getName()))
return false;
if(duration != animation.getDuration())
return false;
if(hasSubAnimations())
if(subAnimations.size() != animation.getSubAnimations().size())
return false;
else
{
for(int i=0; i<subAnimations.si... | 9 |
@Override
public Cluster[] getClusters() {
if (result == null || result.isEmpty()) {
return null;
}
return result.toArray(new Cluster[0]);
} | 2 |
@EventHandler(ignoreCancelled = true)
public void explode(EntityExplodeEvent eee) {
Iterator<Block> iterator = eee.blockList().iterator();
while (iterator.hasNext()) {
Block block = iterator.next();
try {
if (explodeReinforcement(block)) {
block.... | 3 |
public static void main(String[] args){
int count=0;
for(int i=1;i<1e4;i++){
if(isLychrel(i)){
count++;
}
}
System.out.println(count);
} | 2 |
public int getY() {
return y;
} | 0 |
@Override
public void setExecutionControl(ITesterExecutionControl executionControl) {
this.executionControl = executionControl;
} | 0 |
public static OpponentCache getInstance(String scope) {
if (cache.containsKey(scope)) {
return cache.get(scope);
}
OpponentCache instance = new OpponentCache();
cache.put(scope, instance);
return instance;
} | 1 |
public void actionPerformed(ActionEvent ae) {
// your code here
String string = ae.getActionCommand();
try
{
if(string.equals("Add")) processAdding();
if(string.equals("Delete")) processDeletion();
//if(string.equals("View Attendances")
if(st... | 4 |
public StringBuffer printStatement(int indent, StringBuffer output) {
printIndent(indent, output);
if (qualification != null) qualification.printExpression(0, output).append('.');
if (typeArguments != null) {
output.append('<');
int max = typeArguments.length - 1;
for (int j = 0; j < max; j++) {
typ... | 7 |
public void close(){
try{
if(in!=null)in.close();
if(out!=null)out.close();
if(socket!=null)socket.close();
}
catch(Exception e){
}
in=null;
out=null;
socket=null;
} | 4 |
public static void scaleImageTo256kb(Path img) throws IOException {
File imgFile = img.toFile();
if (imgFile.length() <= BYTE) {
return;
}
File newFile = Constants.PROGRAM_TMP_PATH.resolve(img.getFileName()).toFile();
BufferedImage i = ImageIO.read(imgFile);
... | 4 |
public void paintComponent(Graphics g,
DragAndDropClassObject classOne,
DragAndDropClassObject classTwo){
Vector<Point> pointsOne = new Vector<Point>();
Vector<Point> pointsTwo = new Vector<Point>();
Vector<DragAndDropClassObject> ddClasses =
new Vector<DragAndDropClassObject>();
ddClasses.add(class... | 6 |
private void winner(Player player, Hand hand, int playerScore, int dealerScore) {
if (dealerScore > 21 && playerScore <= 21) {
this.output.println("Player Wins! Collect " + hand.getBet());
player.deposit(hand.getBet());
} else if (playerScore > 21 && dealerScore <= 21) {
this.output.println("Player Loses.... | 9 |
final Class133 method343(int ai[][], boolean flag, int i, int j, Class27_Sub1 class27Sub1, int k, int l, int i1, int j1, int k1, int ai1[][], int l1, Animation animation, int i2) {
long l2;
if (anIntArray574 != null) {
l2 = ((k << 3) + (id << 10)) - -l1;
} else {
l2 = l1 ... | 9 |
public void display(){
System.out.println("rectID : "+rectID);
System.out.println("rectName : "+rectName);
System.out.println("linkedvideoname : "+linkedVideoName);
System.out.println("linkedVideoStartFrame : "+linkedVideoStartFrame);
System.out.println("numofkeyframes : "+numOfK... | 1 |
public static double readCorpus(Trie dictTrie,String filepath,
HashSet<String> wrongWords
) throws IOException {
BufferedReader reader;
reader = new BufferedReader((new FileReader(filepath)));
StringTokenizer lineTokenizer;
String line;
... | 4 |
private int expandMinNode(int depth, int prevAlpha) {
// if cutoff test is satisfied
if (board.isGameOver() || depth == 0)
return board.getBoardStats().getStrength(maxPlayer);
Move[] moves = board.getPossibleMoves(minPlayer);
int beta = MAX_POSSIBLE_STRENGTH;
... | 7 |
private void refresh(Font f){
image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
if(f == null){
f = image.getGraphics().getFont();
}
fontMetrics = image.getGraphics().getFontMetrics(f);
int height = fontMetrics.getHeight();
int width = fontMetrics.stringWidth(text);
if(width == 0){... | 4 |
@Override
public void deserialize(Buffer buf) {
fightId = buf.readInt();
if (fightId < 0)
throw new RuntimeException("Forbidden value on fightId = " + fightId + ", it doesn't respect the following condition : fightId < 0");
sourceId = buf.readInt();
if (sourceId < 0)
... | 3 |
@Override
public Component getComponentByID(int id) {
Connection conn = null;
PreparedStatement st = null;
Component component = null;
ResultSet row = null;
try {
conn = OracleDAOFactory.createConnection();
st = conn.prepareStatement(GET_COMPONENT_BY_ID);
st.setInt(1,id);
row = st.executeQuery();... | 8 |
public void cargarArbol() {
//inicializo el arbol
inicializarArbol();
//cargo las cuentas hijo
r_con.Connection();
int count = 0;
int aux = 0;
Enumeration e = root1.breadthFirstEnumeration();
while (e.hasMoreElements()) {
parent1 = (De... | 6 |
public String getMovieName() {
try {
return em.createNamedQuery("Movie.findById", Movie.class)
.setParameter("id", movieId)
.getSingleResult()
.getName();
} catch (NoResultException e) {
return "";
}
} | 1 |
public void plotZCoordinatesele (Graphics2D g2) {
g2.setFont(new Font("Arial", 20, 12));
DecimalFormat f = new DecimalFormat("0.#");
int yInterval=50;
float points = maxY / 4;
for (int x = yInterval, j = 1; x < 250; x+=yInterval){
if(j>3)
break;
g2.drawString("-", 146-diff, 100 + x + 24);
g2.dra... | 9 |
public String getToolTip() {
return "Attribute Editor";
} | 0 |
public void shutdownOutput (final SocketChannel sc, final Callback.TCPClient cb) {
if ( !sc.isConnected()
|| !sc.isOpen()
|| sc.socket().isClosed()
|| sc.socket().isOutputShutdown()) {return;}
if (this.isLoopThread()) {
try { sc.socket().shutdownOutput();... | 6 |
public boolean isSameTree(TreeNode p, TreeNode q) {
if(p !=null && q !=null){
if(p.val == q.val){
return isSameTree(p.left , q.left) && isSameTree(p.right , q.right);
}else{
return false;
}
}else if(p ==null && q == null){
return true;
}else{
return false;
}
} | 6 |
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
if (headA == null || headB == null) {
return null;
}
int aLen = getLen(headA);
int bLen = getLen(headB);
int diff = aLen - bLen;
if (diff >= 0) {
while (diff > 0) {
headA = headA.next;
diff--;
}
} else {
diff = -dif... | 8 |
public void tickAll() {
for(int var1 = 0; var1 < this.all.size(); ++var1) {
Entity var2;
(var2 = (Entity)this.all.get(var1)).tick();
if(var2.removed) {
this.all.remove(var1--);
this.slot.init(var2.xOld, var2.yOld, var2.zOld).remove(var2);
} else {
... | 5 |
public void loadMap(String file) {
InputStream in = getClass().getResourceAsStream("/maps/" + file + ".map");
BufferedReader br = new BufferedReader(new InputStreamReader(in));
try {
this.cols = Integer.parseInt(br.readLine());
this.rows = Integer.parseInt(br.readLine());... | 3 |
public void createAndSaveUrl(String Path, String DistrictID) throws Exception{
Properties properties = new Properties();
properties.load(this.getClass().getResourceAsStream("/com/opendap/poc/ServerContentDownloader.properties"));
String parent = new File(this.getClass().getResource("/boo.txt").getFile()).getPare... | 8 |
public List<Map<Integer, Integer>> buildRGBHistogram() {
List<Map<Integer, Integer>> output = new ArrayList<Map<Integer, Integer>>();
Map<Integer, Integer> red = new TreeMap<Integer, Integer>();
Map<Integer, Integer> green = new TreeMap<Integer, Integer>();
Map<Integer, Integer> blue = new TreeMap<Integer, Inte... | 6 |
@Override
public final BEXList children() {
final int key = this._key_;
final BEXFileLoader owner = this._owner_;
switch (BEXLoader._typeOf_(key)) {
case BEX_ELEM_NODE: {
final int ref = BEXLoader._refOf_(key);
final int contentRef = owner._chldContentRef_.get(ref);
if (contentRef >= 0) re... | 6 |
@Override
public void execute(DebuggerVirtualMachine dvm) {
dvm.setStepInPending(true);
dvm.setRunning(true);
} | 0 |
public void establishConnection() {
try {
// Load Driver
Class.forName(DRIVER).newInstance();
// Establish connection
connection = DriverManager.getConnection(URL);
System.out.println(URL + " connected...");
} catch ( SQLException ex ) {
... | 4 |
private String produceBorders() {
BufferedImage bordersImage = null;
if (ioflags.SAVE)
bordersImage = new BufferedImage(chunksX * MyzoGEN.DIMENSION_X, chunksY * MyzoGEN.DIMENSION_Y, BufferedImage.TYPE_INT_ARGB);
for (Tile tile : MyzoGEN.getOutput().getTilesArray().values()) {
Point[] surrPoints = Utils.g... | 9 |
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "KeyReference", scope = ReferenceList.class)
public JAXBElement<ReferenceType> createReferenceListKeyReference(ReferenceType value) {
return new JAXBElement<ReferenceType>(_ReferenceListKeyReference_QNAME, ReferenceType.class, Reference... | 0 |
private void addServerNotifierAsListener() {
EventsControlSystem ecs = rcs.getECS();
for (Integer decoder : model.getDecodersId()) {
ecs.addListener(Protocol.EVENT_DECODER_STATE0, decoder, serverNotifier);
ecs.addListener(Protocol.EVENT_DECODER_STATE1, decoder, serverNotifier);
... | 8 |
protected void writeRow() throws IOException {
final Iterator<String> titlesIter = columnTitles.iterator();
while (titlesIter.hasNext()) {
final String columnTitle = titlesIter.next();
if (getRowMap() != null) {
if (titlesIter.hasNext()) {
writ... | 3 |
private boolean colchete() {
//<colchete> ::= “[“ <inteiro> “]” <colchete> | λ*/
boolean erro = false;
if (!acabouListaTokens()) {
nextToken();
if (tipoDoToken[1].equals(" [")) {
if (!acabouListaTokens()) {
nextToken();
... | 7 |
public static String capitalizeEveryWord(String string){
boolean lastWasSpace = false;
char[] stringArray = string.toCharArray();
if(stringArray.length == 0){
return "-1";
}
stringArray[0] = Character.toUpperCase(stringArray[0]);
for (int x = 1;x <= stringArray.length - 1; x++){
if(stringArra... | 4 |
public Maze(int nRows, int nCols)
{
act_rows = nRows/2;
act_cols = nCols/2;
rows = act_rows*2+1;
cols = act_cols*2+1;
feild = new RoomType[rows][cols];
current = new int[act_cols*2-1];
next = new int[act_cols*2-1];
/* Sets the maze to filled */
for(int i =0; i<feild[0].length... | 5 |
private ArrayList<String> splitMsg(String str) {
ArrayList<String> array = new ArrayList<String>();
int curPos;
int len = str.length();
int countLeft = 0, countRight = 0;
int startIndex = 0;
char ch;
for (curPos = 0; curPos < len; ++curPos) {
ch = str.charAt(curPos);
... | 7 |
void mapOutField(Object from, String from_out, Object to, String to_field) {
if (from == ca.getComponent()) {
throw new ComponentException("wrong connect:" + to_field);
}
ComponentAccess ca_from = lookup(from);
Access from_access = ca_from.output(from_out);
checkFA(from_access, from, from_out);
try {
... | 3 |
public static Vector arrayListToVector (ArrayList someArrayList) {
// if we've got a null param, leave
if (someArrayList == null) {
return null ;
} // end if
// try to create a vector
Vector someVector = new Vector () ;
// if we failed, leave
if (someVector == null) {
return null ;
} // e... | 3 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if(columnIndex < 0 || columnIndex >= getColumnCount())
return null;
if(rowIndex < 0 || rowIndex >= getRowCount())
return null;
switch (columnIndex) {
case 0:
retu... | 9 |
public boolean isSameTree2(TreeNode p, TreeNode q){
Stack<TreeNode> pstack = new Stack<TreeNode>();
Stack<TreeNode> qstack = new Stack<TreeNode>();
pstack.push(p);
qstack.push(q);
while(!pstack.isEmpty() && !qstack.isEmpty()){
p = pstack.pop();
q = qstack.pop();
if (p !=... | 9 |
public String testStart(String appKey, String userKey, String testId) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
testId = URLEncoder.encode(testId, "UTF-8");
} catch (UnsupportedEncodingException e) {
... | 1 |
public int maximalRectangle(char[][] matrix)
{
int numRows = matrix.length;
if (numRows == 0) {
return 0;
}
int numCols = matrix[0].length;
if (numCols == 0) {
return 0;
}
int maxArea = 0;
int[] heights = new int[numCol... | 9 |
private PaymentsAPI getPaymentApi() {
if (paymentsApi == null) {
paymentsApi = new PaymentsAPI(config);
}
return paymentsApi;
} | 1 |
public void RenderAll(Shader shader, RenderingEngine renderingEngine)
{
Render(shader, renderingEngine);
for(GameObject child : m_children)
child.RenderAll(shader, renderingEngine);
} | 1 |
public static TreeMap<String, Double> processString(String line) {
TreeMap<String, Double> output = new TreeMap<String, Double>();
StringTokenizer tokenizer = new StringTokenizer(line);
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken()
.replaceAll("[^\\p{Alpha}]+", "").toLowerCas... | 9 |
public synchronized void addAnimation(String string, BufferedImage[] images) {
if(this.getCurrentAnimationType().equals("")){
this.setCurrentAnimationType(string);
}
if(this.animations == null){
this.animations = new Hashtable<>();
}
if(images == null){
images = new BufferedImage[0];
}
this.anima... | 3 |
boolean matchOrEmpty(int pips, int x, int y) {
return ((x < 0 || x >= w || y < 0 || y >= h) || (field[x][y] == -1) || (field[x][y] == pips));
} | 5 |
boolean isSim() {
return file != null && (file.getName().endsWith("sim")
|| file.getName().endsWith("luca")
|| file.getName().endsWith("fast")
|| file.getName().endsWith("esp")
|| file.getName().endsWith("dds"));
} | 5 |
@Test
public void testMatrix3fFloatArray() {
float[] entries = new float[9];
for(int i = 0; i < 9; ++i)
entries[i] = i;
Matrix3f m = new Matrix3f(entries);
for(int i = 0; i < 9; i++)
assertEquals(m.entries[i],entries[i],EPSILON);
} | 2 |
public DogTrack(int tracksize) {
this.tracksize = tracksize;
posFido = 0;
posSpot = 0;
posRover = 0;
} | 0 |
private void checkRoute(int[] route, int offset){
if(offset == salesman.n){
count++;
if(count%100000 == 0){
System.out.println("check route "+count);
}
double cost = salesman.calculateCosts(route);
if(minCosts < 0 || cost < minCosts){
minCosts = cost;
System.arraycopy(route,0,min... | 7 |
@Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
if (e.getDocument() == null) {
setEnabled(false);
} else {
setEnabled(true);
}
} | 1 |
private void splitCompounds(String equation, boolean reactantSide) throws SChemPException
{
StringTokenizer token = new StringTokenizer(equation, "+");
if(reactantSide)
{
reactantStrings = new String[token.countTokens()];
reactants = new Compound[reactantStrings.length];
rCoefficients = new int[react... | 8 |
int[] isoFromFixed(long date) {
int weekyear = gjYearFromFixed(date - 3);
int nextWeekyear;
if (weekyear == -1) {
nextWeekyear = 1;
} else {
nextWeekyear = weekyear + 1;
}
if (date >= fixedFromISO(nextWeekyear, 1, 1)) {
weekyear = nextW... | 2 |
public void setClockForGroup(VectorClock clockForGroup) {
this.clockForGroup = clockForGroup;
} | 0 |
private int calculaYparaPuntoCiclista(Ciclista cic,
TreeMap<Integer, Integer> ar) {
int yresu = 0;
int dify = 0;
int yacum = Constantes.ALTO_VENTANA / 4;
boolean encontrado = false;
Iterator<Entry<Integer, Integer>> it = ar.entrySet().iterator();
Iterator<Entry<Integer, Integer>> itaux = ar.entrySet().iterat... | 6 |
public static synchronized void playSound() {
new Thread(new Runnable() {
public void run() {
try {
InputStream in = new FileInputStream("sounds/goal.wav");
AudioStream as = new AudioStream(in);
AudioPlayer.player.start(as);
} catch (Exception e) {
... | 1 |
@EventHandler
public void onSignChange(SignChangeEvent event)
{
if(!HotelCount.isAdmin(event.getPlayer()) && !HotelCount.canCreate(event.getPlayer()))
return;
if(event.getLine(0).equalsIgnoreCase("[Counter]"))
{
String region = event.getLine(1);
int lo... | 6 |
public ComboBoxModel<String> GetListClasse(){
//String columnNames[] = { "Lib Classe"};
DefaultComboBoxModel<String> defModel = new DefaultComboBoxModel<String>();
//defModel.setColumnIdentifiers(columnNames);
try {
DriverManager.registerDriver(new oracle.jdbc.d... | 4 |
public WumpusPerception addHunter(final AID senderAID) {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "addHunter()");
WumpusPerception perception = null;
if (senderAID != null) {
Hunter hunter = new Hunter(senderAID);
if (!hunters.contains(hunter)) {
this.hunters.add(hunter)... | 3 |
public static void createTables() throws SQLException, ClassNotFoundException {
// database.plugin.debug("Creating SQLite tables...");
Class.forName("org.sqlite.JDBC");
Connection con = getConnection();
Statement stat = con.createStatement();
if (tableExists("Lifestones") == false) {
System.out.println("C... | 3 |
static public void main(String[] arguments) {
String msg = null;
// create the configuration
Config config = new Config();
// see:
// http://www.javaworld.com/javaworld/jw-08-2004/jw-0816-command.html?page=5
Options opt = new Options(arguments, 2);
// convert fasta: arg1 = fasta files, arg2 = bases ... | 9 |
@Basic
@Column(name = "FUN_HABILITADO")
public String getFunHabilitado() {
return funHabilitado;
} | 0 |
public void printResult(DefaultTableModel table) {
count = 100;
try {
while ((count > 0) && result.next()) {
count--;
Vector<String> data = new Vector<String>();
for (int i = 1; i <= resultMetaData.getColumnCount(); i++) {
Object res = result.getObject(i);
data.add( res == null ? "NULL" ... | 6 |
@Override
public void execute() throws BuildException {
super.execute();
if (jdeHome == null) {
throw new BuildException("jdehome not set");
}
File lib = new File(jdeHome, "lib");
if (lib.isDirectory()) {
Path apiPath = new Path(getProject());
apiPath.setLoc... | 9 |
private void validate() throws RrdException {
if(dsName == null || dsName.length() == 0) {
throw new RrdException("Invalid datasource name specified");
}
if(!isValidDsType(dsType)) {
throw new RrdException("Invalid datasource type specified: " + dsType);
}
if(heartbeat <= 0) {
throw new RrdException(... | 7 |
public int surround(int y, int x, int[][] image){
int counter = 0;
for(int i = y - 1; i <= y+1; i++)
for(int j = x -1; j <= x+1; j++){
try{
if(image[i][j] == -16777216)
counter++;
}catch(Exception e){;}
}
if(image[y][x] == -16777216)
counter--;
return counter;
} | 5 |
public void compileFilenamesList(CMFile F, String regex, Vector<String> V)
{
if((!F.canRead())||(!F.isDirectory()))
return;
final String[] list=F.list();
String path=F.getAbsolutePath();
if(!path.endsWith("/"))
path+="/";
for(int l=0;l<list.length;l++)
{
final CMFile F2=new CMFile(path+list[l],nul... | 7 |
@Id
@Column(name = "module_id")
public String getModuleId() {
return moduleId;
} | 0 |
public static void checkfile()
{
File file = new File(Homework_datetimecheck.memberurl);
boolean fexists = file.exists();
if (!fexists) {
new add_new_user().setVisible(true);
}
... | 1 |
public static String replaceChatColors(String s) {
for (ChatColor c : ChatColor.values()) {
s = s.replaceAll("&" + c.getChar(), ChatColor.getByChar(c.getChar()) + "");
}
return s;
} | 1 |
public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... | 6 |
public String toXmlString() {
StringBuilder sb = new StringBuilder("<apon:address>");
if (this.line1 != null) {
// optional
sb.append("<apon:line1>" + this.line1 + "</apon:line1>");
}
if (this.line2 != null) {
// optional
sb.append("<apon:line2>" + this.line2 + "</apon:line2>");
}
if (this.lin... | 8 |
public static void main(String[] args) {
String[] stateList = CSVStrings.MALE_CSV.split("-");
String[] yearList = stateList[0].split(",");
for (int i = 1; i < yearList.length; i++)
{
_populationByYearList.add(new PopulationYear(Integer.parseInt(yearList[i])));
}
parse(stateList, ... | 3 |
private static void displayPatients(ResultSet rs)throws SQLException{
StringBuilder bf = new StringBuilder();
while (rs.next()){
bf.append(rs.getInt("pid")).append(": ");
bf.append(rs.getString("firstname")).append(" ");
bf.append(rs.getString("lastname"));
System.out.println(bf.toString());
bf.de... | 1 |
public BoardNode[] startingNodes(int color){
int count = 0;
if(color == 1){
int y;
for(y = 1; y<7; y++){
if(this.getNode(0, y).getColor() == color){
count++;
}
}
y = 1;
BoardNode... | 9 |
public int divide(int dividend, int divisor) {
int result = 0;
if (Math.abs(dividend) < Math.abs(divisor) || dividend == 0 || divisor == 0) {
return result;
}
boolean isPositive = true;
if (dividend < 0 && divisor > 0 || dividend > 0 && divisor < 0) {
isPo... | 9 |
@Override
public void processOneGameTick(long lastFrameTime) {
entityManager = LLP.entityManager;
buffer = new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB);
long offsetX = 0;
long offsetY = 0;
if (LLP.player != null) {
offsetX = entityManager.getComponent(L... | 7 |
public String convertToString(HashMap map) {
StringBuffer buf = new StringBuffer();
Iterator it = map.keySet().iterator();
while (it.hasNext()) {
String key = (String) it.next();
String value = (String) map.get(key);
try {
buf.append(URLEncoder.encode(key, "UTF-8"));
buf.append(DELIMITE... | 3 |
public static String assertRationalMatrix(double[][] matrix) {
if (matrix == null) {
return "The matrix is null";
}
int rows = matrix.length;
if (rows <= 1) {
return "The matrix does not have more than one row:" + NEWLINE
+ representMatrix(matrix, 3);
}
double[] firstRow = matrix[0];
i... | 8 |
public void setMaxTries(int maxTries) {
this.maxTries = maxTries;
} | 0 |
private ConnectionToClient findOpponent( ConnectionToClient client) throws NullPointerException
{
Long opponentId = -1L; // Default value for a long
ClientNode clientNode = new ClientNode(-999L);;
for( ClientNode node : clientList )
{// Iterate through all clients connected in the list
// If listClient d... | 9 |
@Override
public void actionPerformed(ActionEvent event)
{
try
{
if (event.getSource() == buy)
{
Item item = (Item) merchantsInventory.getSelectedValue();
// select item in merchantsInventory JList
startSel = merchantsInventory.getSelectedInde... | 9 |
public Ocean toOcean() {
Ocean newOcean = new Ocean(width, height, starveTime);
int x=0;
int y=0;
for(TypeAndSizeAndStarve runs: runLength)
for(int i = 0; i<runs.getSize(); i++){
if(y==width){
x++;
y=0;
}
if(runs.getType() == 1){
newOcean.addShark(y, x, starveTime);
y++;
... | 5 |
public
void registerInterestIn( Class<? extends Data>... someInterestedData ) {
//iterate over the array of data types
for( int i = 0; i < someInterestedData.length; ++i ) {
//and add them to the interest list
_interestedDataList.add( someInterestedData[i] );
}
... | 3 |
private void saveMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuItemActionPerformed
// TODO add your handling code here:
int returnVal = saveFileChooser.showSaveDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = saveFileChoos... | 3 |
void prep(char grid[][]){
int n = grid.length;
int m = grid[0].length;
foldedOrWhite = new int[n][m];
foldedOrBlack = new int[n][m];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(black(grid, i, j)) foldedOrWhite[i][j] = 0; else foldedOrWhite[i][j]... | 8 |
public static void readFromNetwork(int data) {
System.out.println("Read from network: " + data);
switch (data) {
case 100:
bronzeChest.removeItems();
LOCKS[3] = true;
break;
case 101:
ROOMS[0].removeItem(silverKey);... | 9 |
public void setExpired(boolean expired) {
this.expired = expired;
} | 0 |
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.