text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void createUser(int totalUser, int totalGridlet,
int[] glLength, double[] baudRate, int testNum)
{
try
{
double bandwidth = 0;
double delay = 0.0;
for (int i = 0; i < totalUser; i++)
{
String ... | 3 |
public void keyPressed(KeyEvent e)
{
int i = targetList.getSelectedIndex();
switch (e.getKeyCode())
{
case KeyEvent.VK_UP:
i = targetList.getSelectedIndex() - 1;
if (i < 0)
{
i... | 4 |
public void removeCourse(Course course)
{
if (DEBUG) log("Find the courseWidget that contains the desired course");
CourseWidget target = null;
for (CourseWidget cw : courseWidgets)
{
if (cw.getCourse() == course)
{
target = cw;
}
}
if (target == null)
{
if ... | 6 |
public static byte[] sha(byte[] data) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance(SHA);
digest.update(data);
return digest.digest();
} | 0 |
public static float detectCollision(Collidable a,Collidable b) {
if (a == b)
return -1F;
float velMag1 = Vector.mag(a.getVelocity());
float velMag2 = Vector.mag(b.getVelocity());
float sampleFreq1 = velMag1 / a.getLargestDim();
float sampleFreq2 = velMag2 / b.getLargestDim();
float timeInterval = (... | 6 |
public static void declare(PrintStream w, Object... comps) {
w.println("// Declarartions");
for (Object c : comps) {
ComponentAccess cp = new ComponentAccess(c);
w.println(" " + c.getClass().getName() + " " + objName(cp) + " = new " + c.getClass().getName() + "();");
}... | 1 |
int numConnected(Piece p, int x, int y, boolean[][] board){
if(x<0 || x>=board.length || y<0 || y>=board[0].length || !board[x][y])
return 0;
board[x][y] = false;
int[] nums = {
numConnected(p,x+1,y,board),
numConnected(p,x-1,y,board),
numConnected(p,x,y+1,board),
numConnected(p,x,y-1,board),
... | 6 |
public boolean isCollideingWithBlock(Point pt1, Point pt2) {
for (int x = (int) (this.x / Tile.tileSize); x < (int) (this.x / Tile.tileSize) + 3; x++) {
for (int y = (int) (this.y / Tile.tileSize); y < (int) (this.y / Tile.tileSize) + 3; y++) {
if (x >= 0 && y >= 0 && x < Component.... | 9 |
@Override
public void printAnswer(Object answer) {
if (!(answer instanceof Boolean)) return;
System.out.print((Boolean) answer);
} | 1 |
@Override
public void mouseMoved(MouseEvent e) {
if(!isMouseGrabbed)
return;
Controls.c.setMousePoition((Test3DMain.frame.getX()+Test3DCanvas.WIDTH/2 - e.getPoint().x-3),(Test3DMain.frame.getY()+Test3DCanvas.HEIGHT/2 - e.getPoint().y-25));
//Grabs mouse back to Center of Window
try {
Robot robot =... | 2 |
public double getDexterity() {
return dexterity;
} | 0 |
final void method3782(Interface11 interface11, int i) {
try {
anInt7640++;
if (anInt7738 >= 3)
throw new RuntimeException();
if (i != 327685)
method3688(-94, -9, -90, -108, 41, -52, 70);
if (anInt7738 >= 0)
anInterface11Array7741[anInt7738].method45((byte) -47);
anInterface11_7745 = anIn... | 5 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jSplitPane1 = new javax.swing.JSplitPane();
jPanelTitre = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel... | 0 |
public boolean checkWin(GameState g)
{
if(townAlive.check())
{
if(!g.townAlive(townAlive.getRelational(), townAlive.getNum()))
return false;
}
if(townDead.check())
{
if(!g.townDead(townDead.getRelational(), townDead.getNum()))
return false;
}
if(mafiaAlive.check())
{
if(!g.mafiaAlive... | 8 |
public ParticleRenderer(String name, int number, int maxLife, Texture texture) {
super("particleRenderer:"+name);
this.particles = new ArrayList<Particle>(number);
Random r = new Random();
for (int i = 0; i<number;i++){
particles.add(new Particle(new Vector2f(10,10),1 + r.n... | 1 |
public Edge[] getEdges() {
Edge[] ret = new Edge[(n*deg) / 2];
int t = 0;
if(deg%2 == 0) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < i+(deg / 2) + 1; j++) {
if(i != j) {
ret[t++] = new Edge(v[i], v[j % n]);
... | 8 |
private String useTriangleVariables(String s) {
int n = view.getNumberOfInstances(TriangleComponent.class);
if (n <= 0)
return s;
int lb = s.indexOf("%triangle[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
TriangleComponent triangle;
while (lb != -1 && rb != -1) {
v = s.substr... | 9 |
public boolean buyItem(int itemID, int fromSlot, int amount) {
if (amount > 0 && itemID == (server.shopHandler.ShopItems[MyShopID][fromSlot] - 1)) {
if (amount > server.shopHandler.ShopItemsN[MyShopID][fromSlot]) {
amount = server.shopHandler.ShopItemsN[MyShopID][fromSlot];
}
double ShopValue;
double ... | 9 |
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
AnnotationVisitor av = mv.visitAnnotation(remapper.mapDesc(desc), visible);
return av == null ? av : new RemappingAnnotationAdapter(av, remapper);
} | 1 |
public synchronized boolean addGameLawEnforcer(
GameLawEnforcer gameLawEnforcer) {
if (gameEnforcerCount < gameEnforcers.length) {
gameEnforcers[gameEnforcerCount++] = gameLawEnforcer;
gameLawEnforcer.setGameRoom(this);
// gameLawEnforcer.start();
return true;
} else
return false;
} | 1 |
private void dibujaPaint(Graphics2D g2){
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.clip(new Rectangle2D.Float(0, 0, getWidth(), getHeight()));
switch (tipo){
case NONE:{
float x1=0,x2=... | 8 |
public void update() {
// update of the player. No, why so serious ?
this.player.update(this);
// test
this.updateTime();
// update of the monsters
// But, with a lot of monster, there will be too much operations ? oO
// So, let's check only for nearest only
for (int i=0; i<this.level.getMobs().lengt... | 6 |
public void call(String type, Object... params) {
if (!methods.containsKey(type)) {
throw new IllegalArgumentException("Not enough type");
}
Map<Method, Object> methods = this.methods.get(type);
for (Map.Entry<Method, Object> entry : methods.entrySet()) {
try {
... | 3 |
@Override
public void insertNames(UUID uuid, String... names) {
if (names == null || names.length == 0) {
throw new IllegalArgumentException("names must have at least one entry");
}
Integer playerId = null;
String query;
if (names.length == 1) {
quer... | 7 |
public void execute() throws MojoExecutionException {
appDb = new AppInitializer();
BdbTerminologyStore store = appDb.getDB();
ViewCoordinate vc = appDb.getVC();
ConceptVersionBI con = appDb.getBloodPressureConcept();
ConceptVersionBI newCon = null;
try {
createNewDescription(con);
ConceptChronic... | 3 |
protected void clearWordsBySpot(char[] guesses) {
ArrayList<Integer> letSpots = new ArrayList<Integer>(14);
for (int i = 0; i < guesses.length; i += 1) {
if (guesses[i] != '_') {
letSpots.add(i);
}
}
ArrayList<String> wordsToRemove = new ArrayList<... | 9 |
public void showProgress( int current ) {
jLabel2.setText("已完成 " + current + " bytes / " + filesize + " bytes");
progress.setValue( current*100/filesize );
} | 0 |
@SuppressWarnings("deprecation")
public void leaveGame(Player player, boolean normalLeave) {
player.setGameMode(GameMode.CREATIVE);
//player.setAllowFlight(true);
player.setHealth(20.0);
player.setFoodLevel(20);
player.setLevel(0);
for (PotionEffect effect : player.getActivePotionEffects()) {
player.... | 4 |
protected Response getReply() {
try {
if (read == null) {
read = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
String line;
int code = -1;
ArrayList<String> responses = new ArrayList<String>();
while ... | 6 |
@Override
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if(keyCode == KeyEvent.VK_LEFT){
mainPlayer.setLeft(false);
}
if(keyCode == KeyEvent.VK_RIGHT){
mainPlayer.setRight(false);
}
if(keyCode == KeyEvent.VK_UP){
mainPlayer.setUp(false);
}
if(keyCode == KeyEvent.VK_DOWN){... | 5 |
@SuppressWarnings("unchecked")
public boolean equals(Object otherViewObject) {
if (otherViewObject != null && otherViewObject instanceof View) {
View<T> otherView = (View<T>) otherViewObject;
if (size() == otherView.size()) {
for (int i = 0; i < size(); i++) {
if ((get(i) != null || ... | 9 |
private SignFilter(final String text1, final String text2, final String text3, final String text4) throws PatternSyntaxException {
this.text[0] = (text1 != null ? Pattern.compile(text1) : null);
this.text[1] = (text2 != null ? Pattern.compile(text2) : null);
this.text[2] = (text3 != ... | 4 |
public Set<Map.Entry<Double,V>> entrySet() {
return new AbstractSet<Map.Entry<Double,V>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TDoubleObjectMapDecorator.this.isEmpty();
}
publi... | 7 |
public static Font getFont() throws FontFormatException, IOException{
URL urlFont = ResourceManager.class.getResource("/fonts/8bit.ttf");
Font font = Font.createFont(Font.TRUETYPE_FONT, urlFont.openStream());
return font;
} | 0 |
private void goDirection(MouseEvent e) {
// handle direction
Direction direction = view.directionContaining(e.getPoint());
if(direction != null) {
switch (direction)
{
case NORTH:
{
kdtCC.execGo(Direction.NORTH);
break;
}
case SOUTH:
{
kdtCC.execGo(Direction.... | 5 |
public int Run(RenderWindow App) {
boolean Running = true;
Text numberChickenKillLabel = new Text();
Text scoreLabel = new Text();
Text numberChickenKill = new Text();
Text score = new Text();
Text scoreLoseLabel = new Text();
Text scoreLose = new Text();
... | 7 |
public Node findItem(int key) {
if (isEmpty())
return null;
else {
Node current = this.root;
while (true)
if (current.getKey() > key && current.getLeft() != null)
current = current.getLeft();
else if (current.getKey() < key && current.getRight() != null)
current = current.getRight();
... | 8 |
@Override
public Session findPlayerSessionOnline(String srchStr, boolean exactOnly)
{
// then look for players
for(final Session S : localOnlineIterable())
{
if(S.mob().Name().equalsIgnoreCase(srchStr))
return S;
}
for(final Session S : localOnlineIterable())
{
if(S.mob().name().equalsIgnoreCase... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ArraySelectorNode other = (ArraySelectorNode) obj;
if (selector == null) {
... | 9 |
private boolean osuukoKarkiVarteen(double karkix, double karkiy,
double[] juuriKarkiXYXY){
double varsijuurix = juuriKarkiXYXY[0];
double varsijuuriy = juuriKarkiXYXY[1];
double varsikarkix = juuriKarkiXYXY[2];
double varsikarkiy = juuriKarkiXYXY[3];
... | 4 |
private synchronized void savePasswd() throws IOException {
if (passwdFile != null) {
FileOutputStream fos = new FileOutputStream(passwdFile);
PrintWriter pw = null;
try {
pw = new PrintWriter(fos);
String key;
String[] fields;
StringBuffe... | 6 |
private ArrayList<Time_Sheet> getAllConflicts(Time_Sheet ts) throws SQLException{
ArrayList<Time_Sheet> conflicts = new ArrayList();
int oldConflictsSize = 0;
conflicts.add(ts);
for(int i = 0; i < conflicts.size(); i++){
for(Time_Sheet tempTs : timeSheetAccess.getConflicting... | 5 |
public void setComplete() {
double temp = 0.0;
// Check the IBU
if (ibuHigh < ibuLow) {
temp = ibuHigh;
ibuHigh = ibuLow;
ibuLow = temp;
}
// check the SRM
if (srmHigh < srmLow) {
temp = srmHigh;
srmHigh = srmLow;
srmLow = temp;
}
// check the OG
if (ogHigh < ogLow) {
tem... | 4 |
public int compare(TradeOrder order1, TradeOrder order2)
{
if (order1.isMarket() && order2.isMarket())
{
return 0;
}
if (order1.isMarket() && order2.isLimit())
{
return -1;
}
if (order1.isLimit() && order2.isMarket())
{
return 1;
}
double cents1 = 100 * order1.getPrice();
double cents2 ... | 7 |
Class310_Sub3(DirectxToolkit class378, Class304 class304, int i, int i_0_,
int i_1_, byte[] is) {
super(class378, class304, Class68.aClass68_1183, false,
i_1_ * i_0_ * i);
anInt6338 = i;
anInt6337 = i_1_;
anInt6339 = i_0_;
anIDirect3DVolumeTexture6336
= (((DirectxToolkit) ((Class310_Sub3) this).aCl... | 6 |
public void method2()
{
System.out.println("执行方法!");
} | 0 |
static public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextCol... | 6 |
public static Pays selectPaysById(int id) throws SQLException {
String query = null;
Pays pays1 = new Pays();
ResultSet resultat;
try {
query = "SELECT * from PAYS where ID_PAYS=? ";
PreparedStatement pStatement = ConnectionBDD.getIns... | 2 |
public boolean handleEvent(Event e) {
switch (e.id) {
case Event.KEY_PRESS:
case Event.KEY_ACTION:
// key pressed
break;
case Event.KEY_RELEASE:
// key released
break;
case Event.MOUSE_DOWN:
// mouse button pressed
break;
case Event.MOUSE_UP:
// mouse button released
controller.onCli... | 7 |
public Iterator<SecFlag> flags()
{
return new Iterator<SecFlag>()
{
Iterator<SecFlag> p=null;
Iterator<SecGroup> g=null;
private boolean doNext()
{
if(p==null)
p=flags.iterator();
if(p.hasNext())
return true;
if(g==null)
g=groups.iterator();
while(!p.hasNex... | 8 |
private void putResize (int key, V value) {
if (key == 0) {
zeroValue = value;
hasZeroValue = true;
return;
}
// Check for empty buckets.
int index1 = key & mask;
int key1 = keyTable[index1];
if (key1 == EMPTY) {
keyTable[index1] = key;
valueTable[index1] = value;
if (size++ >= threshold)... | 7 |
public static void test()
{
Gson gson = new Gson();
String json;
try {
json = getJSON("http://dev.mhsnews.org/json_db/updates.php");
char[] cson = json.toCharArray();
System.out.println(json.toCharArray().length);
System.out.println();
//LOOP:
//While there is a line in JSON up to a certain... | 6 |
static boolean containsOrigin(List<Vector3f> simplex) {
// If we don't have 4 points, then we can't enclose the origin in R3
if(simplex.size() < 4)
return false;
Vector3f a = simplex.get(3);
Vector3f b = simplex.get(2);
Vector3f c = simplex.get(1);
... | 4 |
@Test
public void getterTest() {
for (int i = 0; i < TESTS; i++) {
double value = rand.nextDouble() * rand.nextInt();
Angle angle = new Angle(value);
double truevalue = value % 360;
if (truevalue < 0) truevalue += 360;
assertEquals(truevalue, angle.getAngle(), 0.00001);
assertTrue(angle.getAngle() ... | 3 |
private void AddComponentsToGamePanel() {
ArtAssets art = ArtAssets.getInstance();
this.setLayout(null);
switch (gameState.getDifficultyLevel()) {
case GameState.DIFFICULTY_EASY:
this.loadTargetPins(new Dimension(4, 3), 60, new Dimension(70, 70), 60,... | 3 |
public static void createSolution() {
try {
switch (solution) {
case 1:
s = new FkSolution(depth);
break;
case 2:
s = new F2kSolution(depth);
break;
case 3:
s = new F3kSolution(depth);... | 5 |
public void algoritmi(int iAlku, int jAlku){
int[] sij;
Verkkosolmu vuorossa;
initialiseSingleSource(iAlku, jAlku);
int kaydytsolmut = 0;
keko.heapInsert(kaytavaverkko[iAlku][jAlku]);
while(!keko.empty()){
kaydytsolmut++;
vuorossa = keko.heapDelMin... | 5 |
public static String getValidationString() {
String random = RandomStringUtils.randomAlphanumeric(20);
return random;
} | 0 |
final public void EqualityExpression() throws ParseException {
Token t = null;
InstanceOfExpression();
label_12:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case EQ:
case NE:
;
break;
default:
break label_12;
}
switch ((jj_ntk==-1)?jj_... | 8 |
* The expression whose value we are storing.
*/
private void addStore(final MemExpr target, final Expr expr) {
if (saveValue) {
stack.push(new StoreExpr(target, expr, expr.type()));
} else {
addStmt(new ExprStmt(new StoreExpr(target, expr, expr.type())));
}
} | 1 |
public static boolean isWindows() {
String osName = System.getProperty("os.name");
if (osName.toLowerCase().startsWith("win")) {
return true;
} else {
return false;
}
} | 1 |
@Override
public float calculateCost() {
float cost = getPrice();
cost = (float) (cost + (0.125 * cost) + (.1 * cost));
if (cost > 0) {
if (cost <= 100) {
cost += 5;
} else if (cost <= 200) {
cost += 10;
} else {
cost = (float) (cost + (0.05 * cost));
}
}
return cost;
} | 3 |
public void fillObject(Users user, ResultSet result) {
//Заполняем информацией из базы
try {
user.setId(result.getInt("ID"));
user.setUserName(result.getString("USERNAME"));
user.setUserPsw(result.getString("USERPSW"));
user.setUserState(result.getInt("USE... | 1 |
int bestScore() {
alignmentScore = Integer.MIN_VALUE;
int maxj = b.length, maxi = a.length;
for (int i = 1; i <= a.length; i++) {
if (alignmentScore < score[i][maxj]) {
alignmentScore = score[i][maxj];
besti = i;
bestj = maxj;
}
}
for (int j = 1; j <= b.length; j++) {
if (alignmentScore ... | 4 |
@Override
public void tick() {
if (fuelSlider.isActive()) {
fuelSlider.tick();
}
if (massSlider.isActive()) {
massSlider.tick();
if (rocket.getY() < 0.001) {
mass = massSlider.getValue();
rocket = new Rectangle(210, 0, (int) (m... | 8 |
@Override
public void initialize(InputSplit split, TaskAttemptContext context)
throws IOException, InterruptedException {
this.conf = context.getConfiguration();
sequenceFileRecordReader.initialize(split, context);
// get dimensionLengths from hadoop conf
try {
... | 5 |
private void initComponents() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
selectFileLbl = new JLabel();
backBtn = new JButton();
statusLbl = new JLabel();
sectionScrollPane = new JScrollPane();
sectionListTable = new JTable();
addFileBtn = new JButt... | 2 |
private Connection getConn() {
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
try {
conn = (Connection) DriverManager.getConnection(this.url, this.usuario, this.senha);
} catch (SQLException ex) {
Lo... | 2 |
public static boolean isFloat(String string) {
try {
Float.parseFloat(string);
return true;
} catch (Exception ex) {
return false;
}
} | 1 |
@Override
public void keyReleased(KeyEvent e) {
if (isWaitingForKeyPress() || consoleInputField != null) {
return;
}
/* Movement controls */
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
leftPressed = false;
leftPresse... | 9 |
private void updateGrid() {
// Draw the shadow (previous should already have been removed)
if (displayShadow) {
shadowDistance = 0;
boolean canMoveDown = true;
// Drop the shadow to calculate new distance
while (true) {
for (int[] relLoc ... | 9 |
private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header)
{
try {
// Read the request line
String inLine = in.readLine();
if (inLine == null) return;
inLine = URLDecoder.decode(inLine, "UTF-8");
StringTokenizer st = new StringTokenizer( inLine );
if ( !st.has... | 9 |
static public Vector3f findTriangleSimplex(List<Vector3f> simplex){
Vector3f newDirection;
//A is the point added last to the simplex
Vector3f a = simplex.get(2);
Vector3f b = simplex.get(1);
Vector3f c = simplex.get(0);
Vector3f ao = Vector3f.ORIGIN.minus(a);
... | 6 |
@Override
public void sorted(OutlineModel model, boolean restoring) {
if (!restoring && isFocusOwner()) {
scrollSelectionIntoView();
}
repaintView();
} | 2 |
public boolean create(String username, String albumname){
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(GET_UID_OWNER);
stmt.setString(1, username);
rs = stmt.executeQuery();
... | 9 |
public void displaySet() {
System.out.println("");
String disSet = "";
int i = 0;
for (Case c : this.set.getCases()) {
disSet += "[";
for (Player p : this.players) {
if (p.getPosition() == c.getPosition()) disSet += "(" + p.getTurn() + ")";
}
disSet += c.getDisplay() + "]";
if ( i%20 == 17 ) ... | 5 |
public static void putData(int data, int port) {
ENABLE_BIT.high();
switch (port) {
case 1:
GPIO_PORT_PINS.get(0).low();
GPIO_PORT_PINS.get(1).low();
break;
case 2:
GPIO_PORT_PINS.get(0).low();
GPIO_PORT_PINS.get(1).high();
break;
case 3:
GPIO_PORT_PINS.get(0).high();
GPIO_PORT_PINS.g... | 5 |
Rectangle getHitBounds () {
int[] columnOrder = parent.getColumnOrder ();
int contentX = 0;
if ((parent.getStyle () & SWT.FULL_SELECTION) != 0) {
int col0index = columnOrder.length == 0 ? 0 : columnOrder [0];
if (col0index == 0) {
contentX = getContentX (0);
} else {
contentX = 0;
}
} else {
content... | 5 |
public ListNode reverseBetween(ListNode head, int m, int n) {
if(m == n)
return head;
Stack<ListNode> stack = new Stack<ListNode>();
ListNode headNew = new ListNode(-1);
ListNode step = headNew;
ListNode index = head;
ListNode left = null;
for(int i=1... | 6 |
public static boolean cobreTodasTwoFlip(Coluna col1, Coluna col2, Solucao sol){
ArrayList<Integer> cobertura1 = col1.getCobertura();
ArrayList<Integer> cobertura2 = col2.getCobertura();
for(Integer entradateste1 : cobertura1){
if(!(sol.getLinhasCobertas().contains(entradateste1))){
... | 5 |
public static void processLines(ArrayList<String> listaFiles, String folder) {
String[] XMLS=new String[listaFiles.size()];
int counter=1;
int iterador = 0;
for (String linea2 : listaFiles) {
System.out.println("Record "+counter+"..."+listaFiles.size());
counter++;
try {
URL url = new URL("htt... | 8 |
@Override
public void mousePressed(MouseEvent evt) {
int mouseX = evt.getX();
int mouseY = evt.getY();
lastTilePressed = CheckTiles(mouseX, mouseY, evt.getButton());
if(lastTilePressed.x != -1 && lastTilePressed.y != -1)
{
if(evt.getButton() == MouseEvent.BUTTON3)
{
System.out.println("got in th... | 3 |
public Map<String, List<Entry<String, List<?>>>> getValue() {
Map<String, List<Entry<String, List<?>>>> ret = new HashMap<>();
for(ICommandParser<Entry<String, List<?>>> t : parserList) {
List<Entry<String, List<?>>> valList = new ArrayList<>();
for(Entry<String,List<?>> entry : t.getValue()) {
valList.ad... | 7 |
public double[] subtractMean_as_double() {
double[] arrayminus = new double[length];
switch (type) {
case 1:
double meand = this.mean_as_double();
ArrayMaths amd = this.minus(meand);
arrayminus = amd.getArray_as_double();
break;
case 12:
BigDecimal meanb = this.mean_as_BigDecimal();
ArrayMaths... | 3 |
public void paintComponent (Graphics g)
{
super.paintComponent (g);
// Background.
Dimension D = this.getSize ();
g.setColor (Color.white);
g.fillRect (0,0, D.width, D.height);
g.setColor (Color.black);
// Axes, bounding box.
g.drawLine (inset,D.hei... | 7 |
public void setSourceText(String sourceText)
{
_sourceText = sourceText.trim();
} | 0 |
private static void bubbleSort(int[] аrray) {
for (int i = 0; i < аrray.length; i++) {
for (int j = 1; j < аrray.length - i; j++) {
if (аrray[j - 1] > аrray[j]) {
int help = аrray[j - 1];
аrray[j - 1] = аrray[j];
аrray[j] = ... | 3 |
private void imprimirCheques() {
try{
Scanner lea = new Scanner(System.in);
System.out.print("Numero de Cuenta: ");
int nc = lea.nextInt();
if( buscarCuenta(nc) ){
if( rCuentas.readUTF().equals("CHEQUE")){
String ar... | 5 |
private void updateComponents() {
int selectedCount = 0;
for (int i = 0; i < goodsList.getModel().getSize(); i++) {
GoodsItem gi = (GoodsItem) goodsList.getModel().getElementAt(i);
if (gi.isSelected()) selectedCount++;
}
if (selectedCount >= maxCargo) {
... | 7 |
private void destroyToolBar() {
getToolBar().removeAll();
Object o;
AbstractButton b;
for (Enumeration e = toolBarButtonGroup.getElements(); e.hasMoreElements();) {
o = e.nextElement();
if (o instanceof AbstractButton) {
b = (AbstractButton) o;
b.setAction(null);
ActionListener[] al = b.getAct... | 8 |
public void initFrame() {
GridBagLayout frame_layout = new GridBagLayout();
drawing = new DrawingPanel(640, 480, WORLD_WIDTH, WORLD_HEIGHT, this);
addKeyListener(this);
getContentPane().add(drawing);
side_panel = new JPanel();
side_hud_panel = new JPanel();
score_label = new JLabel("Score: " + score);
... | 8 |
private double calcStepTemp(String stepType) {
float stepTempF = 0;
if (stepType == ACID)
stepTempF = (ACIDTMPF + GLUCANTMPF) / 2;
else if (stepType == GLUCAN)
stepTempF = (GLUCANTMPF + PROTEINTMPF) / 2;
else if (stepType == PROTEIN)
stepTempF = (PROTEINTMPF + BETATMPF) / 2;
else if (stepType == BETA... | 7 |
public String readLine () throws IOException {
StringBuffer buf = new StringBuffer(80);
boolean endOfLine = false;
boolean lastWasCr = false;
int bytesRead = 0;
do {
int c = read();
switch (c) {
case -1:
endOfLine = true;
break;
case '\r':
lastWasCr = true;
bytesRead++... | 8 |
void readProteinFileGenBank() {
FeaturesFile featuresFile = new GenBankFile(proteinFile);
for (Features features : featuresFile) {
String trIdPrev = null;
for (Feature f : features.getFeatures()) { // Find all CDS
if (f.getType() == Type.GENE) {
// Clean up trId
trIdPrev = null;
} else if (... | 9 |
public List<PhpposSalesEntity> getMovimientosPos(){
return getHibernateTemplate().find("from PhpposSalesEntity where estadoMovimiento = 'N' ");
} | 0 |
public boolean acquireLock(){
boolean success = false;
if(!isLOcked){
synchronized (this) {
if(!isLOcked){
isLOcked = true;
lockedBy = "localhost";
success = true;
String msg = "Acquire_Lock" + ":" + lockName;
manager.notifyAllRemoteListeners(new Message(msg, localhost));
}
}
... | 2 |
@Test
public void testConcurrent()
{
final int SENDERS = 6;
final int SENDS_PER_SENDER = 100;
final int TOTAL_SENDS = SENDERS * SENDS_PER_SENDER;
final AtomicInteger sends = new AtomicInteger();
final AtomicInteger receives = new AtomicInteger();
final Signal signal = new Signal();
GroupTask.initi... | 2 |
public synchronized boolean isComplete() {
return this.pieces.length > 0 &&
this.completedPieces.cardinality() == this.pieces.length;
} | 1 |
private void rebalance() {
// Fictitious names for now
int leftIndex = 0;
int rightIndex = 0;
int parentIndex = getParentIndex(getParentIndex(array.getLastPosition()));
while (needRebalance()) {
leftIndex = getLeftChildIndex(parentIndex);
rightIndex = ge... | 4 |
public static OfflinePlayer requestFilePlayer(String namepart) {
OfflinePlayer requested = null;
boolean found = false;
File dir = new File("plugins/" + AdminEye.pdfFile.getName()
+ "/players/");
for (File file : dir.listFiles()) {
PlayerFile playerFile = new PlayerFile(file.getName().replaceAll(
".... | 8 |
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.