text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void merge(int[] myList, int low1, int mid, int low2, int high)
{
/* check if stopButton has been selected */
if(stopFlag == true)
{
return;
}
/* create a temp array to hold the sorted ints, initialize iterators etc. */
int[] tempArray ... | 8 |
public void movimiento(){
while(carro.getCaminoEnSeguimiento().darPrimerNodo()!=null)
{
if(carro.evaluarSiguienteMovimiento()){
try {
sleep(movingTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
carro.avanzarEnCamino();
}
else
{
try {
sleep(waitingTime)... | 4 |
public Object getValueAt(int row, int col) {
if (row > -1 && col > -1 && data != null) {
return data[row][col];
} else {
return null;
}
} | 3 |
public static void main(String[] args) {
try {
Socket sk = new Socket("192.168.1.220",9090);
sk.getOutputStream().write("GET /echo HTTP/1.1\r\n".getBytes("utf-8"));
sk.getOutputStream().write("Upgrade: websocket\r\n".getBytes("utf-8"));
sk.getOutputStream().write("Connection: Upgrade\r\n".getBytes("utf-8"... | 3 |
private static ArrayList<Double> loadFunctionData( String filename ){
ArrayList<Double> fnData = new ArrayList<Double>();
try
{
java.io.InputStream in = Wavelet.class.getResourceAsStream(filename);
CSVReader reader = new CSVReader(new InputStreamReader(in));
List<String[]> myEntries = reader.... | 3 |
public String getData() {
if (data == null)
return null;
return data.toString();
} | 1 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) {
return motherLangWordList.get(rowIndex);
}
if (columnIndex == 1) {
return translationList.get(rowIndex);
}
if (columnIndex == 2) {
return idList.get... | 3 |
public static void main(String args[]){
int i=0;
int j=0;
for(i=1;i<10;i++){
for(j=1;j<10;j++){
totalarray[i][j] = cross;
}
}
for(i=1;i<4;i++){
for(j=1;j<4;j++){
subarray(i,j);
}
}
finalwin = checkarray(bigarraydecision,zero);
finalwin = checkarray(bigarraydecision,cross... | 4 |
public static <T> T fromJson(final String inJson, Class<T> objClass) {
try {
boolean errorFound = false;
// if API returned errors or warnings
if (GsonErrors.class.isAssignableFrom(objClass)) {
GsonErrors gsonErrors = gson.fromJson(inJson, GsonErrors.class);
if (gsonErrors != null) {
// print er... | 8 |
protected List<Exit> findExits(Modifiable M,XMLTag piece, Map<String,Object> defined, BuildCallback callBack) throws CMException
{
try
{
final List<Exit> V = new Vector<Exit>();
final String tagName="EXIT";
final List<XMLLibrary.XMLTag> choices = getAllChoices(null,null,null,tagName, piece, defined,true);... | 8 |
public static void main(String[] args) {
// Initialization
Deck playDeck = new Deck();
playDeck.shuffle();
Hand playerHand = new Hand();
playerHand.drawNewHand(playDeck);
Hand computerHand = new Hand();
computerHand.drawNewHand(playDeck);
// Playing the game
playerHand.evaluate();
int[] playerSco... | 4 |
@Override
public void run() {
Object value = null;
RoomInfo roomInfo;
String resultString;
try {
oIn = new ObjectInputStream(new BufferedInputStream(
socket.getInputStream()));
value = oIn.readObject();
try {
roomInfo = getByEvent((String) value);
if(roomInfo!=null)
{
r... | 4 |
public static <T, E> T getKeyByValue(Map<T, E> map, E value) {
for (Map.Entry<T, E> entry : map.entrySet()) {
if (value.equals(entry.getValue())) {
return entry.getKey();
}
}
return null;
} | 2 |
@Override
public boolean equals(Object obj) {
if (obj instanceof BulkItem) {
BulkContainer objBulk = (BulkContainer) obj;
if (objBulk.food == this.food && objBulk.amount == this.amount
&& objBulk.unit == this.unit && objBulk.container == this.container)
return true;
else
return false;
}//if... | 5 |
public void keyReleased(KeyEvent evt){
switch(evt.getKeyCode()){
case KeyEvent.VK_W:
upPress = 0;
break;
case KeyEvent.VK_S:
downPress = 0;
break;
case KeyEvent.VK_A:
leftPress = 0;
break;
case KeyEvent.VK_D:
rightPress = 0;
break;
... | 5 |
public TeaNode getNode(String[] valuesCombination) {
String[] strValues = new String[2];
strValues[0] = valuesCombination[0];
strValues[1] = valuesCombination[2];
Double sugar = valuesCombination[1] == null ? 0
: Double.parseDouble(valuesCombination[1]);
for (TeaNode node : this.nodes()) {
if(ArrayUtil... | 3 |
private static boolean
backrefMatcher(REGlobalData gData, int parenIndex,
char[] chars, int end)
{
int len;
int i;
int parenContent = gData.parens_index(parenIndex);
if (parenContent == -1)
return true;
len = gData.parens_length(parenIndex)... | 7 |
public List<infoNode> getInfo() {
ArrayList<infoNode> info = new ArrayList<infoNode>();
NodeList infoNodes = node.getChildNodes();
for (int i = 0; i < infoNodes.getLength(); i++) {
Node node = infoNodes.item(i);
if (node.getNodeType()... | 2 |
private boolean initialize()
{
CommPortIdentifier portID = null;
Enumeration ports = CommPortIdentifier.getPortIdentifiers();
System.out.println("Trying ports:");
while(portID == null && ports.hasMoreElements())
{
CommPortIdentifier testPort = (CommPortIdentifier) ports.nextElement();
System.out.printl... | 7 |
public void report_error(String message, Object info) {
StringBuffer m = new StringBuffer("Error");
if (info instanceof java_cup.runtime.Symbol) {
java_cup.runtime.Symbol s = ((java_cup.runtime.Symbol) info);
if (s.left >= 0) { ... | 3 |
private void makePacks(List<Card> cardList) {
for (Card.Suit suit : Card.Suit.values()) {
//No kings.
for (int i = 0; i < Card.Rank.values().length - 1; i++) {
cardList.add(new Card(suit, Card.Rank.values()[i], true));
}
//No kings or aces.
... | 3 |
private void jBt_IngresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBt_IngresarActionPerformed
// TODO add your handling code here:
ButtonModel bm = this.bGr_Motivo.getSelection();
if(bm!=null){
if(this.jRb_Archivo1.isSelected()) // Si es ingreso manual, pasa... | 7 |
private void paintOnScreen() {
try {
graphics = buffer.getDrawGraphics();
graphics.drawImage( bi, 0, 0, null );
if( !buffer.contentsLost() )
buffer.show();
Thread.yield(); // Let the OS have a little time...
} finally {
// release resources
if( graphics != null )
graphics.dispose();
... | 3 |
@Override
public void collideWith(Element e) {
if (e instanceof PlayerCTF) {
final PlayerCTF playerEntered = (PlayerCTF) e;
// You have to enter your own StartingPosition
if (player.equals(playerEntered)) {
final PlayerFlag inventoryFlag = playerEntered.getInventory().findFlag();
if (inventoryFlag !... | 4 |
public boolean matchesAndOneAbove(Card other) {
return (other.getSuit() == this.suit && this.rank.ordinal() == other.getRank().ordinal() + 1);
} | 1 |
public boolean SurviveVisions(int[] inTargets, byte[] inVisions){ // returns true if this set of visions is compatible
// with this GameState. In the boolean array, 1 means innocent, 2 means wolf, 0 means no target.
boolean output = true;
for(int n = 0; n < NumPlayers; n++){
if(this.playerTest(n+1) == 2){
... | 7 |
private void preprocessDataTwo(double commonError){
// Check row and column lengths
this.numberOfRows = this.values.length;
this.numberOfColumns = this.values[0].length;
for(int i=1; i<this.numberOfRows; i++){
if(this.values[i].length!=this.numberOfColumns)throw new Illeg... | 5 |
SlotAction parseSlotAction (Model model, Set<String> variables) throws Exception
{
String operator = "";
if (t.getToken().equals("-") || t.getToken().equals("<") || t.getToken().equals(">")
|| t.getToken().equals("<=") || t.getToken().equals(">="))
{
operator = t.getToken();
t.advance();
}
Symbol s... | 9 |
public void generate(int files, int payments) {
int x;
int y;
int total = 0;
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
for (x = 0; x < files; x++) {
Document doc = docBuilder.newDocument();... | 7 |
public int GetTravelTime()
{
//return the travel time
return this.offBusTicks - this.onBusTicks;
} | 0 |
public void disconnect() {
try {
if(sInput != null) sInput.close();
}
catch(Exception e) {} // not much else I can do
try {
if(sOutput != null) sOutput.close();
}
catch(Exception e) {} // not much else I can do
try{
if(socket != null) socket.close();
}
catch(Exception e) {} // not much... | 7 |
protected boolean canHaveAsElement(Position pos, Element elem) {
return elem != null && pos != null && grid.getElementsOnPosition(pos).isEmpty();
} | 2 |
public static double binaryShannonEntropyDit(double p) {
if (p > 1.0) throw new IllegalArgumentException("The probabiliy, " + p + ", must be less than or equal to 1");
if (p < 0.0) throw new IllegalArgumentException("The probabiliy, " + p + ", must be greater than or equal to 0");
double entropy = 0.0D;
if (p... | 4 |
protected void avoid(mxCellState edge, mxCellState vertex)
{
mxIGraphModel model = graph.getModel();
Rectangle labRect = edge.getLabelBounds().getRectangle();
Rectangle vRect = vertex.getRectangle();
if (labRect.intersects(vRect))
{
int dy1 = -labRect.y - labRect.height + vRect.y;
int dy2 = -labRect.y... | 6 |
public State getState()
{
return state;
} | 0 |
public void draw(Graphics2D g) {
int w = getWidth();
int h = getHeight();
RoundRectangle2D box = new RoundRectangle2D.Float(
0, 0, w, h, 20, 20);
g.setColor(background);
g.fill(box);
GradientPaint paint;
/*
GradientPaint paint = new GradientPaint(
... | 5 |
@Override
public String get(long i)
{
if (ptr != 0) {
short strLen = stringLengths.getShort(i);
if (strLen < 0) return null;
long offset = sizeof * i * maxStringLength * CHARSET_SIZE;
for (int j = 0; j < strLen; j++) {
byteArray[j] = Utilit... | 5 |
public void sortBySuit() {
// Sorts the cards in the vHand so that cards of the same suit are
// grouped together, and within a suit the cards are sorted by value.
// Note that aces are considered to have the lowest value, 1.
Vector vNewHand = new Vector();
while (vHand.size() > 0... | 5 |
public static void main(String[] args) {
ArrayList<Commands> inputCommands;
ArrayList<Commands> outputCommands;
ArrayList<Commands> sorted;
Scanner inputText = new Scanner(System.in);
String text;
String path = "";
System.out.println("Enter path-name or l... | 4 |
public String getRecommendListForPreferentialAttachment() {
String recommend = "";
try {
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/NETWORK_TEST?"
+ "user=root&password=root");
connect.setAutoCommit(false);
statement = connect.cr... | 8 |
public Route geefRoute(Knooppunt start, Knooppunt stop) throws IllegalArgumentException {
if(knooppuntOpMuur(stop) == true || knooppuntOpMuur(start) == true) throw new IllegalArgumentException("start en/of stop mogen niet op een muur vallen");
if (start.equals(stop)) {
Route routeNaarZelfde... | 3 |
private boolean cargarProductosVendidos(int idVenta, LinkedList<Pair> productos, LinkedList<BigDecimal> preciosFinales) {
boolean resultOp = true;
Iterator itr = productos.iterator();
Articulo prod;
Pair par;
BigDecimal cant;
Venta v = Venta.findById(idVenta);
if ... | 5 |
public boolean mousedown(Coord c, int button) {
if (folded) {
if (!c.isect(Coord.z, isz.add(cl.sz())))
return false;
if (c.isect(Coord.z.add(cl.sz()), isz))
return true;
}
if (awnd != null)
awnd.setfocus(awnd);
else
... | 8 |
public static void closeDB() {
try {
if (connection != null) {
connection.close();
}
if (statement != null) {
statement.close();
}
if (rs != null) {
rs.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} | 4 |
protected void gmcpSaySend(String sayName, MOB mob, Environmental target, CMMsg msg)
{
if((mob.session()!=null)&&(mob.session().getClientTelnetMode(Session.TELNET_GMCP)))
{
mob.session().sendGMCPEvent("comm.channel", "{\"chan\":\""+sayName+"\",\"msg\":\""+
MiniJSON.toJSONString(CMLib.coffeeFilter().fullOut... | 8 |
private static Relationshiptype setBeanProperties(ResultSet resultset) {
Relationshiptype relationshiptype = new Relationshiptype();
try {
relationshiptype.setId(resultset.getInt("id"));
relationshiptype.setName_a_b(resultset.getString("name_a_b"));
relationshiptype.s... | 8 |
@Override
public Extension[] getChildren()
{
NodeList children = configEntry.getChildNodes();
if(children != null) {
Extension[] res = new Extension[children.getLength()];
int newIndex = 0;
for(int i = 0; i < children.getLength(); i++) {
Node entry = children.item(i);
// make sure that i... | 5 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 1; t <= T; t++) {
int N = sc.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = sc.nextInt();
}
... | 8 |
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((dir == null) ? 0 : dir.hashCode());
result = prime * result + ((hexLoc == null) ? 0 : hexLoc.hashCode());
return result;
} | 2 |
@Override
public boolean halt(Event lastEvent, OurSim ourSim) {
boolean halt = true;
List<Job> finishedJobsList = new LinkedList<Job>();
for (ActiveEntity entity : ourSim.getGrid().getAllObjects()) {
if (entity instanceof Broker) {
Broker broker = (Broker) entity;
List<Jo... | 6 |
public void declareWinner() {
int white, black;
white = black = 0;
String string;
for(int i = 0 ; i < board_row; i++) {
for(int j = 0; j < board_col; j++) {
ChipColor color = board_array[i][j].getChipColor();
if(color == ChipColor.WHITE)
... | 5 |
public void save() throws IOException {
JSONObject json = new JSONObject();
json.put("startYear", startDate.getYear());
json.put("startMonth", startDate.getMonth());
json.put("startDay", startDate.getDay());
json.put("username", username);
json.put("displayName",... | 1 |
public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... | 6 |
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if(string != null) {
for(int i=0;i<string.length;i++) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FontRenderContext frc = g2.getFontRende... | 3 |
public Object getInternal() {
return internal;
} | 0 |
private String readByteArray() {
StringBuffer buf = new StringBuffer();
int count = 0;
char w = (char) 0;
// read individual bytes and format into a character array
while ((loc < stream.length) && (stream[loc] != '>')) {
char c = (char) stream[loc];
byte... | 9 |
private void AITurn() throws CloneNotSupportedException {
Coordinates toHit = new Coordinates();
do {
// first time hit any ship
if (strategie == null && lastAttackResult == true) {
strategie = new AttackStrategie(lastAttack);
toHit = strategie.g... | 5 |
public String convert(HashMap<String, Integer> dv) {
// El mensaje debe ser en la forma IP:costo para cada elemento del dv en vez del espacio como separador del vector
StringBuilder result = new StringBuilder();
result.append("From:");
result.append(Setup.ROUTER_NAME);
result.ap... | 1 |
public void monitorFileModify(Path file) {
try {
if(file.startsWith(sourceDir) &&
!Files.isDirectory(file)){
Path subPath = sourceDir.relativize(file);
for(Path targetDir : targetDirs){
Path newPath = targetDir.resolve(subPath);
if(!newPath.toFile().exists() || !FileUtils.content... | 6 |
public void setDescriptor(String desc) {
if (!desc.equals(getDescriptor()))
descriptor = constPool.addUtf8Info(desc);
} | 1 |
@Override
public JSONObject addPUserPollActivity(String userId, String name,
String option) throws JSONException {
boolean isSuccess=false;
JSONObject mainobj=new JSONObject();
try {
pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(Poll.class, ":p.contains(pollName)");
List<Poll> res... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
MInterface other = (MInterface) obj;
if (operations == null) {
if (other.operations != null)
return false;
} else if (!operations... | 8 |
public String getSchemeSpecificPart() {
StringBuffer schemespec = new StringBuffer();
if (m_userinfo != null || m_host != null || m_port != -1) {
schemespec.append("//"); //$NON-NLS-1$
}
if (m_userinfo != null) {
schemespec.append(m_userinfo);
schemespec.append('@');
}
if (... | 9 |
private void export() {
if(modelCompareShipping == null) return;
Integer columnCount = jTableReport.getColumnCount() == 0 ? 1 : jTableReport.getColumnCount();
Integer rowCount = jTableReport.getRowCount() + 5;
Object[][] data = new Object[rowCount][columnCount];... | 9 |
public String getAddressDetail() {
StringBuilder addressDetail = new StringBuilder();
addressDetail.append(getStreetName() + "\n" + getCityName() + ", "
+ getStateName() + "\n" + getCountry() + "\nPin: "
+ getZipCode());
return addressDetail.toString();
} | 0 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
fillFibo(45);
int testCases = Integer.parseInt(in.readLine().trim());
for (int t = 0; t < testCases; t++) {
int n = Integer.parseInt... | 6 |
public static Packet01JSON decode(byte[] data) throws IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(data);
try {
stream.reset();
return new Packet01JSON(mapper.readValue(stream, Map.class));
} catch (Exception e) {
System.out.println("od... | 1 |
public void run() {
try {
Telnet.writeLine(cs, "<fggreen> >>> Welcome to AdaMUD <<< <reset>");
Telnet.flushInput(cs);
while((player = s.getPlayerDB().login(cs, s)) == null);
player.look();
while (true) {
System.out.println("Waiting for message");
String message = Telnet.readLine(cs).tri... | 5 |
public static int uniforme(double... probas) {
// TODO à revoir
double p = rand.nextDouble();
// System.out.println("p : " + p);
boolean stop = false;
int i = 0;
double proba = 0;
while (!stop && i < probas.length) {
// System.out.println("i : " + i);
... | 3 |
public short deinitialize()
{
exit.set(true);
// Stop the packet sniffing
MsgAnalyzerCmnDef.WriteDebugSyslog("De-initialize the SerialReceiver object\n");
short ret = serial_receiver.deinitialize();
if (MsgAnalyzerCmnDef.CheckFailure(ret))
return ret;
// Notify the worker thread of analyzing serial data to... | 3 |
public int Problem41() {
for (int n=9;n>=1;n--) {
int[] digits = new int[n];
for (int i=0;i<digits.length;i++) {
digits[i]=i+1;
}
int result=-1;
do {
if(Utility.isPrime(Utility.toInteger(digits))) {
result = Utility.toInteger(digits);
}
}while (Utility.nextPermutation(digits));
i... | 5 |
private Cmds getCommand(String message) {
int begin = message.indexOf(' ') + 1;
int end = message.indexOf(' ', begin);
if(end == NOT_FOUND)
end = message.length();
String cmd = message.substring(begin, end).toUpperCase();
try {
return Cmds.valueOf(cmd);
... | 2 |
private void assignGamePoints() {
// Get our card points and game value.
int curCardPoints = countCardPoints(declarerIndex);
int curGameValue = gameValue();
// Grab our player and tricks won pile for them.
PlayerInfo player = players[declarerIndex];
Pile pile = player.getTricksWonPile();
// There ar... | 8 |
public static boolean isValid(MouseEvent e, Canvas c, Palette pal)
{
if (pal != null && pal.getSelectedColor(e.getButton()) == null) return false;
Point p = e.getPoint();
if (p.x < 0 || p.y < 0) return false;
Dimension d = c.getImageSize();
if (p.x >= d.width || p.y >= d.height) return false;
retur... | 6 |
private VappClient createVApp(IControllerServices controllerServices, String vCloudUrl, String username, String password, String orgName, String vdcName, String vAppName, String catalogName, String templateName, String network) throws ConnectorException
{
VappClient vCloudApp = new VappClient(controllerServices);
... | 1 |
@Override
public void loadRcon() throws DataLoadFailedException {
Map<String, Object> data = getData("server", "name", "rcon");
load(PermissionType.RCON, "rcon", data);
} | 0 |
public final synchronized void close(){
if(fileFound){
try{
input.close();
}catch(java.io.IOException e){
System.out.println(e);
}
}
} | 2 |
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 feel.
* For details see http://down... | 6 |
/* */ public void checkFire()
/* */ {
/* 114 */ for (int i = 0; i < Core.barricades.size(); i++) {
/* 115 */ Barricade b = (Barricade)Core.barricades.get(i);
/* 116 */ if (this.hitCheck.intersects(b.getBox())) {
/* 117 */ this.autoFire = false;
/* */ }
/* */ }
/* 12... | 5 |
public static ArrayList<Model3D> clone(ArrayList<Model3D> l) {
ArrayList<Model3D> models = new ArrayList<Model3D>();
Model3D model;
for (Model3D m : l) {
model = new Model3D();
for (Face f : m.getFaces()) {
model.getFaces().add(new Face(new Point(f.p1.x, f.p1.y, f.p1.z), new Point(f.p2.x, f.p2.y, f.p2.z... | 4 |
static List<Language> getLanguages(Path languageProperties) throws IOException {
if (!FileUtil.control(languageProperties)) {
throw new IOException();
}
if (languages == null) {
readLanguageProperties(languageProperties);
}
return languages;
} | 2 |
public void applyUpdate(Contact update) {
if (update == null) return;
if (update.getId() != 0 && update.getId() != this.getId() )
throw new IllegalArgumentException("Update contact must have same id as contact to update");
// Since title is used to display contacts, don't allow empty title
if (! isEmpty( upd... | 7 |
int skipCommentsAndQuotes(char[] expressionChars, int position) {
String[] startSkip = getStartSkip();
for (int i = 0; i < startSkip.length; i++) {
// 判断表达是否和注释的起始标识匹配
if (expressionChars[position] == startSkip[i].charAt(0)) {
boolean match = true;
for (int j = 1; j < startSkip[i].length(); j++) {
... | 5 |
protected synchronized void refreshDicWords(String dicPath) {
int index = dicPath.lastIndexOf(".dic");
String dicName = dicPath.substring(0, index);
if (allWords != null) {
try {
Map/* <String, Set<String>> */temp = FileWordsReader
.readWords(dicHome + dicPath, charsetName);
allWords.put(dicName,... | 9 |
@Override
public void process(WatchedEvent event) {
System.out.println("[" + Thread.currentThread() + "event : "
+ event);
switch (event.getType()) {
case None:
switch (event.getState()) {
case Disconnected:
... | 8 |
public void mouseReleased(MouseEvent event) {
adapter.mouseReleased(event);
} | 0 |
public static DatarateProperty createSoftRequirement(int bandwidthKBitSec, double percentageMinimalRequired)
{
if(percentageMinimalRequired > 1) percentageMinimalRequired = 1.0d;
if(percentageMinimalRequired < 0) percentageMinimalRequired = 0;
// do we require 100% of requested at minimum?
if(percentageMinima... | 3 |
private double getHeightScalingConstant(){
double s = 0.0;
if(!maxWeightMap.isEmpty() && !davidAvgGVC){
for(Map.Entry<String, Double> entry : maxWeightMap.entrySet()){
s += entry.getValue();
}
} else if (!averageAttributeWeights.isEmpty() && davidAvgGVC) {
for (Map.Entry<Strin... | 6 |
public Collection<ProvinciaDTO> buscarPorDepartamento (int iddepa)
{
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
try {
con = UConnection.getConnection();
String sql = "SELECT p.* "
+ "FROM ub... | 5 |
public void Display_store() {
final Iterator iter = IndStore.values().iterator();
while (iter.hasNext()) {
final Swizzler indswz = (Swizzler) iter.next();
System.out.println("\nIV: " + indswz.ind_var() + " tgt: "
+ indswz.target() + "\narray: " + indswz.array()
+ " init: " + indswz.init_val() + " ... | 1 |
@EventHandler(priority=EventPriority.LOWEST)
public void onPlayerInteract(final PlayerInteractEvent event) {
if(isPlaying.contains(event.getPlayer().getName())) {
if(event.getPlayer().getItemInHand() != null) {
if(event.getPlayer().getItemInHand().getType().equals(Material.MUSHROOM_SOUP)) {
if(event... | 5 |
public void eatMeat(int meat) {
this.meat -= meat;
if (this.meat <= 0) {
this.timeOfInertion = 0;
}
} | 1 |
private int jjMoveStringLiteralDfa23_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 22);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 22);
}
switch(curChar)
{
case 45:
return jjMoveStringLiter... | 3 |
public boolean tablanvan(){
if(hovaakar1>-1 && hovaakar2>-1 && hovaakar1<8 && hovaakar2<8)
return true;
else {
logger.info("A lépés nem a táblán van!");
return false;
}
} | 4 |
@Override
protected void updateShareRate(Share share)
{
List<Long> history = historyData.get(share.name);
if(history != null && flag < history.size()){
share.setActualSharePrice(history.get(flag));
}else{
flag = 1;
}
} | 2 |
@Test
public void delMinReturnsCorrectValueAfterSingleInsert() {
h.insert(v);
assertEquals(v, h.delMin());
} | 0 |
public String getToken() {
cadtmp = null;
for (int x = this.getBegin(); x < this.getCad().length(); x++) {
chartmp = this.getCad().charAt(x);
this.setBegin(x);
if (chartmp != ' ') {
if (Pattern.matches(this.getMatchValue(), chartmp + "")) {
... | 4 |
private static byte[][] ShiftRows(byte[][] state) {
byte[] t = new byte[4];
for (int r = 1; r < 4; r++) {
for (int c = 0; c < Nb; c++)
t[c] = state[r][(c + r) % Nb];
for (int c = 0; c < Nb; c++)
state[r][c] = t[c];
}
return state;
} | 3 |
public void setUse(String ID, boolean use)
{
int row = getIndex(ID);
if (row == -1)
return;
rows.get(row)[USE] = new Boolean(use);
} | 1 |
public static Graph randomTree4() {
int depth = 6;
Graph graph = new Graph(depth * 100, depth * 50);
int a = 0;
int b = 1;
int c = 0;
graph.addVertex(new Vertex(c++, 25, 25 + 25 * (depth - 1)));
for (int i = 1; i < depth; i++) {
for (int j = 0; j <= i; j++) {
graph.addVertex(new Vertex(c++, 25 +... | 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.