text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void checkDisplayCollision() {
int futureX = this.getLocation().x - moveRichtungX;
int futureY = this.getLocation().y - moveRichtungY;
if (futureX > 0)
futureX += moveRichtungX;
if (futureY > 0)
futureY += moveRichtungY;
if (this.getLocation().x + getLevelWidth() - moveRichtungX < Start
.ge... | 4 |
private boolean canMoveDiagonal(Grid grid, Position pos) {
for (Element element : grid.getElementsOnGrid()) {
if (element instanceof Player
&& ((Player) element).getLightTrail().getPositions().contains(new Position(pos.getxCoordinate(), pos.getyCoordinate() - 1))
&& ((Player) element).getLightTrail().get... | 4 |
public void getKnightGraph(mxAnalysisGraph aGraph, int xDim, int yDim)
{
if (xDim < 3 || yDim < 3)
{
throw new IllegalArgumentException();
}
int numVertices = xDim * yDim;
mxGraph graph = aGraph.getGraph();
Object parent = graph.getDefaultParent();
Object[] vertices = new Object[numVertices];
fo... | 6 |
public double value() {return value;} | 0 |
private void setChars(char [][] board)
{
for(int x = 1; x < board.length; x++)
{
for(int y = 1; y < board[x].length; y++)
{
//matches each index to their corresponding char in the sym array and replaces them
//based on the char number generated earlier
if(board[x][y] == '1')
board[x][y] = sy... | 6 |
public void drawGround(Graphics2D gI)
{
gI.setColor(new Color(10, 170, 10));
gI.fillRect(0, 0, Chunk.getPixelLength(), Chunk.getPixelLength());
} | 0 |
protected void write(String event, int resID, double clock)
{
if (!record_) {
return;
}
// Write into a results file
FileWriter fwriter = null;
try
{
fwriter = new FileWriter(super.get_name(), true);
}
catch (Exception ex)
... | 4 |
public void keyReleased(KeyEvent e) {
// Si se presiona la tecla P, se pausa y despausa el juego
if (e.getKeyCode() == KeyEvent.VK_P) {
if(!gameover & inicia){
pausa =! pausa;
}
}
// Si se presiona la tecla S, suena o deja de sonar la musi... | 9 |
public static RepNotification UPDATE_REPONSE(OVNotification ovNotification) throws SQLException {
RepNotification rep = new RepNotification();
Connection connexion = GET_CONNECTION();
try {
Statement statement = connexion.createStatement();
int resultat = statement.exe... | 5 |
public void dieHero(Hero hero)
{
if (heroes.remove(hero)) {
deadHeroes.add(hero);
}
} | 1 |
public static void formatTriangles(byte data[], int id) {
if (data == null) {
ModelHeader modelHeader = Model.modelHeaderCache[id] = new ModelHeader();
modelHeader.vertexCount = 0;
modelHeader.triangleCount = 0;
modelHeader.texturedTriangleCount = 0;
return;
}
Stream buffer = new Stream(data);
bu... | 6 |
public void delete(String whereString){
StringBuffer sql = new StringBuffer("");
sql.append("Delete from `SubSection`");
if (whereString.trim() != "") {
sql.append(" where " + whereString);
}
SQLHelper sQLHelper = new SQLHelper();
sQLHelper.sqlConnect();
... | 1 |
public static void changeSelectionToNode(JoeTree tree, OutlineLayoutManager layout) {
Node selectedNode = tree.getOldestInSelection();
// Update Selection
tree.clearSelection();
tree.addNodeToSelection(selectedNode);
// Record State
tree.setEditingNode(selectedNode);
tree.setCursorPosition(0);
tree.... | 0 |
public void endElement(String uri, String localName,
String qName)
throws SAXException {
if(qName.equals("hits")) {
inHits = false;
}
if(qName.equals("score")) {
inScore = false;
}
if(qName.equals("color")) {
inColor = false;
}
if(qName.equals("brickConfiguration"))... | 4 |
public void makeStep() {
if(Utils.DEBUG) {
curAli.checkCons();
if(curDist != distCalc.dist(curAli))
throw new Error("Inconsistency in distance calculation");
if(curPi != logPi(curDist))
throw new Error("Inconsistency in likelihood calculation: "+logPi(curDist));
}
int type = Utils.generator.next... | 9 |
@Override
public void setStructure(boolean[][] adjMatrix) throws RuntimeException {
if( adjMatrix.length != nodeIndexing.getNodesNumber() || adjMatrix[0].length != nodeIndexing.getNodesNumber())
throw new IllegalArgumentException("Error: the adjacency matrix must be an NxN matrix where N is the number of nodes... | 7 |
@EventHandler
public void BlazeHarm(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.getBlazeConfig().getDouble("Blaze.Harm.DodgeCha... | 6 |
private void declaration_list(){
tokenActual = analizadorLexico.consumirToken();
if(tokenActual!=null){
if(tokenActual.obtenerLexema().equals("void") || tokenActual.obtenerLexema().equals("int") || tokenActual.obtenerLexema().equals("char")){
tokenActual = analizadorLexico.co... | 8 |
public void setCanvas(PersistentCanvas canvas) {
this.canvas = canvas;
} | 0 |
public static int maxPathSum(int[][] grid) {
int path[][] = new int[grid.length][grid[0].length];
int col, row;
row = grid.length;
col = grid[0].length;
path[0][0] = grid[0][0];
for (int i = 1; i < row; i++) {
path[i][0] = path[i-1][0] + grid[i][0];
}
for (int j = 1; j < col; j++) {... | 5 |
@Test
public void testValueOf() {
UserAgent userAgent = UserAgent.parseUserAgentString("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)");
UserAgent retrievedUserAgent = UserAgent.valueOf(userAgent.getId());
assertEquals(userAgent, retrievedUserAgent);
} | 0 |
public E pop() {
final E returnValue = (E) stack.get(stack.getSize()-1);
stack.delete(stack.getSize()-1);
return returnValue;
} | 0 |
public static SpriteID getAbilitySprite(AbilityType type) {
SpriteID sprite = null;
switch (type) {
case abil_tar_heal:
sprite = AbilitySprite.heal;
break;
case abil_aim_fire:
sprite = AbilitySprite.fire;
break;
... | 4 |
public Vector splitAsciiTo(int split,String msg)
{
Vector blocks=new Vector();
String ascii=this.return_ascii(msg);
int i=0;
System.out.println();
while(true)
{
//System.out.println(i);
if(i+split<ascii.length())
blocks.addElement(ascii.substring((int)i,(int)(i+split)));
else
{
bloc... | 2 |
@Override
public Object clone() {
Object clonedObject;
try {
clonedObject = super.clone();
TransactionRecord t = (TransactionRecord)clonedObject;
if (account != null)
account.addReference();
if (transferAccount != null)
... | 6 |
@Override
protected void parseInternal(Method method, Map<String, Integer> paramIndexes,
Map<String, Integer> batchParamIndexes) throws DaoGenerateException {
super.parseInternal(method, paramIndexes, batchParamIndexes);
// 解析Vkey的相关表达式级参数信息
if (StringUtils.isNotEmpty(vkey)) {// 对于单个缓存对象,可以允许不设置vkey
Expre... | 1 |
public Main() {
setIconImage(Toolkit.getDefaultToolkit().getImage(Main.class.getResource("/net/lotusdev/medusa/client/res/keyboard.png")));
setTitle("Medusa Logger (v" + getVersion() + ")");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 488, 317);
JMenuBar menuBar = new JMenuBar();
... | 5 |
@Override
public void writeToData(DataOut dataOut) throws IOException {
dataOut.writeInt(classes.size());
for(Class c : classes) {
dataOut.writeUTF(c.getName());
}
} | 1 |
@Override
public boolean parseField(String name, String value){
if (super.parseField(name, value)){
return true;
}
if (name != null && value != null){
PeripheralFieldHandler handler = EnumUtils.lookup(PeripheralFieldHandler.class, name);
if (handler != null){
return handler.handle(device, value);... | 4 |
public K getMin(){
K minKey = null;
Double minValue = Double.valueOf(Double.MAX_VALUE);
for (Map.Entry<K, Double> entry : map.entrySet()){
//if this value is less than the minValue found so far
if (entry.getValue().compareTo(minValue)<0){
minValue = entry.... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TracksInPlaylistsEntityPK that = (TracksInPlaylistsEntityPK) o;
if (playlistId != that.playlistId) return false;
if (trackId != that.trackId) r... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Device)) return false;
Device device = (Device) o;
if (id != device.id) return false;
if (name != null ? !name.equals(device.name) : device.name != null) return false;
if (own... | 7 |
public void repaint(Graphics g, int x, int y) {
painted.set(true);
Graphics2D g2d = (Graphics2D) g;
Composite previousComposite = g2d.getComposite();
int i = 0;
long timeBetween = System.currentTimeMillis() - lastLoop;
final Iterator<LogEntry> iterator = logEntries.iterator();
while (iterator.hasNext())... | 4 |
public static void main(String args[]) {
/*
* 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 fe... | 6 |
public void saveModel() {
try {
if (m_fileChooser == null) {
// i.e. after de-serialization
m_fileChooser =
new JFileChooser(new File(System.getProperty("user.dir")));
ExtensionFileFilter ef = new ExtensionFileFilter("model", "Serialized weka clusterer");
m_fileChooser... | 7 |
public void workWeek() {
for (int i=0; i<5; i++)
{
this.makeShake();
}
this.earnPaycheck();
this.setEffMult(1);
} | 1 |
public void increaseRope(int x , int y) {
if (ropelength < 125){
ropelength ++;
}
x += 1;
y += 2;
switch (ropelength) {
case 1: getWorld().addObject(rope, x, y); getWorld().addObject(ropeman, x, y+3); break;
case 25: y+= 2; getWorld().addObject... | 7 |
public Vector getInfo()
{
return v;
} | 0 |
public String[] getUserNames() {
ArrayList < Client > tclients = new ArrayList < Client > ();
tclients.addAll(clients);
for (int i = 0; i < channels.size(); i++) {
ArrayList < Client > clients = channels.get(i).getUsers();
for (Client c: clients) {
i... | 4 |
private boolean editTypeWorkFrame(){
boolean ret = false;
String name;
int id;
if (jTableTypeWork.getSelectedRow() == -1 ){
// значит ничего не выбрали
SMS.message(this, "Вы ничего не выбрали для редактирования!");
return ret;
}
... | 8 |
public boolean validMove(String world, int x, int y, int moveTileType, int currentTileType, int orgUID){
if ((lookup.invalidMoveCost != moveCost(moveTileType, orgUID)) && // If he has enough energy to move off current tile
(org.getEnergy(orgUID)>=moveCost(currentTileType, orgUID)) && // ... | 5 |
public static IPv6Network getByAddress(String address, int mask) throws NetworkException {
if ((mask < 0) || (mask > 128)) {
throw new InvalidAddressException(String.format("'%d' is not a valid IPv6 mask.", mask));
}
try {
return new IPv6Network(new BigInteger(Inet6Addres... | 3 |
public List<String> purge() {
Iterator<TaskItem<R,C>> items = iterator();
List<String> results = new ArrayList<String>();
while(items.hasNext()) {
TaskItem<R,C> item = items.next();
// Leave completed tasks for results reporting:
if(!item.future.isDone()) {
results.add("Cancelling ... | 2 |
public static String encrypt(String input, String key){
int inputLength = input.length();
char[] out = new char[inputLength];
int code = key.hashCode();
Character[] mapping = randomizeArray(getMasterMapping(), code);
for(int i = 0; i < inputLength; i++){
char x = input.charAt(i);
if(x < 32 && x != 9 && ... | 7 |
public TreeLinkNode connectNextLine(TreeLinkNode first) {
TreeLinkNode nextPreHead = new TreeLinkNode(0);
TreeLinkNode next = nextPreHead;
while (first != null) {
if (first.left != null) {
next.next = first.left;
next = next.next;
}
... | 3 |
private void doDecode() {
File file = null;
showMessage("uncompressing");
try {
int retval = ourChooser.showOpenDialog(null);
if (retval != JFileChooser.APPROVE_OPTION) {
return;
}
file = ourChooser.getSelectedFile();
St... | 8 |
public CommunicationProtocol(InetAddress inetAddress, int port, UserManagement userManagement, String analyticsServerRef, String billingServerRef, Registry registry) {
this.inetAddress = inetAddress;
this.tcpPort = port;
this.userManagement = userManagement;
this.analyticsServerRef = analyticsServerRef;
this.... | 6 |
protected Class loadClassByDelegation(String name)
throws ClassNotFoundException
{
/* The swing components must be loaded by a system
* class loader.
* javax.swing.UIManager loads a (concrete) subclass
* of LookAndFeel by a system class loader and cast
* an instan... | 8 |
public PogNode chooseNeighborWeighted(TreeQualifier qualifier, Random generator, double beta) {
Node editedNode = null;
boolean isAdded = false;
if (addableList.isEmpty() && removableList.isEmpty()) { // this is a null node; choose a node to add from the whole dataset
isAdded = true;... | 8 |
public static void insertSort2(int[] array, int index) {
System.out.println("index == " + index);
if (index > 1) {
insertSort2(array, index - 1);
}
int i = index - 1;
int key = array[index];
while (i >= 0 && array[i] > key) {
array[i + 1] = array[i];
i--;
}
if (i != index - 1) {
array[i + 1]... | 4 |
private String extrahiereRichtung(Befehlszeile befehlszeile)
{
// Ist der Befehl ein Shortcut?
// o,n,s,w
String richtung = translateShortcut(befehlszeile.getZeile());
if(richtung != null)
return richtung;
// Ist der Befehl eine lange Richtung ?
// gehe …
if(befehlszeile.beginntMit(TextVerwalter.BEFE... | 5 |
private void calculateNext() {
addPoints(next_point, point_vector, next_point);
if (!isPointLegal(next_point)) {
addPoints(starting_point, starting_point_vector, starting_point);
clonePoints(starting_point, next_point);
}
} | 1 |
public static Configuration getConfiguration() {
return configuration;
} | 0 |
public String done ()
// count territory and return result string
// notifies BoardInterface
{
if (Pos.haschildren()) return null;
clearmarks();
getinformation();
int i, j;
int tb = 0, tw = 0, sb = 0, sw = 0;
P.getterritory();
for (i = 0; i < S; i++)
for (j = 0; j < S; j++)
{
if (P.territory(... | 9 |
public WindowMenuItem(String text, OutlinerDocument doc) {
super(text);
this.doc = doc;
group.add(this);
} | 0 |
@Test
public void resolve() {
int n = 2000000;
long sum = 0;
Primes.isPrime(n);
for (int p : Primes.primes) {
if (p < n) {
sum += p;
}
}
print(sum);
} | 2 |
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(sprung)
return super.okMessage(myHost,msg);
if(!super.okMessage(myHost,msg))
return false;
if((msg.amITarget(affected))
&&(!msg.amISource(invoker())))
{
if((msg.targetMinor()==CMMsg.TYP_ENTER)
||(msg.targetMino... | 9 |
@Override
public String toString(){
Date d = new Date();
d.setTime(gameActiveMs);
String res = "";
res += "Game: " + gameName + "\n";
res += "Id: " + matchId + "\n";
res += "Mode: " + gameMode + "\n";
res += "Active: " + d.toString(... | 7 |
private IDAReturnValue EIDAStar(State state, long stateId, int gScore, int threshold,
Cost cost, ArrayList<Action> solution) {
// Probes the transposition table.
if (transTable.containsKey(stateId)) {
TransEntry entry = transTable.get(stateId);
... | 9 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VacationEntry other = (VacationEntry) obj;
if (days != other.days)
return false;
if (startDate == null)
{
if (other.startDate != null)... | 7 |
private static void sortBlock(File[] files, int start, int end, File[] mergeTemp) {
final int length = end - start + 1;
if (length < 8) {
for (int i = end; i > start; --i) {
for (int j = end; j > start; --j) {
if (compareFiles(files[j - 1], files[j]) > 0) {
final File temp = files[j];
... | 9 |
private void travelTree(TreeNode node, List<Integer> result) {
TreeNode left = node.left;
TreeNode right = node.right;
//travel left
if(null != left) travelTree(left, result);
//record
result.add(node.val);
//travel right
if(null != right) travelTree(righ... | 2 |
public static int solution(final String s) {
// If it's empty then it's nested properly.
if (s.length() == 0) {
return 1;
}
// If not even then it can't be nested properly.
if (s.length() % 2 != 0) {
return 0;
}
char c;
Stack<Cha... | 9 |
public StreetConfig(SSGlobals glob) throws FileNotFoundException
{
fGlobals = glob;
fStreets = new HashMap<String, StreetTemplate>();
try
{
parse();
}
catch (ParserConfigurationException e)
{
throw new FileNotFoundException("Die Strassen-Konfigurationsdatei konnte nicht gefunden werden");
}
cat... | 4 |
private static boolean isAssertionField(Exprent exprent, String classname, String key, boolean throwInIf) {
if (throwInIf) {
if (exprent.type == Exprent.EXPRENT_FUNCTION) {
FunctionExprent fparam = (FunctionExprent)exprent;
if (fparam.getFuncType() == FunctionExprent.FUNCTION_BOOL_NOT &&
... | 9 |
public int getSellerType() {
return sellerType;
} | 0 |
public Cli()
{
console = new OSConsole("Batch Sequencer");
console.setCommandListener(this);
console.login();
} | 0 |
public static Integer getGirlToBoyRashiDistance(Rashi boyRashi, Rashi girlRashi) {
int boyNumber = boyRashi.ordinal() + 1;
int girlNumber = girlRashi.ordinal() + 1;
int distance = 0;
if (boyNumber > girlNumber) {
distance = boyNumber - (girlNumber - 1);
}
if (boyNumber < girlNumber) {
distance = (boy... | 3 |
private int no_Between (ABObject o1, ABObject o2)
{
double minX = o1.getMaxX();
double maxX = o2.getMinX();
int no = 0;
for (int i = 0; i < shelters.size(); i++)
{
ABObject o = shelters.get(i);
double _minX = o.getMinX();
double _maxX = o.getMaxX();
if (_minX <= maxX && _minX >= minX && _maxX <= ... | 5 |
private void start() throws FileNotFoundException, IOException, InterruptedException, ExecutionException {
BufferedReader brWatson = new BufferedReader(new FileReader(new File(this.inputWatson)));
String bufferedHeader = brWatson.readLine().substring(1);
for (int i = 0;;) {
List<Sequ... | 7 |
public static void main(String[] args) {
int i, n;
double x, y;
System.out.println("Derivada numerica con Polinomio de Lagrange "
+ "CON 2 o 3 PUNTOS CONOCIDOS");
do {
do {
System.out.println("Escriba el numero de puntos conocidos");
... | 9 |
public void setStatus(Boolean newStatus) throws IOException {
if (status==newStatus) return;
System.out.println("Switching "+channel+" to: "+(newStatus?"ON":"OFF"));
switch (channel) {
case 'A' : switch_a(newStatus); break;
case 'B' : switch_b(newStatus); break;
}
status=newStatus;
} | 4 |
private void deleteCase4(RBTreeNode<K,V> node) {
//If sibling's tree has longer black paths
if(nodeColor(node.parent) == Color.RED &&
nodeColor(node.sibling()) == Color.BLACK &&
nodeColor(node.sibling().left) == Color.BLACK &&
nodeColor(node.sibling().righ... | 4 |
static void SPCMacro (RG2ROM program, String destination)
throws IllegalArgumentException
{
int length = program.command.length; //May or may not fit in the available 60 lines of space.
final int x_base = 127;
final int y_base = 98; //97.5 teleports into the ground below the torches.
final int z_base = -21... | 5 |
public void movimiento() {
int mov = (int) (Math.random() * (4 - 1 + 1) + 1);
// 1 es X positivo
// 2 es X negativo
// 3 es Y positivo
// 4 es Y negativoç
switch (mov) {
case 1:
if (x == Mundo.mundo_X - 1) {
x = 0;
... | 8 |
public void visitLabel(final Label label) {
mv.visitLabel(label);
if (constructor && branches != null) {
List frame = (List) branches.get(label);
if (frame != null) {
stackFrame = frame;
branches.remove(label);
}
}
} | 3 |
private String[] loadConfig() {
String[] defaults = new String[] {
"ip=localhost", "port=9190", "heartbeat=1000", "pass=UNSET", "debug=false"
};
String[] data = new String[defaults.length];
try {
File folder = getDataFolder();
if(!folder.exists()) {
folder.mkdir();
}
File file ... | 7 |
@Override
public void actionPerformed(ActionEvent arg0) {
String s = arg0.getActionCommand();// message from the clicked button
switch (s) {
case "Add New Employee":
addEmployee();
break;
case "View Current Employees":
case "Back to Employee List":
goToEmployeeListMenu();
break;
case "Save and ... | 9 |
@Override
public void run()
{
while (true)
{
lock.lock();
Socket client;
try
{
client = socket.accept();
log.debug("new client: " + client.getInetAddress().toString());
handleConnection(client);
}
catch (IOException e)
{
e.printStackTrace();
}
try
{
await.awai... | 3 |
public GlassSword(){
this.name = Constants.GLASS_SWORD;
this.attackScore = 12;
this.attackSpeed = 14;
this.money = 410;
} | 0 |
public final void addBad(Opponent opp) {
bad[badPointer] = opp;
badPointer++;
if (badPointer == bad.length) {
badPointer = 0;
}
} | 1 |
public static Vector Half(Vector Vec, boolean X, boolean Y, boolean Z) {
if (X) {Vec.setX(Vec.getX()*0.5);}
if (Y) {Vec.setY(Vec.getY()*0.5);}
if (Z) {Vec.setZ(Vec.getZ()*0.5);}
return Vec;
} | 3 |
public void dumpRegion(String line) {
String parens = "{\010{}\010}<\010<>\010>[\010[]\010]`\010`'\010'"
.substring(options * 6, options * 6 + 6);
pw.print(parens.substring(0, 3));
Enumeration enum_ = childBPs.elements();
int cur = startPos;
BreakPoint child = (BreakPoint) enum_.nextElement();
if... | 3 |
public boolean isMoving() {
return currAction == Action.MOVE || currAction == Action.MOVE_COMMITTED;
} | 1 |
public boolean hasChanged() {
if (!file.exists()) {
if (exists) {
exists = false;
return true;
}
return false;
}
if (!exists) {
exists = true;
this.timestamp = file.lastModified();
return true;
}
long current = file.lastModified();
if (current != timestamp) {
time... | 4 |
public void put(int key,int value){
int hash = getHashCode(key);
if(elements[hash]==null){
elements[hash] = new LinkedNode(key,value);
}
else{
LinkedNode node = (LinkedNode)elements[hash];
if(node.put(key,value)==false) {
return;
... | 2 |
public boolean outputFile(){
try {
this.outputFile = new File(outputFileName);
this.outputWritter = new BufferedWriter(new FileWriter(this.path + outputFile));
while (this.inputReader.ready()) {
String sLine = this.inputReader.readLine();
if (!sLine.equals(null) && sLine.length() >= 1) {
if ... | 9 |
public static BufferedImage buildHitmap(ArrayList<Entity> props) {
BufferedImage hitmap = new BufferedImage(800, 600, BufferedImage.TYPE_BYTE_BINARY);
PathQuad.size = new Dimension(800, 600);
Graphics2D g = hitmap.createGraphics();
for(int x = 0; x<props.size(); x++) {
if(props.get(x).isSolid())
g.fil... | 2 |
public static void writeStandardOutput() {
if (writingStandardOutput)
return;
try {
out.close();
}
catch (Exception e) {
}
outputFileName = null;
outputErrorCount = 0;
out = standardOutput;
writingStandardOutput = true;
} | 2 |
static int getDendrogramSize(int n) {
if (n < 2) {
return 0;
}
int cn = 2;
int cs = 50;
while (cn < n) {
cn++;
if (3 <= cn && cn <= 5) {
cs += 50;
}
if (6 <= cn && cn <= 10) {
cs += 30;
... | 8 |
public static void upload(){
readProjectDbInfo();
if(!Check.NULLCheck(projectName)||!Check.NULLCheck(dbconS)||!Check.NULLCheck(un)
||!Check.NULLCheck(pwd)||!Check.NULLCheck(data_db_name)||!Check.NULLCheck(channel))
return;
SFTPMultiThread.multiThreadUpload(projectNa... | 6 |
public static void main(String[] args) {
ObjectOutputStream objectWriter = null;
ObjectInputStream objectReader = null;
try {
objectWriter = new ObjectOutputStream(new FileOutputStream(
"student.dat"));
objectWriter.writeObject(new Student(1, "A", "a"));
objectWriter.writeObject(new Student(2, "B", ... | 3 |
public void reload(List<String> list) {
setEnabled(false);
// Clear out all menu items
for (int i = getMenuComponentCount() - 1; i >= 0; i--) {
remove(0);
}
// Copy from Prefs into Menu
JMenuItem mi;
for (String f : list) {
if (f == null) { // Stop on first missing
break;
}
// Drop from l... | 4 |
public int sendMultipleQueueMessage(int priority, int receiver, int context,
String content, List<Integer> queues) {
int status = -1;
if (messageBroker == null) {
log.error("There is no broker connecting to server");
} else {
if (messageSenderBroker == null) {
messageSenderBroker = messageBrok... | 7 |
public void loadConfiguration(){
File fichier_language = new File(getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
Language.options().header("Supports unicode characters ! \n<3, [*], [**], [p], [v], [+], [++]");
Language.a... | 7 |
public static double asinh(double a) {
boolean negative = false;
if (a < 0) {
negative = true;
a = -a;
}
double absAsinh;
if (a > 0.167) {
absAsinh = FastMath.log(FastMath.sqrt(a * a + 1) + a);
} else {
final double a2 = a * a;
if (a > 0.097) {
absAsinh = a
* (1 - a2
* (F_1... | 6 |
@Override
public void keyPressed(KeyEvent ke) {
if(ke.getKeyChar() == 'c') {
lastTool = curTool;
curTool = 2;
} else if(ke.getKeyChar() == 'l') {
lastTool = curTool;
curTool = 3;
} else if(ke.getKeyChar() == 'f') {
lastTool = curTool;
curTool = 1;
} else if(ke.getKeyChar() == 'd') {
lastTo... | 8 |
public static void main(String[] args) {
int c = 0;
double check = 0;
outerloop:
for(int a = 1; a < 1000; a++)
{
for(int b = 1; b < 1000; b++)
{
check = Math.sqrt((a * a) + (b * b));
c = (int) Math.sqrt((a * a) + (b * b));
if(check == c)
{
if(a + b + c == 1000 && a < b && b < c)
... | 6 |
public static void main(String[] pArgs) {
try {
TableViewColumn[] columns =
{
new DefaultTableViewColumn(
"Name",
Row.class.getDeclaredMethod("getName", null),
Row.class.getDeclaredMethod("setName", new Class[] {String.class})),
new DefaultTableV... | 2 |
public void setTrainNumber(TrainNumber value) {
this._trainNumber = value;
} | 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.