text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Test (timeout = 1000)
public void testLeave() {
//start server processor
ServerProcess processor = new ServerProcess();
processor.start();
try {
//writer and reader for file
PrintWriter writer = new PrintWriter(new FileWriter("src/server/test.txt", false));
BufferedReader in = new BufferedReader(n... | 9 |
protected void loadRegulation() {
String name = "Regulation";
String fileName = dirName + name + ".txt";
if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'");
int i = 1;
for (String line : Gpr.readFile(fileName).split("\n")) {
// Parse line
String rec[] = line.split("\t");
S... | 7 |
public byte[] processProxyMessage(
int messageReference,
boolean messageIsRequest,
String remoteHost,
int remotePort,
boolean serviceIsHttps,
String httpMethod,
String url,
String resourceType,
String statusCode,... | 8 |
private String getPagina(URL url)
{
StringWriter writer = new StringWriter();
try {IOUtils.copy(url.openStream(), writer);}
catch (IOException ex) {Logger.getLogger(WebCrawler.class.getName()).log(Level.SEVERE, null, ex);}
String contenidoString = writer.toString();
retu... | 1 |
public boolean equals(Object object) {
try {
PDATransition t = (PDATransition) object;
return super.equals(object)
&& myInputToRead.equals(t.myInputToRead)
&& myStringToPop.equals(t.myStringToPop)
&& myStringToPush.equals(t.myStringToPush);
} catch (ClassCastException e) {
return false;
}
... | 4 |
@Override
protected void onStarted() {
GlobalUtil.threadExecutor().execute(new Runnable() {
@Override
public void run() {
FileReceivingController receiver;
int percent;
int speed;
while (isRunning()) {
for (CoreFileInfo file : receivingFiles.keySet()) {
if (file != null) {
rec... | 7 |
public synchronized void attack(Attack attack){
/* Funcion de ataqueProvisional*/
attackPool.add(attack);
Actor attacker = (attack.caster);
for(Map.Entry actor : actores.entrySet()) {
Actor a = (Actor)actor.getValue();
// Con este if evitamos el fuego ... | 6 |
public String getIP(){
if(HOSTIP != null){
return HOSTIP;
}
else
{
try {
for (
final Enumeration< NetworkInterface > interfaces =
NetworkInterface.getNetworkInterfaces( );
interfaces.h... | 6 |
void createHMlut(int [] kernel, int [] lut){
int i, j, match, toMatch;
for(i=0;i<512;i++)
lut[i]=1;
toMatch=0;
for(j=0;j<9;j++){
if (kernel[j]!=2)
toMatch++;
}
//System.out.println("Debug: to match: "+toMatch);
//make lut
for(i=0;i<512;i++){
match=0;
for(j=0;j<9;j++){
if (kernel[j]... | 9 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
Connection con=(Connection)Konekcija.konekcija();
... | 9 |
private void clearNearCache(Block block) {
String selfMeta = null;
String neighborMeta = null;
if (block.getType() == Material.WALL_SIGN) {
selfMeta = FILTER_INVENTORY;
neighborMeta = HopperFilter.MATCHERS;
} else if (block.getType() == Material.HOPPER) {
... | 7 |
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
// Draws the background
paintBackground(g);
// Creates or destroys the triple buffer as needed
if (tripleBuffered)
{
checkTripleBuffer();
}
else if (tripleBuffer != null)
{
destroyTripleBuffer();
}
... | 3 |
public PDFObject dereference() throws IOException {
if (type == INDIRECT) {
PDFObject obj = null;
if (cache != null) {
obj = (PDFObject) cache.get();
}
if (obj == null || obj.value == null) {
if (owner == null) {
... | 5 |
public String bestQuestion()
{
if(questionStats.size() > 0)
{
QuestionStatistic max = Collections.max(questionStats);
return max.questionText + ", " + max.correctAnswers + " times.";
}
return "no statistics found!";
} | 1 |
public void setRightBranch(ClusterNode rightBranch) {
this.rightBranch = rightBranch;
} | 0 |
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
// find length of A
int alen = findLength(headA);
if (alen == 0) return null;
// find length of B
int blen = findLength(headB);
if (blen == 0) return null;
// move the difference
ListN... | 6 |
public static double deltaAngle(double angle1, double angle2) {
while (angle2 <= -180)
angle2 += 360;
while (angle2 > 180)
angle2 -= 360;
while (angle1 <= -180)
angle1 += 360;
while (angle1 > 180)
angle1 -= 360;
double r = angle2 - angle1;
return r + ((r > 180) ? -360 : (r < -180) ? 360 : 0);... | 6 |
@Test
public void testGetSingleTransactionRecordById() {
CardPaymentRequest paymentRequest = getCreditCardPaymentRequest(
getRandomOrderId("TEST"), "90.00");
try {
PaymentResponse payment = beanstream.payments().makePayment(paymentRequest);
Assert.assertNotNull("Payment w... | 1 |
public List<QuadTree> getBottomNeighbors()
{
QuadTree sibling = this.getBottomSibling();
if ( sibling == null ) return new ArrayList<QuadTree>();
return sibling.getTopChildren();
} | 1 |
public Quiz buildQuiz(Quiz q, TreeMap<SubjectType, Integer> subjects)
{
Random random = new Random();
for(SubjectType s : subjects.keySet())
{
int[] selections = new int[subjects.get(s)];
for(int i = 0; i < selections.length; i++)
selections[i] = -1;
... | 9 |
@Override
public void cleanUp() {
stopSound();
if (source != null) {
source.projectileReturned();
}
} | 1 |
public void addOneToBasket(int productId) {
boolean isAdded;
if (basket.containsKey(productId)) {
isAdded = basket.get(productId).addOneProduct();
} else {
ProductInBasket prod = new ProductInBasket();
ProductDAO dao = DAOFactory.getInstance().getProductDAO();
isAdded = prod.setProduct(dao.findProduct... | 3 |
private void light(int x, int y) {
int key = genKey(x, y);
if (actorHashMap.containsKey(key)) {
currentSenses.putActor(key, actorHashMap.get(key));
}
if (tileHashMap.containsKey(key)) {
currentSenses.putTile(key, tileHashMap.get(key));
}
if (player... | 4 |
protected MOB getCharmer()
{
if(charmer!=null)
return charmer;
if((invoker!=null)&&(invoker!=affected))
charmer=invoker;
else
if((text().length()>0)&&(affected instanceof MOB))
{
final Room R=((MOB)affected).location();
if(R!=null)
charmer=R.fetchInhabitant(text());
}
if(charmer==null)
... | 7 |
public static Digraph rootedInDAG(int V, int E) {
if (E > (long) V * (V - 1) / 2)
throw new IllegalArgumentException("Too many edges");
if (E < V - 1)
throw new IllegalArgumentException("Too few edges");
Digraph G = new Digraph(V);
SET<Edge> set = new SET<Edge>();
// fix a topological order
int[] ver... | 7 |
public boolean showAddDialog() {
this.setTitle("ҪӵѧϢ");
canceled = false;
this.getRootPane().setDefaultButton(button);
this.setVisible(true);
return !canceled;
} | 0 |
public ViewerMain(final Book book) {
this.book = book;
pageId = 7;
loadPage(pageId);
setLayout(new BorderLayout());
add(new JLabel() {
private static final long serialVersionUID = 1L;
@Override
public Dimension getPreferredSize() {
return new Dimension(1500, 600);
}
@Override
public v... | 9 |
public SourceFixe(String arg) {
informationGeneree = new Information<Boolean>();
informationEmise = informationGeneree;
//Parcourir l'argument saisi par l'utilisateur
for (int i = 0; i < arg.length(); i++) {
//Si le caractere en cours est un 0
if (arg.charAt(i) == '0')
//Ajouter false a la liste inf... | 3 |
public void saveShieldsToFile() {
if (plugin.getListener() == null || plugin.getListener().getShields() == null) {
return;
}
if (!shieldsFile.exists())
{
try {
shieldsFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
shieldsDB.save(shieldsFile);
... | 6 |
public static void main(String args[]) throws InterruptedException {
int i = 1;
ThreadExecutor executor = new ThreadExecutor();
long startTime = System.currentTimeMillis();
while ((System.currentTimeMillis() - startTime) < 1 * 60 * 1000) {
HttpAsyncClientImpl httpImpl = new HttpAsyncClientImpl(i);
try {
... | 5 |
public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
for (int i = characters.size() - 1; i > -1; i--)
{
characters.get(i).paintCharacter(g2);
}
for (int i = projectiles.size() - 1; i > -1; i--)
{
projectiles.get(i).paintProjectile(g2);
}
for (int i = 0; i < blocks.size(); i++)
{
... | 4 |
int insertKeyRehash(long val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... | 9 |
public LoperFrame(final Sponsorloop loop) {
this.loop = loop;
sf = null;
setSize(200, 200);
lab1 = new JLabel("Lopers", JLabel.CENTER);
lab2 = new JLabel();
updateAantal();
listModel = new DefaultListModel();
list = new JList(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
d... | 6 |
public int split(int i, int j) throws Exception
{
if (i > j)
throw new Exception("Invalid Matrix sequence");
if (i > n || j > n)
throw new Exception("Non existent matrix specified");
return split[i][j];
} | 3 |
public int getBlue(int row, int col) {
if (row >=0 && row < rows && col >= 0 && col < columns && grid[row][col] != null)
return grid[row][col].getBlue();
else
return defaultColor.getBlue();
} | 5 |
public ROPacketTransmitter getPacketTransmitter() {
return packetTransmitter;
} | 0 |
public String isOkay(String e, boolean anyOfSuit){
int h = convert(e);
if (h < 0 || h > _hand.size()-1){return "Illegal move. Please select a card in your hand.";}
Card d = _hand.get(h);
String retStr = "";
if ( isLeading == true && isBroken == false && d.getSuit() == 0) {retStr ... | 8 |
public double modulo(){
return sqrt(x*x + y*y + z*z);
} | 0 |
public void setLHS(String lhs) {
myLHS = lhs;
} | 0 |
@Override
public boolean executeValidation(CreditCard creditCard) {
log.fine("Starting credit card validation");
boolean isValid = true;
isValid = validateCardNumber(creditCard.getCardNumber()) && isValid;
// Only check the type if the number was valid, since the type depends
// on it
if (isValid) {
i... | 4 |
@Override
public void onAnalog(String name, float isPressed, float tpf) {
float pos = isPressed / tpf;
if (name.equals("Accelerate Vehicle")){
if (car != null) {
car.throttlePressed(pos);
}
}
if (name.equals("Brake Ve... | 8 |
public String changeKeyboardLayout() {
String previous = pref.getKeyboardLayout();
String[] layouts = pref.getExistingKeyboardLayouts();
// TODO: pass current item name
ChooseFromExisting dialog = new ChooseFromExisting(layouts);
dialog.dispose();
String newLayout = dia... | 6 |
public Element handle(FreeColServer server, Player player,
Connection connection) {
ServerPlayer serverPlayer = server.getPlayer(connection);
Unit unit;
try {
unit = player.getFreeColGameObject(unitId, Unit.class);
} catch (Exception e) {
... | 9 |
public MyGraph computeCover4() {
MyGraph cover = new MyGraph(this);
ArrayList<MyNode> hightDegreeNodes = new ArrayList<MyNode>();
for (MyNode n : cover.getNodes()) {
if (n.getDegree() > 2) {
hightDegreeNodes.add(n);
}
}
for (MyNode node : hightDegreeNodes) {
for (MyEdge edge : cover.outEdges(node... | 9 |
@Test
public void testGetSubset() {
DoubleIntervalMap<double[]> map = new DoubleIntervalMap<double[]>();
StupidDoubleIntervalMap stupid = new StupidDoubleIntervalMap();
RandomIter iter = new RandomIter( getSeed(), 0, 1000 );
final int testCount = 2000;
final int subtestCount... | 7 |
@Deprecated
private Mesh calculateTesselator()
{
ArrayList<Vector3f> vertices = new ArrayList<Vector3f>();
ArrayList<Integer> indices = new ArrayList<Integer>();
int z = -fraction / 2;
int x;
while ( z <= fraction / 2 )
{
x = -fraction / 2;
while ( x <= fraction / 2 )
{
float rand1 = MathHel... | 7 |
public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
int len = length();
writer.write('[');
for (int i = 0; i < len; i += 1) {
if (b) {
writer.write(',');
}
Obj... | 5 |
public void compareJvmCost() {
String rMapperFile = "realMapper.txt";
String rReducerFile = "realReducer.txt";
String realJvmCostDir = bigBaseDir + bigJobName + "/RealJvmCost/";
String estiJvmCostDir = compBaseDir + compJobName + "/estimatedDM/";
String compJvmCostDir = compBaseDir + compJobName + "/compJvmC... | 4 |
protected short parse_config_param(final String param_title, final String param_content)
{
short ret = MsgDumperCmnDef.MSG_DUMPER_SUCCESS;
boolean found = false;
for (int index = 0 ; index < title_len ; index++)
{
if (param_title.indexOf(title[index]) == 0)
{
switch(index)
{
case 0:
serv... | 5 |
public static boolean CheckUserProfile(Map<String, String> ProfileData)
throws SQLException {
boolean success = false;
boolean found = false;
for (int j = 0; j < GlobalData.UserProfileRecs.size(); j++) {
UserProfileRec rec = GlobalData.UserProfileRecs.get(j);
if (rec.username.equalsIgnoreCase(ProfileData... | 9 |
public void update(String player, String element, String value) {
Node players = doc.getFirstChild();
NodeList playerNode = null;
NodeList list = players.getChildNodes();
for(int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
if(player.equals(node.getNodeName()))
playerNode = nod... | 5 |
public void keyReleased(KeyEvent e) {
} | 0 |
Point3f getMax() {
if (max == null)
max = new Point3f();
if (list.isEmpty()) {
max.set(0, 0, 0);
return max;
}
Cuboid c = getCuboid(0);
max.x = c.getMaxX();
max.y = c.getMaxY();
max.z = c.getMaxZ();
synchronized (list) {
int n = count();
if (n > 1) {
for (int i = 1; i < n; i++) {
... | 7 |
private void constructBoard() {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
if (chessGame.gameState[i][j].getColor() != ChessPiece.COLOR_RED && chessGame.gameState[i][j].getColor() != ChessPiece.COLOR_BLUE) {
if (j % 2 == 0) {
if (i % 2 == 0) {
chessGame.gameState[i][j] = new ... | 7 |
protected boolean isAttribute(ResTable_Map map) {
return map.name == ATTR_TYPE
|| map.name == ATTR_MIN
|| map.name == ATTR_MAX
|| map.name == ATTR_L10N
|| map.name == ATTR_OTHER
|| map.name == ATTR_ZERO
|| map.name == ATTR_ONE
|| map.name == ATTR_TWO
|| map.name == ATTR_FEW
|| map.... | 9 |
private String saveTmpFile(ByteBuffer b, int offset, int len) {
String path = "";
if (len > 0) {
FileOutputStream fileOutputStream = null;
try {
TempFile tempFile = tempFileManager.createTempFile();
ByteBuffer src = b.duplic... | 2 |
public Tffst toSingleInputLabelTransitions() {
Tffst simpleTffst = new Tffst();
HashMap<State, State> m = new HashMap<State, State>();
State last;
Set<State> states = getStates();
for (State s : states) {
System.out.println(s.toString());
if (m.get(s) == null) {
last = new State();
m.put(s, la... | 8 |
public static Map<String, Object> formatResponseAsMap(InputStream stream) throws Exception {
Map<String, Object> mapResponse = new LinkedHashMap<String, Object>();
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = docFactory.newDocumentBuilder();
Docu... | 8 |
public void setUpcomingEventsCount(int upcomingEventsCount) {
this.upcomingEventsCount = upcomingEventsCount;
} | 0 |
private static String[] getSubjectAlts(
final X509Certificate cert, final String hostname) {
int subjectType;
if (isIPAddress(hostname)) {
subjectType = 7;
} else {
subjectType = 2;
}
LinkedList<String> subjectAltList = new LinkedList<String>(... | 9 |
public DreamerNini() {
super();
courseTitles= new ArrayList<String>();
works= new ArrayList<String>();
} | 0 |
@Override
public void logOut(String username) {
ResultSet rs;
try {
PreparedStatement statement = connection.prepareStatement(
"SELECT * FROM Users " + "WHERE username = ?",
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
statement.setString(1, username);
rs = statement.e... | 2 |
public float getX(float y) {
if (isVertical) {
return value;
} else if (isHorizontal) {
return Float.NaN;
} else {
return (y - this.b) / this.k;
}
} | 2 |
public Boolean actualizar_estado(String estado, String estadoNuevo) {
Boolean est = false;
List DNList = new cDN().leer_por_estado(estado);
Transaction trns = null;
sesion = HibernateUtil.getSessionFactory().openSession();
try {
trns = sesion.beginTransaction();
... | 3 |
public static JSONObject listMessages(int id, int nb, int off,String last) throws emptyResultException {
try {
JSONObject json = new JSONObject();
Mongo m = new Mongo(BDStatic.mongoDb_host,BDStatic.mongoDb_port);
DB db = m.getDB(BDStatic.mysql_db);
DBCollection collection = db.getCollection("messages... | 7 |
private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... | 5 |
public double getSpeedBalance() {
return 0.5 * ((GUI.controls != null && GUI.controls.get("p_auto-speed") != null && GUI.controls
.get("p_auto-speed").isActive()) ? stableSpeedBalance : 1);
} | 3 |
public void setX(double _x) {
x = _x;
} | 0 |
private void init() {
VerticalLayout layout = (VerticalLayout) this.getContent();
layout.setMargin(true);
layout.setSpacing(true);
Label message = new Label("<b>Please type your website URL to begin making your E-book! (e.g. www.example.com)</b>");
message.setContentMode(Label... | 2 |
private void doTunnelHandshake(final Socket tunnel, final String host, final int port) throws IOException {
final OutputStream out = tunnel.getOutputStream();
final String msg = "CONNECT " + host + ":" + port + " HTTP/1.0\n" + "User-Agent: BoardPad Server" + "\r\n\r\n";
byte b[];
try { //We really do ... | 9 |
public static void loadInput(String inFile, int linesToRead)
throws IOException
{
int lines = readLines(inFile);
if (linesToRead != -1 && linesToRead < lines) {
lines = linesToRead;
}
word1 = new String[lines];
word2 = new String[lines];
Buffer... | 5 |
void init(int n) {
bitrev = new int[n / 4];
trig = new float[n + n / 4];
log2n = (int) Math.rint(Math.log(n) / Math.log(2));
this.n = n;
int AE = 0;
int AO = 1;
int BE = AE + n / 2;
int BO = BE + 1;
int CE = BE + n / 2;
int CO = CE + 1;
... | 5 |
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
int progress = 0;
if (value instanceof Float) {
progress = Math.round(((Float) value));
} else if (value instanceof Integer) {
... | 2 |
private boolean isOnMap(int x, int y) {
if(x < 0 || x >= getXSize() || y < 0 || y >= getYSize()) {
return false;
} else {
return true;
}
} | 4 |
@Override
public String getDetails() {
StringBuffer sb = new StringBuffer();
Rectangle2D b = gp.getBounds2D();
sb.append("ShapeCommand at: " + b.getX() + ", " + b.getY() + "\n");
sb.append("Size: " + b.getWidth() + " x " + b.getHeight() + "\n");
sb.append("Mode: ");
... | 3 |
public static void adminstrate(StanzaAndType s, FilterChain chain, Attachment aAtt) throws JAXBException {
StanzaProperties stanzaProperties = StanzaProperties.getInstance();
if(s.getStringType().equals(stanzaProperties.getMessageName())) {
XmppParserMessage parser = new XmppParserMessage(s.getStanza(), jabber.s... | 7 |
private static double det(double[][] arr) {
int N = arr.length;
double[][] M = new double[N][N];
for (int i = 0; i < arr.length; i++)
System.arraycopy(arr[i], 0, M[i], 0, N);
double mult = 1;
for (int r = 0; r < N; r++) {
int k = r;
while (M[k][r] == 0) {
k++;
if (... | 9 |
private void drawControlPanel(Graphics2D g, int x, int y) {
if (startIcon != null) {
g.setStroke(thinStroke);
startIcon.setColor(getContrastColor(x, y));
startIcon.paintIcon(this, g, x - startIcon.getIconWidth() * 3 - 12, y);
}
if (resetIcon != null) {
g.setStroke(thinStroke);
resetIcon.setColor(ge... | 8 |
@Override
public void mouseDragged(MouseEvent e) {
if (tempCard == null) {
return;
}
int newx = tempCard.getXpos() - tempX + e.getX();
int newy = tempCard.getYpos() - tempY + e.getY();
int margin = TCard.H() / 2;
if (newx < margin) {
newx = mar... | 5 |
private static boolean isDifferent(Tile t1, Tile t2, boolean biome) {
if (biome) {
if (t1 == null || t2 == null) {
return false;
} else {
if ((t1.tile == t2.tile && !(Tiles.getPrecedence(t1.tile) > Tiles.getPrecedence(t2.tile)) || t1.floor != t2.floor))
return false;
else return true;
}
} ... | 9 |
public String getUnit(URL url) {
String detail = "";
Document doc;
try {
doc = tidy.parseDOM(url.openStream(), null);
System.out.println(getUnitOutline(doc));
getUnitStats(doc);
getProductionStats(doc);
getCombatStats(doc);
getFieldManual(doc);
getStrongAgainst(doc);
getWeakAgainst... | 3 |
public void i2c_write(short address, byte[] data) throws IOException {
if (data.length==0) {
throw new IOException("no data");
}
if (data.length==1) {
this.write_single(address, data[0]);
} else {
this.write_multiple(address, data);
}
} | 2 |
*/
public boolean canRecruitFoundingFather() {
Specification spec = getGame().getSpecification();
switch (getPlayerType()) {
case COLONIAL:
break;
case REBEL: case INDEPENDENT:
if (!spec.getBoolean("model.option.continueFoundingFatherRecruitment")) return fals... | 7 |
public void randDnaSeqGetBasesTest(int numTests, int numTestsPerSeq, int lenMask, long seed) {
Random rand = new Random(seed);
for( int t = 0; t < numTests; t++ ) {
String seq = "";
int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length
seq = randSeq(len, rand); // Create a random s... | 3 |
public Copy getCopy(int copyId){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
Statement stmnt = conn.createStatement();
String sq... | 5 |
public void addType(Scanner sc) {
System.out.println("Add a type");
System.out.print("Enter type name: ");
String nameType = sc.nextLine();
System.out.println();
System.out.print("Enter type price: ");
double price = Double.parseDouble(sc.nextLine());
System.out.p... | 0 |
public void pedirNumero(){
try{
FileReader fr = new FileReader("Datos.txt");
BufferedReader br = new BufferedReader(fr);
String cadena;
// char valor;
//String uno = Integer.toString(numero);
while ((cadena=br.readLine())!=null){
... | 9 |
private void createActiveCluster(double[] timeVector, String user) {
double[] post_count = timeVector;
double totalPost = 0.0;
for (double i : post_count) {
totalPost += i;
}
double threshHold = (20 * totalPost) / 100;
double firstClusterSize = post_count[0] + post_count[1] + post_count[2]
+ post_c... | 7 |
public void setSelected(TreeNode node, boolean select) {
if (select)
selectedNodes.put(node, null);
else
selectedNodes.remove(node);
} | 1 |
public void Move(Direction direction)
{
switch(direction)
{
case Down:
super.translatePosition(0, +1, 0);
break;
case Left:
super.translatePosition(0, -1, 0);
break;
case Right:
super.translatePosition(+1, 0, 0);
break;
case Up:
super.translatePosition(-1, 0, 0);
break;
default:
... | 4 |
public int cdlDarkCloudCoverLookback( double optInPenetration )
{
if( optInPenetration == (-4e+37) )
optInPenetration = 5.000000e-1;
else if( (optInPenetration < 0.000000e+0) || (optInPenetration > 3.000000e+37) )
return -1;
return (this.candleSettings[CandleSettingType.BodyLong.o... | 3 |
public void assureIntegrity(){
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
messageDigest=digest.digest((username+message).getBytes("UTF-8"));
}catch (NoSuchAlgorithmException e1){
e1.printStackTrace();
}
catch(UnsupportedEncodingException e2){
e2.printStackTrace()... | 2 |
public void CreateAANakedTorsoAlternativeTexturesFemales() throws Exception {
SPProgressBarPlug.setStatus("Create AA naked torso alternative textures for females");
NumberFormat formatter = new DecimalFormat("000");
List<ARMA> ListRBSAANakedTorso = new ArrayList<>();
for (ARMA sourceAA :... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == cancelButton) {
dispose();
} else if (e.getSource() == nextButton) {
switchToPage(currentPage.getNextPage());
} else if (e.getSource() == previousButton) {
switchToPage(currentPage.getPreviousPage());
} else if (e.getSource() ... | 4 |
@Test
public void testReadField_public()
{
Assert.assertEquals(
"public",
ReflectUtils.readField(new Bean(), "_field4")
);
} | 0 |
private static String getString(ByteBuf packetPDU) {
String value = "";
byte nextChar = -1;
while ((nextChar = packetPDU.readByte()) != 0x2F) { // read until a '/' is encountered
value += ((char) nextChar);
}
return value;
} | 1 |
private int getSyndromeIndex(String recievedi) {
int[] recieved = new int[7];
for(int i = 0; i < 7; ++i)
{
recieved[i] = recievedi.charAt(i) == '0' ? 0 : 1;
}
int[] syndrome = new int[3];
Arrays.fill(syndrome, 0);
// calc syndrome by z=Hr
for(int i = 0; i < 3; ++i)
for(int k = 0; k < 7; ++k... | 5 |
public static void main(String[] args)
{
System.out.println("Введіть розмірність ->");
Scanner ku = new Scanner(System.in);
int size = ku.nextInt();
int vector[] = null;
vector = new int[size];
System.out.println("Введіть мінімум -->");
int min = ku.nextInt();
System.out.println("Введіть максимум -->"... | 5 |
public String getStyle(String lineEnding) {
return FileTools.readFileToString(this.styleName, lineEnding);
} | 0 |
@Override
public void handleEvent(Event event) {
if (event.getType() == EventType.PLAYER_STATUS_CHANGE && event.getOriginator() instanceof Player) {
Player player = (Player) event.getOriginator();
if (player.getPlayerStatus() == PlayerStatus.WON) {
getGrid().getEventManager().sendEvent(new Event(EventType.... | 6 |
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.