text stringlengths 14 410k | label int32 0 9 |
|---|---|
public synchronized final void open() {
if (open) {
throw new JPLException("Query is already open");
}
if (Prolog.thread_self() == -1) { // this Java thread has no attached Prolog engine?
engine = Prolog.attach_pool_engine(); // may block for a while, or fail
// System.out.println("JPL attaching engine["... | 6 |
private int WhiteBlackPiecesDifferencePoints(Board board) {
int value = 0;
// Scan across the board
for (int r = 0; r < Board.rows; r++) {
// Check only valid cols
int c = (r % 2 == 0) ? 0 : 1;
for (; c < Board.cols; c += 2) {
assert (... | 7 |
private static void setupWindowListeners()
{
if( !SystemTray.isSupported() ) return;
_parent.addWindowStateListener(new WindowStateListener() {
@Override
public void windowStateChanged(WindowEvent e) {
System.gc();
if( e.getNewState() == JFrame.ICONIFIED || e.getNewState() == 7) {
_... | 6 |
public static void createWindow(int width, int height, String title)
{
try
{
Display.setTitle(title);
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
}
catch (LWJGLException e)
{
e.printStackTrace();
... | 1 |
private static boolean checkName(String name){
for (User user: userList){
if (user.getName().equals(name)){
return false;
}
}
return true;
} | 2 |
private Point[] generateRandomPoints(int n) {
if (n <= 1)
return null;
double footStep = 3 * AtomicModel.aminoAcidElement[0].getSigma();
Dimension dimension = new Dimension((int) (model.boundary.getSize().width / footStep), (int) (model.boundary
.getSize().height / footStep));
if (walkGenerator == nul... | 8 |
private boolean jj_3R_78() {
if (jj_scan_token(FUNCTION)) return true;
if (jj_3R_88()) return true;
if (jj_3R_91()) return true;
return false;
} | 3 |
public static Level getLogLevel(int level) {
if (level <= 0) {
return Level.ALL;
} else {
switch (level) {
case 1:
return Level.FINEST;
case 2:
return Level.FINER;
case 3:
return Level.FINE;
case 4:
return Level.WARNING;
case 5:
return Level.SEVERE;
default:
... | 6 |
public String masaAktar(String kaynakAdi){
Bilgisayar kaynakPc = masaBul(kaynakAdi);
if(kaynakPc.getAcilisSaati()!=null){
Object[] possibleValues = mutlakkafe.MutlakKafe.mainCont.getBilgisayarC().kapaliMasaIsimleriGetir();
Object AktarilacakMasa = JOptionPane.showInputD... | 3 |
@Override public void finishPopulate()
{
} | 0 |
public void validate(final Object paramValue, final Object value) throws IllegalArgumentException,
IllegalStateException {
if (null == paramValue) {
throw new IllegalStateException("Null value found when expecting not null value.");
}
} | 1 |
public static void main(String[] args) {
long res1 = 0;
for(int i = 1; i <= 100; i++)
{
res1 += i*i;
}
long res2 = 0;
for(int i = 1; i <= 100; i++)
{
res2 += i;
}
res2 = res2 * res2;
System.out.println(res2-res1);
} | 2 |
public void testProvider() {
try {
assertNotNull(DateTimeZone.getProvider());
Provider provider = DateTimeZone.getProvider();
DateTimeZone.setProvider(null);
assertEquals(provider.getClass(), DateTimeZone.getProvider().getClass());
tr... | 4 |
public void testIsEqual_YMD() {
YearMonthDay test1 = new YearMonthDay(2005, 6, 2);
YearMonthDay test1a = new YearMonthDay(2005, 6, 2);
assertEquals(true, test1.isEqual(test1a));
assertEquals(true, test1a.isEqual(test1));
assertEquals(true, test1.isEqual(test1));
assertEqu... | 1 |
public void run()
{
for(;;)
{
try
{
++x;
if(x==(wd-200))
{
c=Color.red;
repaint();
break;
}
repaint();
Thread.sleep(20);
}catch(Exception ee){}
}
} | 3 |
public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
int ticks = 0;
int frames = 0;
long lastTimer = System.currentTimeMillis();
double delta = 0;
init();
while (running) {
long now = System.nanoTime();
delta += (now - lastTime) / nsPerTick;
lastTime ... | 5 |
@Override
public void undo() {
node.setEditableState(oldState);
} | 0 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> already <S... | 8 |
public int[] makeMove(){
Random rng = new Random();
int[] temp = new int[COORDS];
int[] answer = new int[COORDS];
if(BOARD_SIZE-1 > m_posX && m_rightMove == true){
answer[0] = m_posX + 1;
answer[1] = m_posY;
m_posX += 1;
}else if(m_posX > 0){
m_rightMove = false;
a... | 5 |
public int getLevel(ClassNode c) {
if ((c.access & ACC_INTERFACE) != 0) {
return 0;
}
return getHierarchy(c).length - 1;
} | 1 |
public void clear(String typeEntity){
ResultSet rs = this.getResultsOfQuery("SELECT * FROM "+megatable+" WHERE typeEntity='"+typeEntity+"'");
ArrayList<String> entries = new ArrayList<>();
try {
while (rs.next())
{
String s = extractString(rs,"idEntity");
... | 4 |
public ParseResult parse(Map<String, String> values) throws ValidationException {
Map<Field, Object> results = new HashMap<>();
for (Field field : fields) {
String value = values.get(field.getName());
Object result = field.validate(value);
if (result != null) {
results.put(field, resul... | 2 |
public FastSharder(String baseFilename, int numShards,
VertexProcessor<VertexValueType> vertexProcessor,
EdgeProcessor<EdgeValueType> edgeProcessor,
BytesToValueConverter<VertexValueType> vertexValConterter,
BytesToValueConvert... | 4 |
public static void startupTaxonomies() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if... | 6 |
private void correctInputReader(Reader reader) {
String msg = null;
if(reader == null) {
msg = "Input reader is null";
}
if(reader.getFullName() == null) {
msg = "Reader's name is null";
}
if(reader.getFullName().isEmpty()) {... | 9 |
private final boolean isFriend(String[] list, String name) {
for (int i = 0; i < list.length; i++) {
if (list[i].equalsIgnoreCase(name)) {
return true;
}
}
return false;
} | 2 |
private void waitForSizeLowerThan(int expectedSize) throws InterruptedException {
synchronized (sizeUpdateLock) {
while (expectedSize < currentSize) {
sizeUpdateLock.wait();
}
}
} | 1 |
private boolean createGridlets() {
int nodes = 1;
double runTime = -1;
long arrTime;
for (int i=0; i<numJobs; i++) {
arrTime = getNextArrival(aarr, barr);
if(arrTime > workloadDuration) {
System.out.println("WorkloadDAS2: number of generated jobs: "... | 3 |
@Override
public void run() {
while(true){
// If we us the HMI at all outputs
if(hmi.useHMI){
processOutputs();
}
try{
Thread.sleep(100);
} catch(InterruptedException ie){
System.out.println("Interruption of HmiSenderThread in sleep()");
}
}
} | 3 |
private boolean isProjectSetDirectory(File dir) {
List<File> files = dirFilelist(dir);
List<File> dirs = dirDirlist(dir);
if (getProjectList(dir, MAX_SET_SCAN_DEPTH).isEmpty())
return false;
for (File f : files) {
for (String ext : PROJECT_SETS) {
if (f.getName().endsWith(ext))
return true;... | 8 |
@Override
public void Update(double timeDelta)
{
//Quick if check for optimization reasons - no reason to do work when the motor isn't supposed to be on
if (m_powerCountdown != 0.0)
{
//if the robot re-oriented itself, cached sine and cosine values need to be re-calculated
double rotation = m_robot.GetTra... | 3 |
public void setStatic(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int modifiers = fieldInfo.modifiers();
if (flag) {
modifiers |= Modifiers.STATIC;
} else {
modifiers &=... | 2 |
private boolean createBond(Atom a1, Atom a2) {
if (a1 == null || a2 == null || a1 == a2)
return false;
if (!bonds.isEmpty()) {
RadialBond rBond;
Atom origin, destin;
synchronized (bonds.getSynchronizationLock()) {
for (Iterator it = bonds.iterator(); it.hasNext();) {
rBond = (RadialBond) it.nex... | 9 |
public static void main(String[] args) {
Goose goose = new Goose();
relocate(goose);
// Relocate a Penguin
} | 0 |
public static void main(String[] args) {
// new Chatty().run();
Chatty chatty = new Chatty();
if (args.length > 0 && args[0] != null) {
int instances = Integer.parseInt(args[0]);
chatty.test(instances, null);
} else if (args.length == 2) {
int instances = Integer.parseInt(args[0]);
String hostname =... | 3 |
@SuppressWarnings("unchecked")
public T next() {
if (!hasNext()) return null;
Object tmp = items[pos];
succ();
return (T)tmp;
} | 1 |
public static ArrayList<CardAccount> getCardAccounts(Customer customer){
SQLiteJDBC db = new SQLiteJDBC();
ArrayList<CardAccount> card_accounts = new ArrayList<CardAccount>();
String sql = String.format("SELECT account_num FROM card_accounts WHERE user_id='%d'",customer.getID());
... | 2 |
private void growSnow(Location solidBlock) {
double x = solidBlock.getBlockX();
double y = solidBlock.getBlockY();
double z = solidBlock.getBlockZ();
Location snowBlock = new Location(
solidBlock.getWorld(), solidBlock.getBlockX(), solidBlock.getBlockY(), solidBlock.getBlockZ());
snowBlock.setY(y + 1);
... | 8 |
public boolean parse(Page page, String contextURL) throws InstantiationException, IllegalAccessException {
Metadata metadata = new Metadata();
parseContext.set(HtmlMapper.class, AllTagMapper.class.newInstance());
// start modification by Adeesha
// filter web pages using ... | 8 |
private byte[] calculateUValue(
byte[] generalKey, byte[] firstDocIdValue, int revision)
throws
GeneralSecurityException,
EncryptionUnsupportedByProductException {
if (revision == 2) {
// Algorithm 3.4: Computing the encryption dictionaryâs U (user... | 3 |
public static JSONObject getJson(final Entity result,
final String returnField) {
JSONObject jsonObject = new JSONObject();
if (result != null) {
try {
if (returnField == null || "ID".equals(returnField)) {
if (result.getKey().getName() != null) {
jsonObject.put("ID", result.getKey().getN... | 9 |
public Personimator() {
logger = Logger.getLogger("Personimator");
setTitle("Personimator");
setSize(800, 600);
setLocationRelativeTo(null);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
setLayout(null);
toolboxPanel = new T... | 7 |
public JSONObject accumulate(String key, Object value) throws JSONException {
testValidity(value);
Object object = this.opt(key);
if (object == null) {
this.put(key,
value instanceof JSONArray ? new JSONArray().put(value)
: value);
... | 3 |
private int getMediane(int[] x, int blumRecursionCount, int medianRecursionCount, StringBuffer out) {
int[] x5 = new int[5];
List<Integer> mediane = new ArrayList<>(x.length / 5 + 1);
for (int i = 0; i < x.length / 5; i++) {
x5[0] = x[5 * i];
x5[1] = x[5 * i + 1];
x5[2] = x[5 * i + 2];
x5[3] = x[5 * ... | 9 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + adressID;
result = prime * result + ((bus == null) ? 0 : bus.hashCode());
result = prime * result + ((city == null) ? 0 : city.hashCode());
result = prime * result + ((houseNr == null) ? 0 : houseNr.hashCode()... | 5 |
public RemoteInfo()
{
InputStream launcherProfile = null;
InputStream remoteInstallerProfile = null;
try
{
URL url = null;
URL url2 = new URL(VersionInfo.getRemoteInstall());
if(SimpleInstaller.getPlatform().equals(SimpleInstaller.EnumOs.WINDOWS))
... | 5 |
private static String getStringFromDocument(Document doc) {
try {
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
... | 1 |
public void serveMinute() {
if ( currentlyServing != null && currentlyServing.servedMinute() <= 0 ) {
currentlyServing = null;
}
} | 2 |
public static void triangleBsum(int x[][]) {
int sumr = 0, sumc[], sumd1 = 0, sumd2 = 0;
sumc = new int[x[0].length];
for (int i = 0; i < x.length; i++) {
sumr = 0;
System.out.print("\n ");
for (int j = 0; j < x[i].length; j++) {
if (i >= j) {
System.out.print(x[i][j] + " ");
sumc[j] = su... | 6 |
static void appendKanjiBytes(String content, BitArray bits) throws WriterException {
byte[] bytes;
try {
bytes = content.getBytes("Shift_JIS");
} catch (UnsupportedEncodingException uee) {
throw new WriterException(uee.toString());
}
int length = bytes.length;
for (int i = 0; i < len... | 7 |
public void setAdminComponentsState() {
//Включаем кнопки
buttonNew.setVisible(true);
buttonSave.setVisible(true);
buttonBreak.setVisible(true);
buttonActivate.setVisible(true);
//Делаем редактируемыми поля ввода
textFieldName.setEditable(true);
textFieldM... | 4 |
private boolean mustAddRequiredParent(TagInfo tag, CleanTimeValues cleanTimeValues) {
if (tag != null) {
String requiredParent = tag.getRequiredParent();
if (requiredParent != null) {
String fatalTag = tag.getFatalTag();
int fatalTagPositon = -1;
if (fatalTag != n... | 6 |
public String buscarGrupoEstudioPorFechaInicioFin(String fechaini, String fechafin) throws ParseException {
ArrayList<GrupoEstudio> geResult= new ArrayList<GrupoEstudio>();
ArrayList<GrupoEstudio> dbGE = tablaGrupoEstudio();
String result="";
Date fechai;
Date fechaf;
Dat... | 8 |
public List<Double> values() {
Connection conn = null;
ResultSet rs = null;
PreparedStatement ps = null;
List<Double> Values = new ArrayList<Double>();
try
{
conn = iConomy.getiCoDatabase().getConnection();
ps = conn.prepareStatement("SELECT balance FROM " + Constants.SQLTable);
... | 6 |
@Override
public double getExpectation() throws ExpectationException {
if (lambda <= 1) {
return Double.POSITIVE_INFINITY;
} else {
return lambda * k / (lambda - 1);
}
} | 1 |
public void senderror(Exception e) {
e.printStackTrace();
done = false;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
closebtn.setEnabled(true);
status.setText("An error occurred while sending!");
pack();
}
});
synchronized(this) {
try {
while(!done)
wait();... | 2 |
public boolean dialogItemChanged(GenericDialog gd, AWTEvent e) {
Vector numericFields = gd.getNumericFields();
xOrder = (int)gd.getNextNumber();
yOrder = (int)gd.getNextNumber();
xyOrder = (int)gd.getNextNumber();
if (xOrder < 0 || yOrder < 0 || xyOrder < 0 || xOrder>50 || yOrder... | 8 |
public int draw() {
if (!isDrawing)
throw new IllegalStateException("Not drawing!");
isDrawing = false;
if (VertexCount <= 0 )
return 0;
intBuffer.clear();
intBuffer.put(buffer, 0, bufferIndex);
byteBuffer.position(0);
byteBuffer.limit(bufferIndex * 4);
floatBuffer.position(0 * ... | 8 |
private void copyHeader(byte[] bytes, int offset, int length) throws IOException {
if(dataSize + length < 2) {
return;
}
if(dataSize == 0) {
data[0] = bytes[offset];
data[1] = bytes[offset+1];
} else if(dataSize == 1){
data[1] = bytes[offset];
}
headerSize = 2;
if(isMasked()) {
hea... | 8 |
@Override
public Object executeInternal(MOB mob, int metaFlags, Object... args) throws java.io.IOException
{
if(!super.checkArguments(internalParameters, args))
return Boolean.FALSE;
if(args[0] instanceof Item)
{
final Item item=(Item)args[0];
Item container=null;
boolean quiet=false;
for(int ... | 7 |
public void loadConfigs() {
this.saveResource("config.yml", false);
config = this.getConfig("config.yml");
this.defaultServerName = config.getString("defaultserver");
this.messages.put(EnumMessage.NOPERM, MessageUtil.translateToColorCode(config.getString("messages.noperm")));
th... | 5 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String labal, String[] args) {
String cmdName = cmd.getName();
String cmdPerm = cmd.getPermission();
boolean isPlayer = Utils.isSenderPlayer(sender);
boolean hasPerm = Utils.hasPermission(sender, cmdPerm);
if (!hasPerm) {sender.sendMe... | 5 |
private void setupMaze()
{
this.mazeCells.clear();
if (DebugVariables.GRID_MAPPING_INFORMATION)
{
System.err.println("Laying out basic maze structure");
}
for (int y = 0; y < this.height; y++)
{
for (int x = 0; x < this.width; x++)
... | 5 |
public String multiply(String num1, String num2) {
if (num1.equals("0") || num2.equals("0"))
return "0";
int[] n1 = new int[num1.length()];
int[] n2 = new int[num2.length()];
int[] result = new int[n1.length + n2.length];
for (int i = 0; i < n1.length; i++)
... | 9 |
public HighLevelFeatureCommand(CommandParameter par) {
if(par == null)
throw new NullPointerException("HighLevelFeatureCommand has a null CommandParameter");
this.par= par;
} | 1 |
private static void createHoughAccumulatorImage(int heightWithBorder, int widthWithBorder, int depth, int[] space, float[] circLength)
{
// output container
ShortImageBuffer image = new ShortImageBuffer(heightWithBorder, widthWithBorder);
// now we loop through the image to create the pixel... | 4 |
public void compFinalResult() {
do {
iStage++;
compAllocation();
if (compDistribution()) {
/* deadline can not be satisfied */
if (!bDeadline) {
System.out.println("CostOLB: THE DEADLINE CAN NOT BE SATISFIED!");
return;
} else {
println("\nNEW ROUND WITHOUT CHECKING:");
dEval... | 7 |
public List<Weibo> startParse(String res) {
List<Weibo> list = new ArrayList<Weibo>();
String some = "";
if (res.indexOf("\"image\":null")!=-1) {
String [] sRes = res.split("\"image\":null");
int size = sRes.length;
for (int i = 0; i < size; i++) {
if (i+1!=size) {
some = some +sRes[i]+"\"image\... | 7 |
private JoinDescriptor getJoinDescriptorForTable(String table, String shortName)
{
JoinDescriptor res = null;
for(JoinDescriptor join:joins)
{
if(join.leftMatches(table, shortName))
{
res = join;
break;
}
}
return res;
} | 2 |
public synchronized boolean update()
throws IOException
{
if (_resource!=null && !_resource.exists())
{
clear();
return true;
}
long lm=_resource.lastModified();
if (lm==_lastModified && (_buf!=null || _list!=null))
... | 9 |
protected String unlinkedExits(Session viewerS, List<String> commands)
{
final StringBuilder str=new StringBuilder("");
try
{
for(final Enumeration<Room> r=CMLib.map().rooms();r.hasMoreElements();)
{
final Room R=r.nextElement();
for(int d=Directions.NUM_DIRECTIONS()-1;d>=0;d--)
{
final Ro... | 7 |
@Override
public void tick(MainGame game, Person person) {
if(tentLoc == null) locateNewTent(game, person);
if(person.storedWood.getAmount() < buildRate)
person.changeTask(new TaskCollectResources("Wood", 50 - person.storedWood.getAmount()));
person.setTargetPosition(tentLoc.x, tentLoc.y);
if(perso... | 7 |
public void tileAction(Tile t) {
//if newTower is set, we add a new tower to the map
if(newTower){
getGame().getMap().addTower(t);
newTower = false;
}
//if newSwamp is set, we add a new swamp
else if(newSwamp){
getGame().getMap().addSwamp(t);
newSwamp = false;
}
//if neither is set and we h... | 5 |
private void grammarTextPaneKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_grammarTextPaneKeyReleased
if (evt != null && isArrowKeyCode(evt.getKeyCode())) {
return;
}
try {
grammarParser.parse(grammarTextPane.getText());
} catch (Exception ex) {
... | 5 |
protected void updateParameterValuesFromFields() {
try {
double timeStep = timeStepInputView.getValue();
runner.setSimulationTimeStep(timeStep);
} catch (NumberFormatException exception) {
}
try {
double duration = durationView.getValue();
runner.setT... | 7 |
private void drawline(GOut g, Coord d, int med, int id, Coord c0, Coord cx,
Coord sc) {
Coord m = d.abs();
Coord r = m.swap();
Coord off = m.mul(med).add(d.add(m).div(2));
int min = c0.mul(r).sum();
int max = cx.mul(r).sum() + 1;
boolean t = fal... | 6 |
public void setSelectedItems(){
if (chart.showAbsoluteRatios)
absMenuItem.setSelected(true);
if (chart.show_graph)
graphMenuItem.setSelected(true);
switch (chart.displayType){
case ValueChart.SEPARATE_DISPLAY:{
sepMenuItem.setSelected(true); break;}
case ValueChart.SIDE_DI... | 9 |
private static Moves performStep16(BotState state) {
// give armies to attack region
Moves out = new Moves();
List<Region> sortedAttackRegions = RegionValueCalculator.getOrderedListOfAttackRegions(state);
for (Region opponentRegion : sortedAttackRegions) {
if (opponentRegion.getIncomingArmies() > 0 && stillA... | 5 |
private PacketType(Class ... classes)
{
opcode = (byte)(nextOpcode++);
packets[opcode] = this;
params = new Class[classes.length];
int length = 0;
for(int classNumber = 0; classNumber < classes.length; classNumber++)
{
Class class_ = classes[classNumber];
params[classNumber] = class_;
if(class... | 9 |
public Date getModifiedDate()
{
return _modified;
} | 0 |
boolean mineResource(){
TileType tileType = this.position.tileType;
Debug.game("Player " + username + " mining " + tileType);
boolean minedResource = this.position.mineTile();
if(minedResource){
if(tileType == TileType.RUBIDIUM)
rubidiumResources++;
if(tileType == TileType.EXPLOSIUM)
explosiumResource... | 4 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Cliente other = (Cliente) obj;
if (this.Id != other.Id) {
return false;
}
ret... | 3 |
private void restoreAfterInsert(RBNode x) {
RBNode y;
// maintain red-black tree properties after adding x
while(x != getRoot() && x.getParent().getColor() == Color.RED) {
// Parent node is .Colored red;
if(x.getParent() == x.getParent().getParent().getLeft()) // determine traversal path
... | 9 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] c = new int[n][];
for (int i = 0; i < n; i++) {
int s = sc.nextInt();
c[i] = new int[s];
for (int j = 0; j < s; j++) {
c[i][j] =... | 8 |
public static String getFileContents(String fn) {
StringBuilder contents = new StringBuilder();
File aFile = new File(fn);
try {
BufferedReader input = new BufferedReader(new FileReader(aFile));
try {
String line;
String newline = System.ge... | 2 |
@Override
public void init(boolean isServer) {
timer = 0;
tiles = new Tile[99][99];
for(int x = 0; x < tiles.length; x++)
for(int y = 0; y < tiles[x].length; y++)
tiles[x][y] = new Tile(this, x, y);
entities = new ArrayList<Entity>();
//for(int i = 0; i < 7; i++)
//entities.add(new RandomWalkEnti... | 2 |
@Override
public void update(Observable observable, Object object) {
int time = controller.getTime();
if (observable == fridge) {
if (lastUsageByControllable.containsKey(fridge))
fridgeUsageSeries.add(time, lastUsageByControllable.get(fridge));
fridgeUsageSeries.add(time, fridge.getCurrentUsage());
la... | 8 |
@Override
public void accumulate() {
for(int x = 0; x < acc[0].length; ++x) {
for(int y = 0; y < acc[0][x].length; ++y) {
if(!edges[x][y]) {
CoinCounter.logger.finest("Skipping point (" + x + ", " + y + "). Not an edge!");
continue;
}
for(int r = 0; r < acc.length; ++r) {
for(Point p : ... | 9 |
private static Type determineType(String line, Type type){
Type returnType = type;
if(line.contains("@ChattingAnnotation")){
if(line.contains("method"))
returnType = Type.METHOD;
else if(line.contains("class"))
returnType = Type.CLASS;
else if(line.contains("property"))
returnType = Type.PROPE... | 4 |
public double weightedRms() {
if (!weightsSupplied) {
System.out.println("weightedRms: no weights supplied - unweighted rms returned");
return this.rms();
} else {
boolean holdW = Stat.weightingOptionS;
if (weightingReset) {
if (weightingOptionI) {
Stat.weightingOptionS = true;
} else {
... | 6 |
public void receive(byte[] data, Connection from) {
String r = new String(data);
String rParts[] = r.split("#");
// Handle commands
if (rParts[0].equals("command")) {
if (rParts[4].equals("null")) {
GUI.txtArea.setText("");
if (!JServer.debug) {
User.addToOnlineList(rParts[2]);
... | 6 |
public static void removeAppEventListener(final AppEventListener listener) {
if (application != null) {
Object handler = null;
if (listener instanceof AppForegroundListener) {
handler = FOREGROUND_MAP.remove((AppForegroundListener) listener);
}
if (listener instanceof AppHiddenListener) {
handler ... | 9 |
public void addComponents() {
final JPanel topPanel = new JPanel();
GridLayout experimentLayout = new GridLayout(3,1);
topPanel.setLayout(experimentLayout);
// add people checheck box
JPanel peoplePanel = new JPanel();
for (int peo = 0; peo < theboard.getPeople().size(); peo++){
people = new JCheckBox(t... | 6 |
protected void computeTimeTagByteArray(OSCJavaToByteArrayConverter stream) {
if ((null == timestamp) || (timestamp == TIMESTAMP_IMMEDIATE)) {
stream.write((int) 0);
stream.write((int) 1);
return;
}
long millisecs = timestamp.getTime();
long secsSince1970 = (long) (millisecs / 1000);
long secs = secs... | 2 |
public static void main(String... args) throws InterruptedException {
GWCAConnection gwcaConnection = null;
try {
LOG.info("Executing \"Java GWCAConstants\" (version {})", Version.getVersion());
//TODO: Fill in the PID here
gwcaConnection = new NamedPipeGWCAConnecti... | 2 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if((tickID==Tickable.TICKID_MOB)&&(ticking instanceof MOB))
{
if((CMLib.dice().rollPercentage()>99)&&(((MOB)ticking).numItems()<9))
{
final Item I=CMClass.getItem("GenFoodResource");
I.se... | 9 |
public void setName(String name) {
Name = name;
} | 0 |
protected final Connection getConnection() throws DataLoadFailedException {
if (connection == null) {
throw new DataLoadFailedException("Connection has not been established to the database");
}
return connection;
} | 1 |
public void generateNewFormat(String inputFileName){
BufferedReader readbuffer = null;
String strRead = "";
try {
try {
// TODO code application logic here
readbuffer = new BufferedReader(new FileReader(inputFileName));//id
} cat... | 8 |
private static String getMD5Digest(File file) {
BufferedInputStream reader = null;
String hexDigest = new String();
try {
reader = new BufferedInputStream( new FileInputStream(file));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Messa... | 7 |
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.