method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
01223210-d806-402d-8a43-609ac096e698 | 6 | 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["... |
4c32289a-f103-4919-864f-ab01a7b15c5e | 7 | 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 (... |
e4064763-ec1a-4565-b98b-4268755b6b6f | 6 | 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) {
_... |
415f9ad7-dfa1-447c-8a13-b6a1d1351978 | 1 | 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();
... |
ca44bf82-574e-43a3-a932-a26a453290d4 | 2 | private static boolean checkName(String name){
for (User user: userList){
if (user.getName().equals(name)){
return false;
}
}
return true;
} |
a4db0732-31fd-4d0f-8acd-ea1d8b758b62 | 8 | 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... |
051539a3-5342-4670-901f-d2b23aabf678 | 3 | 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;
} |
f2cfc591-441a-4e4a-8639-c2c887d2740e | 6 | 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:
... |
9e13aab5-c6b2-41d3-a679-c8715241a0dd | 3 | public String masaAktar(String kaynakAdi){
Bilgisayar kaynakPc = masaBul(kaynakAdi);
if(kaynakPc.getAcilisSaati()!=null){
Object[] possibleValues = mutlakkafe.MutlakKafe.mainCont.getBilgisayarC().kapaliMasaIsimleriGetir();
Object AktarilacakMasa = JOptionPane.showInputD... |
b4fd4831-e96b-49c9-9311-fb3f20d6471b | 0 | @Override public void finishPopulate()
{
} |
eaaf92ae-37b0-421e-a5d5-b181fd6076bb | 1 | 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.");
}
} |
b4cc0974-f141-445e-8353-9e818de24b4a | 2 | 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);
} |
8ed2f6c1-1ccd-4b1e-b146-b6caaa315845 | 4 | public void testProvider() {
try {
assertNotNull(DateTimeZone.getProvider());
Provider provider = DateTimeZone.getProvider();
DateTimeZone.setProvider(null);
assertEquals(provider.getClass(), DateTimeZone.getProvider().getClass());
tr... |
0ee7d1b0-3dd1-4908-a3d6-eb8105c47d3e | 1 | 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... |
75b4d90a-3082-480c-bb67-f006871235a9 | 3 | public void run()
{
for(;;)
{
try
{
++x;
if(x==(wd-200))
{
c=Color.red;
repaint();
break;
}
repaint();
Thread.sleep(20);
}catch(Exception ee){}
}
} |
e1f0bf9f-3150-4706-91a4-acb4ac6cbe7f | 5 | 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 ... |
b49a781e-41d5-4967-a046-cecf8b8f9f9b | 0 | @Override
public void undo() {
node.setEditableState(oldState);
} |
9b57b9ba-e2cc-4ae3-acfe-b66864ee009c | 8 | @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... |
566d84a7-4677-443d-bb65-481cf0a96c09 | 5 | 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... |
4ddc8b21-d9d2-4473-b964-154aa736c08a | 1 | public int getLevel(ClassNode c) {
if ((c.access & ACC_INTERFACE) != 0) {
return 0;
}
return getHierarchy(c).length - 1;
} |
f7990817-efdf-436d-9b17-41026465abdd | 4 | 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");
... |
5ab11f7b-7fb6-4aff-a2a7-b1fe503d8f58 | 2 | 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... |
ef0a626f-3868-4a42-b453-06ddaa1b6201 | 4 | public FastSharder(String baseFilename, int numShards,
VertexProcessor<VertexValueType> vertexProcessor,
EdgeProcessor<EdgeValueType> edgeProcessor,
BytesToValueConverter<VertexValueType> vertexValConterter,
BytesToValueConvert... |
3c93ab9a-7343-4d3f-a44d-667a7f0c0238 | 6 | 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... |
45efb05a-d198-474c-9475-9657f1ec28c3 | 9 | 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()) {... |
74ffa41e-ed0d-4324-9796-4d47d8f6ba86 | 2 | 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;
} |
f37a85f1-a599-4f00-89cf-4502ca0646b9 | 1 | private void waitForSizeLowerThan(int expectedSize) throws InterruptedException {
synchronized (sizeUpdateLock) {
while (expectedSize < currentSize) {
sizeUpdateLock.wait();
}
}
} |
69fa1903-6618-4436-9ad2-06e7b9e28c24 | 3 | 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: "... |
d5afe2c8-e87f-428c-bf1c-c8eab7dc9496 | 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()");
}
}
} |
f4029229-2e4c-472a-8903-e98fcb7690d0 | 8 | 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;... |
4f241c36-dd5c-45ba-a10c-a706fa79f0ea | 3 | @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... |
273ae8b9-062d-4c1b-97ba-83f265e8fae2 | 2 | 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 &=... |
678cc16b-3854-4bda-9106-5d72ccac5de2 | 9 | 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... |
e56e7db5-c559-46f6-8904-5eeaac2804a5 | 0 | public static void main(String[] args) {
Goose goose = new Goose();
relocate(goose);
// Relocate a Penguin
} |
8d6f2e0d-c4ed-4019-9520-c13dc0a8fdf2 | 3 | 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 =... |
e8fd8316-c2d4-4c5e-aa00-4b47d293e3a8 | 1 | @SuppressWarnings("unchecked")
public T next() {
if (!hasNext()) return null;
Object tmp = items[pos];
succ();
return (T)tmp;
} |
042b1054-c92f-4c5d-9081-23a85df41e7e | 2 | 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());
... |
5130d96b-b10b-425f-912e-3a50e739c733 | 8 | 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);
... |
b59e120e-2558-41a6-b639-b63c79cbf6b9 | 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 ... |
4fa8afb7-96fc-40b2-9424-ab59e454b2c1 | 3 | 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... |
8f4adfbb-1ca6-48bc-a864-82ce33993967 | 9 | 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... |
17660c7b-9de7-4fa8-8400-51decf14666d | 7 | 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... |
6ad831ab-f591-4c2a-937c-768af79c5fdd | 3 | 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);
... |
8e975903-f5d4-4856-bccd-ab4c6b907b88 | 9 | 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 * ... |
bb5e54df-ce8c-4f33-8632-4dbdd15d62ab | 5 | @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()... |
114d3980-cfc2-4bab-a7aa-988c8da707b3 | 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))
... |
5f82733c-1eb1-4984-a30c-ee2f02d563ec | 1 | 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();
... |
46a0cfa2-22f0-464d-b5a4-de3362eee0a9 | 2 | public void serveMinute() {
if ( currentlyServing != null && currentlyServing.servedMinute() <= 0 ) {
currentlyServing = null;
}
} |
522ccf03-d3b7-49e2-ac73-efa7b5727d3b | 6 | 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... |
a147df7e-8606-4d76-bc58-a8852ac077d1 | 7 | 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... |
de5c5c4c-2e45-4d32-8f08-7ce43a0ee93c | 4 | public void setAdminComponentsState() {
//Включаем кнопки
buttonNew.setVisible(true);
buttonSave.setVisible(true);
buttonBreak.setVisible(true);
buttonActivate.setVisible(true);
//Делаем редактируемыми поля ввода
textFieldName.setEditable(true);
textFieldM... |
ebb3161f-1e0c-4b2f-9c94-44aae4f0c53c | 6 | 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... |
90d6bbe2-4aff-42d4-a064-b8934d391f62 | 8 | 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... |
2c6b2b91-73e3-4c4f-b015-15f6164ece0d | 6 | 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);
... |
a3d9ef5d-51fd-4fb6-aa1c-62cdc845fa25 | 1 | @Override
public double getExpectation() throws ExpectationException {
if (lambda <= 1) {
return Double.POSITIVE_INFINITY;
} else {
return lambda * k / (lambda - 1);
}
} |
e9f0e304-1e25-4a3a-a198-572e4789633b | 2 | 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();... |
58e17558-0caf-4ad5-afed-d156df8963e5 | 8 | 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... |
90416a89-48e5-41ab-8774-adb5fe3f8989 | 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 * ... |
126b74b3-52ed-45fd-81f1-882e12879c6f | 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... |
4f3ca0f6-cd04-4727-9e3d-06928c2b87be | 7 | @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 ... |
b3acc270-f632-40ac-a6d6-57264b2e9a98 | 5 | 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... |
9f00ce33-3c87-40b6-9a0b-c97499b69bfd | 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... |
9f7328d5-9e2b-4a41-97f0-831ba86de7e4 | 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++)
... |
a6080a3f-08e6-485a-99dc-76440b9a61de | 9 | 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++)
... |
1e9e4d9b-e04d-4193-8f60-049e941f30df | 1 | public HighLevelFeatureCommand(CommandParameter par) {
if(par == null)
throw new NullPointerException("HighLevelFeatureCommand has a null CommandParameter");
this.par= par;
} |
69c703a0-232a-4286-bb80-56df9abc2bcb | 4 | 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... |
e2df34e9-6316-422c-b26b-d9610a8778c4 | 7 | 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... |
5d8e56c1-dccb-4f73-9e66-e75119e4337c | 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\... |
e9e55676-19dc-4192-bdb5-3caa83c5c90b | 2 | private JoinDescriptor getJoinDescriptorForTable(String table, String shortName)
{
JoinDescriptor res = null;
for(JoinDescriptor join:joins)
{
if(join.leftMatches(table, shortName))
{
res = join;
break;
}
}
return res;
} |
bdf9bdbc-52e3-46b1-8003-95753e525406 | 9 | 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))
... |
737936e1-b95e-44b3-b30e-12972a4f3ce8 | 7 | 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... |
75da27e8-acd9-4b58-8e7c-d5281d56e11f | 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... |
c33c68c0-106a-484e-a040-f4c6dd20abf2 | 5 | 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... |
9f6ce3b6-b28b-46cc-ba85-8ce2be92e54b | 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) {
... |
0d076c4e-0cf3-48c1-8a08-f881901395d7 | 7 | protected void updateParameterValuesFromFields() {
try {
double timeStep = timeStepInputView.getValue();
runner.setSimulationTimeStep(timeStep);
} catch (NumberFormatException exception) {
}
try {
double duration = durationView.getValue();
runner.setT... |
7567b5d1-bd20-420e-9b87-424c2961c9bb | 6 | 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... |
cf6ceed3-c32f-4055-a593-489f7c803815 | 9 | 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... |
cfea21b5-6d59-4cdf-ae2b-6f4a36082c28 | 5 | 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... |
bf4f7491-679a-41e5-aa74-9ce753faa81c | 9 | 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... |
2d5b611a-158e-458a-9212-3986889ebb2d | 0 | public Date getModifiedDate()
{
return _modified;
} |
96c3caaf-9984-476c-b6ae-72799bcfa665 | 4 | 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... |
a274a99b-bf82-483e-9171-6b4b529ee5a9 | 3 | @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... |
afa239e9-613c-4f19-82c3-d99a71776708 | 9 | 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
... |
20fb6cae-4a00-4b38-b9b8-d0941bde989e | 8 | 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] =... |
dd40a723-8507-4424-bec6-ad94c07fc920 | 2 | 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... |
20dc1413-56b4-4751-919e-324806b7797f | 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... |
53bf6ed2-7f17-437a-a922-d65e3faa15e8 | 8 | @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... |
2f3b35e6-6b2e-40ab-b967-03426fb73d31 | 9 | @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 : ... |
5ca82471-f8ee-4532-a0ea-9e6d683a04d8 | 4 | 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... |
99191161-027b-4621-a562-a7f5432296a8 | 6 | 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 {
... |
4d2dd2dc-e6d3-41e8-90f0-f987516ad05f | 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]);
... |
7f1bfac5-34d6-4b09-b1c3-a3687386968a | 9 | 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 ... |
53981d58-8350-47cc-989c-eabdd553870b | 6 | 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... |
434263e7-ca7f-4578-ba71-f59a8b05db1d | 2 | 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... |
b50b6330-0c80-4213-82c6-253b54c3c338 | 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... |
5987661d-fc9d-40a7-843d-2c65a7ed3ce9 | 9 | @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... |
0fbb2338-16d3-4b53-a62e-36e0c2db5bfb | 0 | public void setName(String name) {
Name = name;
} |
6a182feb-2644-40d2-abe1-a3c3f6702421 | 1 | protected final Connection getConnection() throws DataLoadFailedException {
if (connection == null) {
throw new DataLoadFailedException("Connection has not been established to the database");
}
return connection;
} |
6db2f97f-6fb3-4971-81c2-8e8425029b39 | 8 | 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... |
cfd73a59-c046-4a5a-9fe9-b90c67a23925 | 7 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.