text stringlengths 14 410k | label int32 0 9 |
|---|---|
public String generateCacheKey(Object[] args) {
String oriKey = buildSimpleKey(args, getParsedKey(), getKeyGetterMethods(), getKeyParameterIndexes());
StringBuilder cacheKey = new StringBuilder();
cacheKey.append(oriKey);
Page page = getPageArgument(args);
if (page != null) {
cacheKey.append("-p").appen... | 1 |
private double average(int[] record){
int sum=0;
int i;
double avg;
int ct = 0;
for (i=0;i<record.length;i++){
sum = sum+record[i];
System.out.printf("\n the %d th record is %d\n",i, record[i]);
if (record[i]!=0)
ct=i;
}
avg = sum/(ct+1);
System.out.printf("\n the avg score is %f\n", avg);
... | 2 |
public BloodParticle(int id, int x, int y, int col, int size, double force, Dungeon dungeon, Random random) {
super(id, x, y, dungeon, random);
this.size = size + random.nextInt(2);
int r = random.nextInt(10);
if(r <= 10) this.col = 0xff752323;
if(r <= 7) this.col = 0xff912C2C;
if(r <= 3) this.col = 0xf... | 4 |
public static boolean applyLookAndFeelByName(String name)
{
try
{
if (name != null)
{
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
{
if (name.equals(info.getName()))
{
... | 4 |
@Override
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
if (event.isCancelled()) {
return;
}
Player player = event.getPlayer();
if (player.getGameMode().equals(GameMode.CREATIVE)) {
if (!this.config.yml.getBoolean("Game Mode.Separate In... | 6 |
private String buildMacroCall() {
// Assemble the file to get the available macros
MacroStatement[] macros = new SyntaxAnalyser(editor.getSourceFile()).getMacroStatements();
if(macros.length == 0) {
// No macros are available
UIUtilities.showErrorDialog(this, "No... | 5 |
public static Tetromino spawnRandomTetromino()
{
double rand = Math.random();
if (rand > .86)
return new SquareTetromino();
else if (rand > .72)
return new LineTetromino();
else if (rand > .58)
return new RightLTetromino();
else if (rand > .44)
return new LeftLTetromino();
else if (rand > .30)
... | 6 |
private void findNamesByTitle() {
Integer[] aPos = perPos.toArray(new Integer[perPos.size()]);
for(int p : aPos) {
String before;
int befPos;
if(pFill.matcher(tokens.get(p-1)).matches()) {
before = tokens.get(p-2);
befPos = 2;
}
else {
before = tokens.get(p-1);
befPos = ... | 3 |
public void leaveQueues(User leavingUser){
Iterator<Entry<Integer, Queue<User>>> it = gameQueueMap.entrySet().iterator();
while(it.hasNext()){
it.next().getValue().remove(leavingUser);
}
} | 1 |
@Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
AbsValueNode temp = (AbsValueNode) getChildAt(this.getChildCount() - 1);
assert(temp!=null);
Value test = (temp.evaluate(context));
if (test.getType() != VariableType.BOOLEAN)
... | 3 |
public void transmitFile(String src)
{
TextProcessor.spellcheckFile(src, "prepare_" + src);
TextProcessor.compressFile("prepare_" + src, "transfer_" + src);
initializeNetwork();
int delay = 0, time = 0;
LinkedList<String> path = network.dijkstrasShortestPath("control", "device");
System.out.println("\nSt... | 4 |
@Override
public void execute(VirtualMachine vm) {
((DebuggerVirtualMachine) vm).enterEnvironmentRecord(identifier, offset);
} | 0 |
public ListNode mergeTwpLists(ListNode l1, ListNode l2)
{
ListNode head = null;
ListNode n = null;
if (l1 == null)
{
head = l2;
return head;
}
if (l2 == null)
{
head = l1;
return head;
}
while (... | 9 |
private static String directUploadSession(InputStream is, OutputStream os) throws IOException, ClassNotFoundException{
//Wait for the downloader to put his session description on the stream
int timeout = 100;
while(is.available() < 10 && timeout > 0){
try { Thread.sleep(50);} catch (InterruptedException e)... | 8 |
void descendFileSystem(File startDir) throws IOException {
log.fine(String.format("FileSub.searchFiles(%s)%n", startDir));
if (startDir.isDirectory()) {
String name = startDir.getName();
for (String dir : IGNORE_DIRS) {
if (dir.equals(name)) {
log.finer("IGNORING " + startDir);
return;
}
... | 5 |
public List<Frame> getFramesForTargetLemma(String targetLemma){ //depricated
List<Frame> result = new ArrayList<Frame>();
for(Frame frame: frames){
if(frame.getTargetLemmaIDref().equals(targetLemma))
result.add(frame);
}
if(result.size()>0) return result;
return null;
} | 3 |
private ArrayList<File> searchTileFiles() {
File dir = new File("assets/tiles");
String find = ".pbt";
File[] files = dir.listFiles();
ArrayList<File> matches = new ArrayList<File> ();
if (files != null) {
for (int i = 0; i < files.length; i++) {
... | 3 |
@Override
public Model getRotatedModel() {
if (npcDefinition == null)
return null;
Model rotatedModel = getChildModel();
if (rotatedModel == null)
return null;
super.height = rotatedModel.modelHeight;
if (super.graphicId != -1 && super.currentAnimationId != -1) {
SpotAnimation spotAnimation = SpotAn... | 8 |
private boolean checkToSetCodedContent(Element in, Component out) {
// first look for coded content
CodedContentCollection collector = new CodedContentCollection();
// String codedID = in.getAttribute("name");
if (in.getAttribute("radlex:id") != null && in.getAttribute("radlex:id") != "") {
collector.add(in.... | 7 |
@Override
public void doAction(Player player, Grid grid) throws InvalidActionException {
if (player.getRemainingTurns() <= 0)
throw new InvalidActionException("The player has no turns left!");
Position currentPos = player.getPosition();
Position newPos = new Position(currentPos.getxCoordinate() - 1, curren... | 3 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
FileModel file = historyFileListUtils.getFileAt(rowIndex);
switch (columnIndex) {
case 0:
return file.getFrom().toString();
case 1:
return file.getTo().toString();
case 2:
return fi... | 5 |
private byte[] padPassword(byte[] password) {
if (password == null) {
password = new byte[0];
}
// Step 1: Pad or truncate the password string to exactly 32 bytes. If
// the password string is more than 32 bytes long, use only its first 32
// bytes; if it is less th... | 3 |
@Override
public Object clone() {
return new Rabin((HashSet<Integer>) states.clone(), (HashSet<Integer>) liveStates.clone(), new Integer(initialState), (HashSet<AcceptingPair>) acceptanceCondition.clone(), (HashSet<Transition>) transitionRelation.clone());
} | 0 |
public int readProp() throws ServerException {
int port = 7070;
if (log.isDebugEnabled())
log.debug("Method call");
Properties prop = new Properties();
InputStream input = null;
try {
input = new FileInputStream("servConfig.properties");
prop.l... | 5 |
public static void main (String[] args) throws IOException{
char[] hexArray = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
// args[0] = "E:/1.txt";
File file = new File(args[0]);
BufferedReader in = new BufferedReader(new FileReader(file));
String line;
while ... | 5 |
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if((msg.amISource(mob))
&&(msg.tool()!=this)
&&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_CHANNEL))
&&((CMath.bset(msg.sour... | 7 |
public int getX() {
return x;
} | 0 |
@SuppressWarnings("unchecked")
public void eval(EvalContext context) {
context.logEntering("Comparaison " + operator);
right.eval(context);
Object rightB = context.pop();
context.log("Evaluating right operand: " + rightB);
//
left.eval(context);
Objec... | 6 |
public ArrayList<Politica> listAll(Connection c) throws SQLException {
String sql = "SELECT * FROM M_POLIROLL ORDER BY VCCODRUTINA ASC ";
ArrayList<Politica> results = new ArrayList();
ResultSet result = null;
PreparedStatement stm = null;
try {
stm = c.prepareStatem... | 9 |
public static void shiftMap(int position){
switch (position) {
case UP: map.setOffsetY(-15); break;
case DOWN: map.setOffsetY(15); break;
case LEFT: map.setOffsetX(-20); break;
case RIGHT: map.setOffsetX(20); break;
}
EntityManager.cleanUp();
} | 4 |
public String convert(HashMap<String, Integer> dv) {
String result = "" + from.getId();
for (String name : dv.keySet()) {
result += " " + name + ":" + dv.get(name);
}
return result + "\n";
} | 1 |
public User login(String username, String password) {
for (int i=0; i<members.size(); i++)
if (members.get(i).getUsername().equals(username) &&
members.get(i).getPassword().equals(password)) return members.get(i);
return null;
} | 3 |
public void rollBack() {
clear();
if (excecuteHistory == MOVE_DOWN) {
currentY--;
} else if (excecuteHistory == MOVE_LEFT) {
currentX++;
} else if (excecuteHistory == MOVE_RIGHT) {
currentX--;
} else if (excecuteHistory == ROTATE_CLOCKWISE) {
shape.rotate(false);
} else if (excecuteHistory == RO... | 5 |
protected long skipBytes(long bytes) throws BasicPlayerException
{
long totalSkipped = 0;
if (m_dataSource instanceof File)
{
log.info("Bytes to skip : " + bytes);
int previousStatus = m_status;
m_status = SEEKING;
long skipped = 0;
try
{
synchronized (m_audioInputStream)
{
notifyE... | 8 |
public ArrayList<Libros> getByNombre(Libros l){
PreparedStatement ps;
ArrayList<Libros> libros = new ArrayList<>();
try {
ps = mycon.prepareStatement("SELECT * FROM Libros WHERE nombre LIKE ?");
ps.setString(1, "%"+l.getNombrelibro()+"%");
ResultSet rs = ps.ex... | 4 |
public boolean willThisMoveCauseCheckOrEaten(int x, int y, int a, int b)
{
boolean causeCheck=false;
v1Bobby enemy = new v1Bobby(this.getB(), !color);
Point oldLocation= new Point(x,y);
Point p4=new Point(a,b);
boolean possibleMove=false;
boolean dontLook= false;
if(this.b[a][b].toString().charAt(1) != 'X... | 9 |
public InputManager(Component comp) {
this.comp = comp;
mouseLocation = new Point();
centerLocation = new Point();
// register key and mouse listeners
comp.addKeyListener(this);
comp.addMouseListener(this);
comp.addMouseMotionListener(this);
comp.addMouse... | 0 |
public void automataTransitionChange(AutomataTransitionEvent e) {
setDirty();
} | 0 |
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/xml; charset=UTF-8");
resp.setCharacterEncoding("UTF-8");
PrintWriter writer = new PrintWriter(new OutputStreamWriter(
resp.getOutputStream(), "UTF-8"), true);
writer.println("<?xml version... | 7 |
public static void printGamestats(ConcurrentLinkedQueue<AIConnection> globalClientsArg){
if(developerMode){
System.out.println("####################### GAME STATS: #######################");
for(AIConnection ai: globalClientsArg){
ai.printStats();
}
System.out.println("###########################... | 2 |
private void deleteBookingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteBookingButtonActionPerformed
int reply = jOptionPane.showConfirmDialog(this, "Are you sure you want to delete this booking?", "Delete?", jOptionPane.YES_NO_OPTION);
if (reply == jOptionPane.YES_OPTIO... | 4 |
Pawn(int t, boolean w, int x, int y){
super(t,w,x,y);
dist = 1;
if (!white) {
int[][] ex = {{1, 0}, {1, 1}, {1, -1}, {2, 0}};
moves = ex;
} else {
int[][] ex = {{-1, 0}, {-1, 1}, {-1, -1}, {-2, 0}};
moves = ex;
}
} | 1 |
public static void main(String args[]) throws Exception {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For det... | 6 |
public static void updateButtonBlock(Global global, EffectBlock block){
block.setBlockImg(global.getImageByName("block_btnDown"));
Block door = block.getAffectedBlock();
Rectangle origPos = block.getAffectedOrigPos();
//find doorway block
for (Block b : global.getCurrent().getCurrentVerse().getVerseBlocks(... | 6 |
public static void main(String[] args) throws IOException {
APIKey = getAPIKey();
String[] arguments = {"masteries","chaosdusk","adc"};
if (args.length != 0)
arguments = args;
switch(arguments.length) {
case 0:
displayHel... | 9 |
private static User deserialize(String serialized) {
User user = new User();
int start = serialized.indexOf("name:");
int end = serialized.indexOf(",", start + 5);
user.setName(serialized.substring(start + 5 ,end));
Logger.log("reading user's name: \"" + user.name + "\"");
start = serialized.indexOf... | 4 |
public String getUsedEncodingName(TLanguageFile file)
{
String back = "ISO-8859-1" ;
if (file != null)
{
// not WYSIWYG mode or the encoding is java utf with escape sequences
if ( !settings.getSaveWYSIWYGmode() ||
( TEncodingList.isJavaEncoding( file.getDefaultEncoding() ) ) )
... | 5 |
public String getCode(){
String str = "";
if(argumentListOpt!=null){
str += argumentListOpt.getCode();
}
str += this.printLineNumber(true) + "push := " + String.valueOf(this.currentLineNumber + 2) + "\n";
str += this.printLineNumber(true) + "goto := " + identifier.getNewName() + "\n";
return str... | 1 |
public void drawBanditInitial(Graphics g) {
if(player.getBandit().getRoomCoords(player.getBandit().getArea())[0]==-1
||player.getBandit().getRoomCoords(player.getBandit().getArea())[1]==-1) {
int i = player.getBandit().getAdjacentGrid()[0];
int j = player.getBandit().getAdjacentGrid()[1];
if(i==0) {
... | 6 |
private void load(Mesh mesh) {
int list = glGenLists(1);
glNewList(list, GL_COMPILE);
int type;
if (mesh.getType() == Mesh.TRIAGLES)
type = GL_TRIANGLES;
else if (mesh.getType() == Mesh.QUADS)
type = GL_QUADS;
else
throw new RuntimeException(
"critical error, no typ given -> someone hacked som... | 7 |
@Override
public StringBuilder getHelpList(String helpStr,
Properties rHelpFile1,
Properties rHelpFile2,
MOB forMOB)
{
helpStr=helpStr.toUpperCase().trim();
if(helpStr.indexOf(' ')>=0)
helpStr=helpStr.replace(' ','_');
final List<String> matches=new Vector<String>();
for(f... | 9 |
* @return the count of the instances of the given collection
*
* @throws IOException if a data communication error occurs
* @throws CycApiException if the api request results in a cyc server error
*/
public int countAllInstances_Cached(CycFort collection, CycObject mt)
throws IOException, CycApi... | 1 |
public boolean isSetForCommitting() {
// TODO Auto-generated method stub
return session != null || session.getTransaction().isActive();
} | 1 |
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TimeSeriesDataItem)) {
return false;
}
TimeSeriesDataItem timeSeriesDataItem = (TimeSeriesDataItem) o;
if (this.period != null) {
if (!this.period.equa... | 8 |
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (averageGroundLevel < 0)
{
averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (averageGroundLevel < 0)
{
... | 7 |
void updateSubTree(double[][] A, edge nearEdge, node v, node root,
node newNode, double dcoeff, direction d )
{
edge sib;
switch( d )
{
case UP: //newNode is above the edge nearEdge
A[v.index][nearEdge.head.index] = A[nearEdge.head.index][v.index];
A[newNode.index][nearEdge.head.index... | 9 |
public Tiedostonkirjoittaja() {
} | 0 |
Point3f getMin() {
if (min == null)
min = new Point3f();
if (list.isEmpty()) {
min.set(0, 0, 0);
return min;
}
Cuboid c = getCuboid(0);
min.x = c.getMinX();
min.y = c.getMinY();
min.z = c.getMinZ();
synchronized (list) {
int n = count();
if (n > 1) {
for (int i = 1; i < n; i++) {
... | 7 |
public boolean experiment() {
int sum = 0;
for (int i = 0; i < diceScoreTracker.length; i++) {
diceScoreTracker[i] = 1 + (int)(6 * Math.random());
/* Loop through current scores and check if any add
up to 7 when compared to the newly inserted score */
/* With this method, the newly added value is c... | 4 |
private void Stop(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Stop
programmerThread.stop();
hidePanels(lastPane);
}//GEN-LAST:event_Stop | 0 |
@Override
public void learn() {
world.setData(Data.SHAPES[6]);
network.learn();
int i=0;
while (i < 100 && !Options.getOptions().getStopped()) {
// recuperer un certain nombre de donnees
int nbNew = (int)(Math.random() * world.getData().size());
double lx = Math.random();
double ... | 5 |
public TimerTask getAlarm() {
TimerTask task;
if(repeating) {
task = repeatingAlarm();
} else {
task = singleAlarm();
}
scheduledTask = task;
return task;
} | 1 |
public Metrics(final Plugin plugin) throws IOException {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null");
}
this.plugin = plugin;
// load the config
configurationFile = getConfigFile();
configuration = YamlConfiguration.load... | 2 |
protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
{
init();
this.options = options;
// an iterator for the command line tokens
Iterator iter = Arrays.asList(arguments).iterator();
// process each command line token
while (iter.... | 9 |
public static void loadPreferences(File prefSet) {
if (loadFrom == null){
try {
loadFrom = prefSet;
Scanner lineIter = new Scanner(prefSet);
lineIter.useDelimiter(",\n?");
String flag = null;
double value = 0;
int i = 0;
Preferences insert = new Preferences();
while (lineIter.hasNex... | 5 |
@After
public void tearDown() {
} | 0 |
public static String getString(byte [] src, int srcPos,int destPos,int length){
byte[] tmp=new byte[length];
System.arraycopy(src, srcPos, tmp, destPos, length);
return (new String(tmp).trim());
} | 0 |
public void setDoubleOptin(boolean doubleOptin) {
this.doubleOptin = doubleOptin;
} | 0 |
private void convertToUserTime(ArrayList result, double userTimeZone)
{
if (result == null) {
return;
}
double resTimeZone = resource_.getResourceTimeZone();
long[] array = null;
long from = 0;
try
{
// convert the start time of a loc... | 3 |
*/
protected void repaintProxyRow(Row row) {
repaint(getRowBounds(row));
for (OutlineProxy proxy : mProxies) {
proxy.repaintProxy(proxy.getRowBounds(row));
}
} | 1 |
private void newTournButtonActionPerformed(java.awt.event.ActionEvent evt) {
worlds = new ArrayList<>();
brains = new ArrayList<>();
} | 0 |
public void create(String user, String host) throws JSchException{
try{
// RFC 1964
Oid krb5=new Oid("1.2.840.113554.1.2.2");
// Kerberos Principal Name Form
Oid principalName=new Oid("1.2.840.113554.1.2.2.1");
GSSManager mgr=GSSManager.getInstance();
GSSCredential crd=null;
... | 2 |
private void onCommand(String cmd) {
String[] parts = cmd.split(" ");
if(parts.length < 1) {
return;
}
switch(parts[0]) {
case "/help":
output.println("Available commands:");
output.println("/help");
output.println("/start");
output.println("/list");
output.println("/kick");
break;... | 5 |
private void initializeLanguageMenuSelection() {
Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "initializeLanguageMenuSelection");
String languageWanted = PropertiesManager.getInstance().getKey("language");
if (languageWanted != null) {
switc... | 3 |
public void setOptstring(String optstring) {
if (optstring.length() == 0)
optstring = " ";
this.optstring = optstring;
} | 1 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 7 |
public void travelTo(double x1, double y1, int speed) {
// instantiate variables
double x0, y0; // current position
double theta1; // new heading
double forwardError; // distance from destination coordinates
double[] displacementVector = new double[2]; // vector connecting actual
// position to... | 9 |
private void runPPD(ATMCell cell){
boolean cellDropped = false;
double dropProbability = 0.0;
if (cell.getData().equals("")) {
this.dropSamePacketCell = false;
}
if (this.dropSamePacketCell == false) {
if (outputBuffer.size() > this.startDropAt) {
if (outputBuffer.size() < this.maximumBufferCe... | 8 |
private void removePlayer(Player plr) {
if(plr.Privatechat != 2) { //PM System
for(int i = 1; i < maxPlayers; i++) {
if (players[i] == null || players[i].isActive == false) continue;
players[i].pmupdate(plr.playerId, 0);
}
}
// anything can be done here like unlinking this player structure from any ... | 4 |
public BufferedImage getEffectImage(){
if((int)animation == 3){
animation =0.0f;
if(!isLooping){
stop =true;
}
}
if(!stop){
img = animImages[(int)animation];
animation += 0.33f;
return img;
}else{
img = stoppedImg;
return img;
}
} | 3 |
private Object getNextItem(Object component,
Object item, boolean recursive) {
if (!recursive) { return get(item, ":next"); }
Object next = get(item, ":comp");
if ((next == null) || !getBoolean(item, "expanded", true)) {
while ((item != component) && ((next = get(item, ":next")) == null)) {
item = getPa... | 5 |
public void gfxAll(int id, int Y, int X)
{
for (Player p : server.playerHandler.players)
{
if(p != null)
{
client person = (client)p;
if((person.playerName != null || person.playerName != "null"))
{
if(person.distanceToPoint(X, Y) <= 60)
{
person.stillgfx2(id, Y, X);
}
}
}
}
} | 5 |
public Packet packet() throws IOException {
if(eos)
return(null);
if(strm == null) {
strm = new StreamState();
page = in.page();
strm.init(page.serialno());
}
Packet pkt = new Packet();
while(true) {
int ret = strm.packetout(pkt);
if(ret < 0)
throw(new OggException()); /* ? */
... | 8 |
public CrossJoinIterable(Iterable<T> first, Iterable<TInner> second, Joint<T, TInner, TResult> joint)
{
this._first = first;
this._second = second;
this._joint = joint;
} | 0 |
public void update(GameContainer container, int delta) {
boolean isOn = InputChecker.isInputDown(container, KeyBindings.P1_INPUT);
if (!eventList.isEmpty() && eventList.get(0).isOn() == isOn) {
eventList.get(0).pushLength(delta);
} else {
eventList.add(0, new RhythmEvent(isOn, delta));
}
} | 2 |
public eNfa(List<State> states, List<String> symbols, List<Transition> transitions, State startingState,
List<State> acceptableStates) {
super(states, symbols, transitions, startingState, acceptableStates);
this.states = states;
this.symbols = symbols;
this.transitions = transitions;
this.startingState = s... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Server other = (Server) obj;
if (id != other.id)
return false;
return true;
} | 4 |
public void insert(TemperatureStatus t) {
Object[] args=new Object[2];
args[0]=t.pv;
args[1]="";
if (t.cooling) args[1]="cooling";
if (t.heating) args[1]="heating";
if (t.heating && t.cooling) args[1]="heating,cooling";
String sql="replace into pv set pv=?,output=?";
tp.u... | 4 |
public Boolean updatePosition()
{
Boolean retour = true;
// Choix de la nouvelle position
Integer[] mvt = model.move(new Neighborhood(this));
// Definition des variables pour la nouvelle position
Integer[] nextPos = new Integer[3];
nextPos[0] = line + mvt[0];
nextPos[1] = colonne + mvt[1];
nextPos[2]... | 8 |
private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
Convenio f = new Convenio();
if(!(txCodigo.getText().equals(""))||(txCodigo.getText().equals(null))){
f.setCodigo(Integer.parseInt(txCodigo.getText()));
}
... | 5 |
private void setMinMaxPoints(List<Vector> points) {
int minX = points.get(0).getBlockX();
int minY = points.get(0).getBlockY();
int minZ = points.get(0).getBlockZ();
int maxX = minX;
int maxY = minY;
int maxZ = minZ;
for (Vector v : points) {
int x = v.getBlockX();
int y = v.getBlockY();
int z =... | 7 |
public static void computePaths(Vertex source) {
source.setMinDistance(0.);
// Using PriorityQueue class with minDistance as a priority (see the comparator of Vertex)
PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>();
vertexQueue.add(source);
while (!vertexQueue.isEmpty()) {
Ve... | 3 |
public void initialize() {
String parameter = this.getParamString();
if(parameter.equals("")){
if(Configuration.dimX < Configuration.dimY){
radius = Configuration.dimX / 3.0;
}
else{
radius = Configuration.dimY / 3.0;
}
}
else{
radius = Double.parseDouble(parameter);
}
oneStep = 36... | 2 |
@Override
public void onTrackerStateChanged(int trackerState) {
trackeStateOK = false;
String errorMessage = "";
if (trackerState == 0)
trackeStateOK = true;
else if (trackerState == 1)
errorMessage = "Device not connected.";
else if (trackerState == 2)
errorMessage = "A firmware updated is require... | 7 |
public String combineStr(REPrimitiveFragment frag)
{
String ret = "[";
for(int i = 0; i < chars.length; i++)
{
if(chars[i] && frag.chars[i])
{
if(i == 91 - 32 ) ret += "\\[";
else if(i == 93 - 32) ret += "\\]";
else if(i == 94 - 32) ret += "\\^";
else if(i == 92 - 32) ret += "\\\\";
els... | 7 |
public boolean hasUnaryInput() {
if (left instanceof LvalExpression &&
((LvalExpression) left).hasUnaryInput()) {
return true;
}
if (middle instanceof LvalExpression &&
((LvalExpression) middle).hasUnaryInput()) {
return true;
}
if (right instanceof LvalExpression &&
((LvalExpress... | 6 |
public void testGraphWithMatrix() {
long[][] graph = {{0, 1, 7, 1000, 1000}, {1, 0, 1000, 4, 1}, {7, 1000, 0, 1, 1000}, {1000, 4, 1, 0, 1}, {1000, 1, 1000, 1, 0}};
long[][] paths = new long[5][5];
Floyd.calculate(graph, paths);
for (int i = 0; i < graph.length; i++) {
for (in... | 4 |
private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) {
int penalty = 0;
int numSameBitCells = 0;
int prevBit = -1;
// Horizontal mode:
// for (int i = 0; i < matrix.height(); ++i) {
// for (int j = 0; j < matrix.width(); ++j) {
// int bit = ma... | 8 |
public static void main(final String args[]) {
System.out.println("Starting launcher");
EventQueue.invokeLater(new Runnable() {
public void run() {
System.out.println("Creating new instance");
instance = new LauncherMain();
System.out.println("... | 8 |
public static void main(String[] args) {
Thread thread1 = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 5; i++) {
System.out.println("Hello: " + i + " Thread: " + Thread.currentThread().getName());
t... | 2 |
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.