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[" + engine.value + "] for " + this.hashCode() + ":" + this.toString());
} else { // this Java thread has an attached engine
engine = Prolog.current_engine();
// System.out.println("JPL reusing engine[" + engine.value + "] for " + this.hashCode() + ":" + this.toString());
}
if (m.containsKey(new Long(engine.value))) {
subQuery = m.get(new Long(engine.value)); // get this engine's previous topmost query
// System.out.println("JPL reusing engine[" + engine.value + "] pushing " + subQuery.hashCode() + ":" + subQuery.toString());
} else {
subQuery = null;
}
m.put(new Long(engine.value), this); // update this engine's topmost query
//
// here, we must check for a module prefix, e.g. jpl:jpl_modifier_bit(volatile,T)
String module;
Term goal;
if (goal_.hasFunctor(":", 2)) {
if (goal_.arg(1).isAtom()) {
module = goal_.arg(1).name();
} else if (goal_.arg(1).isVariable()) {
throw new PrologException(Util.textParamsToTerm("error(instantiation_error,?)", new Term[] { goal_ }));
} else {
throw new PrologException(Util.textParamsToTerm("error(type_error(atom,?),?)", new Term[] { goal_.arg(1), goal_ }));
}
goal = goal_.arg(2);
} else {
module = contextModule;
goal = goal_;
}
predicate = Prolog.predicate(goal.name(), goal.arity(), module); // was hostModule
fid = Prolog.open_foreign_frame();
Map<String, term_t> varnames_to_vars = new HashMap<String, term_t>();
term0 = Term.putTerms(varnames_to_vars, goal.args());
// THINKS: invert varnames_to_Vars and use it when getting substitutions?
qid = Prolog.open_query(Prolog.new_module(Prolog.new_atom(contextModule)), Prolog.Q_CATCH_EXCEPTION, predicate, term0);
open = true;
}
|
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 (!board.cell[r][c].equals(CellEntry.inValid));
CellEntry entry = board.cell[r][c];
if (entry == CellEntry.white) {
value += POINT_NORMAL;
} else if (entry == CellEntry.whiteKing) {
value += POINT_KING;
} else if (entry == CellEntry.black) {
value -= POINT_NORMAL;
} else if (entry == CellEntry.blackKing) {
value -= POINT_KING;
}
}
}
return value;
}
|
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) {
_parent.setVisible(false);
if( !Settings.INSTALLER_POPUP_SHOWN ) {
displayTrayMessage(Settings.SERVER_NAME, Settings.SERVER_NAME + " is still running!\nDouble click on this icon to restore", TrayIcon.MessageType.INFO);
Settings.INSTALLER_POPUP_SHOWN = true;
}
} else if( e.getNewState() == JFrame.MAXIMIZED_BOTH || e.getNewState() == JFrame.NORMAL ) {
_parent.setVisible(true);
}
}
});
}
|
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 == null) {
walkGenerator = new WalkGenerator(dimension);
}
else {
if (!dimension.equals(walkGenerator.getDimension())) {
walkGenerator.setDimension(dimension);
}
}
int k = 0;
do {
walk = walkGenerator.generate((short) n);
if (k == 100)
break;
k++;
} while (walk == null);
if (walk == null)
return null;
short[] x = new short[n + 2];
short[] y = new short[n + 2];
x[0] = walk.getOriginX();
y[0] = walk.getOriginY();
x[1] = walk.getFirstNodeX();
y[1] = walk.getFirstNodeY();
System.arraycopy(walk.getXArray(), 0, x, 2, n);
System.arraycopy(walk.getYArray(), 0, y, 2, n);
n++;
int m = 50;
Point[] p = new Point[n * m];
CubicPolynomial[] cx = NaturalCubicSpline.compute(n, x);
CubicPolynomial[] cy = NaturalCubicSpline.compute(n, y);
float u = 0.0f;
k = 0;
for (short i = 0; i < n; i++) {
for (short j = 0; j < m; j++) {
u = (float) j / (float) m;
p[k] = new Point((int) (cx[i].getValue(u) * footStep), (int) (cy[i].getValue(u) * footStep));
k++;
}
}
return p;
}
|
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:
return Level.OFF;
}
}
}
|
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.showInputDialog(null,"Aktarılacak Masayı Seçiniz",
"Masa Seç",JOptionPane.QUESTION_MESSAGE,null,possibleValues, possibleValues[0]);
if(AktarilacakMasa!=null){
Bilgisayar hedefPc = masaBul(AktarilacakMasa.toString());
if(hedefPc.getAcilisSaati()==null){
kaynakPc.masaAktar(hedefPc);
kaynakPc.masaKapat();
return AktarilacakMasa.toString();
}else{
JOptionPane.showMessageDialog(null, "Hedef Masa Dolu", "HATA", JOptionPane.ERROR_MESSAGE);
return "";
}
}
}else{
JOptionPane.showMessageDialog(null, "Masa Zaten Kapalı", "HATA", JOptionPane.ERROR_MESSAGE);
}
return "";
}
|
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());
try {
DateTimeZone.setProvider(new MockNullIDSProvider());
fail();
} catch (IllegalArgumentException ex) {}
try {
DateTimeZone.setProvider(new MockEmptyIDSProvider());
fail();
} catch (IllegalArgumentException ex) {}
try {
DateTimeZone.setProvider(new MockNoUTCProvider());
fail();
} catch (IllegalArgumentException ex) {}
try {
DateTimeZone.setProvider(new MockBadUTCProvider());
fail();
} catch (IllegalArgumentException ex) {}
Provider prov = new MockOKProvider();
DateTimeZone.setProvider(prov);
assertSame(prov, DateTimeZone.getProvider());
assertEquals(2, DateTimeZone.getAvailableIDs().size());
assertTrue(DateTimeZone.getAvailableIDs().contains("UTC"));
assertTrue(DateTimeZone.getAvailableIDs().contains("Europe/London"));
} finally {
DateTimeZone.setProvider(null);
assertEquals(ZoneInfoProvider.class, DateTimeZone.getProvider().getClass());
}
try {
System.setProperty("org.joda.time.DateTimeZone.Provider", "org.joda.time.tz.UTCProvider");
DateTimeZone.setProvider(null);
assertEquals(UTCProvider.class, DateTimeZone.getProvider().getClass());
} finally {
System.getProperties().remove("org.joda.time.DateTimeZone.Provider");
DateTimeZone.setProvider(null);
assertEquals(ZoneInfoProvider.class, DateTimeZone.getProvider().getClass());
}
PrintStream syserr = System.err;
try {
System.setProperty("org.joda.time.DateTimeZone.Provider", "xxx");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
System.setErr(new PrintStream(baos));
DateTimeZone.setProvider(null);
assertEquals(ZoneInfoProvider.class, DateTimeZone.getProvider().getClass());
String str = new String(baos.toByteArray());
assertTrue(str.indexOf("java.lang.ClassNotFoundException") >= 0);
} finally {
System.setErr(syserr);
System.getProperties().remove("org.joda.time.DateTimeZone.Provider");
DateTimeZone.setProvider(null);
assertEquals(ZoneInfoProvider.class, DateTimeZone.getProvider().getClass());
}
}
|
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));
assertEquals(true, test1a.isEqual(test1a));
YearMonthDay test2 = new YearMonthDay(2005, 7, 2);
assertEquals(false, test1.isEqual(test2));
assertEquals(false, test2.isEqual(test1));
YearMonthDay test3 = new YearMonthDay(2005, 7, 2, GregorianChronology.getInstanceUTC());
assertEquals(false, test1.isEqual(test3));
assertEquals(false, test3.isEqual(test1));
assertEquals(true, test3.isEqual(test2));
try {
new YearMonthDay(2005, 7, 2).isEqual(null);
fail();
} catch (IllegalArgumentException ex) {}
}
|
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 = now;
boolean shouldRender = true;
while (delta >= 1) {
ticks++;
tick();
delta -= 1;
shouldRender = true;
}
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (shouldRender) {
frames++;
render();
}
if (System.currentTimeMillis() - lastTimer >= 1000) {
lastTimer += 1000;
frame.setTitle(ticks + " ticks, " + frames + " frames");
frames = 0;
ticks = 0;
}
}
}
|
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-HAS-HAVE> protection from paralyzation."));
return false;
}
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),auto?L("<T-NAME> attain(s) a free mind and body."):L("^S<S-NAME> @x1 for a free mind and body.^?",prayWord(mob)));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
beneficialAffect(mob,target,asLevel,0);
}
}
else
return beneficialWordsFizzle(mob,target,L("<S-NAME> @x1 for a free body and mind, but nothing happens.",prayWord(mob)));
// return whether it worked
return success;
}
|
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;
answer[0] = m_posX - 1;
answer[1] = m_posY;
m_posX -= 1;
}else{
if(m_posX == 0 && m_rightMove == false){
m_rightMove = true;
}
temp[0] = rng.nextInt(BOARD_SIZE-1);
temp[1] = rng.nextInt(BOARD_SIZE-1);
m_posX = temp[0];
m_posY = temp[1];
answer[0] = m_posX;
answer[1] = m_posY;
}
return answer;
}
|
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");
if (!entries.contains(s))
entries.add(s);
}
} catch (SQLException ex) {
Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
}
for (String e : entries)
{
System.out.println(e);
this.executeSQLQuery("DELETE FROM entity_caracteristic WHERE idE="+e);
this.executeSQLQuery("DELETE FROM entity WHERE idEntity="+e);
}
}
|
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, result);
}
}
return new ParseResult(results);
}
|
ef0a626f-3868-4a42-b453-06ddaa1b6201
| 4
|
public FastSharder(String baseFilename, int numShards,
VertexProcessor<VertexValueType> vertexProcessor,
EdgeProcessor<EdgeValueType> edgeProcessor,
BytesToValueConverter<VertexValueType> vertexValConterter,
BytesToValueConverter<EdgeValueType> edgeValConverter) throws IOException {
this.baseFilename = baseFilename;
this.numShards = numShards;
this.initialIntervalLength = Integer.MAX_VALUE / numShards;
this.preIdTranslate = new VertexIdTranslate(this.initialIntervalLength, numShards);
this.edgeProcessor = edgeProcessor;
this.vertexProcessor = vertexProcessor;
this.edgeValueTypeBytesToValueConverter = edgeValConverter;
this.vertexValueTypeBytesToValueConverter = vertexValConterter;
/**
* In the first phase of processing, the edges are "shoveled" to
* the corresponding shards. The interim shards are called "shovel-files",
* and the final shards are created by sorting the edges in the shovel-files.
* See processShovel()
*/
shovelStreams = new DataOutputStream[numShards];
vertexShovelStreams = new DataOutputStream[numShards];
for(int i=0; i < numShards; i++) {
shovelStreams[i] = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(shovelFilename(i))));
if (vertexProcessor != null) {
vertexShovelStreams[i] = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(vertexShovelFileName(i))));
}
}
/** Byte-array template used as a temporary value for performance (instead of
* always reallocating it).
**/
if (edgeValueTypeBytesToValueConverter != null) {
valueTemplate = new byte[edgeValueTypeBytesToValueConverter.sizeOf()];
} else {
valueTemplate = new byte[0];
}
if (vertexValueTypeBytesToValueConverter != null)
vertexValueTemplate = new byte[vertexValueTypeBytesToValueConverter.sizeOf()];
}
|
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 (Stella.currentStartupTimePhaseP(2)) {
Stella.SYM_STELLA_STARTUP_TAXONOMIES = ((Symbol)(GeneralizedSymbol.internRigidSymbolWrtModule("STARTUP-TAXONOMIES", null, 0)));
}
if (Stella.currentStartupTimePhaseP(4)) {
Stella.$TAXONOMY_POSTORDER_NUMBER$.setDefaultValue(new Integer(Stella.NULL_INTEGER));
}
if (Stella.currentStartupTimePhaseP(6)) {
Stella.finalizeClasses();
}
if (Stella.currentStartupTimePhaseP(7)) {
Stella.defineFunctionObject("TAXONOMY-ROOT?", "(DEFUN (TAXONOMY-ROOT? BOOLEAN) ((NODE TAXONOMY-NODE)) :DOCUMENTATION \"Return `true' if `node' is a taxonomy root node.\" :GLOBALLY-INLINE? TRUE (RETURN (EMPTY? (PARENTS NODE))))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "taxonomyRootP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("ADD-TAXONOMY-ROOT", "(DEFUN ADD-TAXONOMY-ROOT ((GRAPH TAXONOMY-GRAPH) (ROOT TAXONOMY-NODE)) :DOCUMENTATION \"Add `root' as a root node to `graph'. Only do this if\n`root' does not have any parents and is not a `graph' root already.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "addTaxonomyRoot", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("REMOVE-TAXONOMY-ROOT", "(DEFUN REMOVE-TAXONOMY-ROOT ((GRAPH TAXONOMY-GRAPH) (ROOT TAXONOMY-NODE)) :DOCUMENTATION \"Remove `root' from `graph's root nodes.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "removeTaxonomyRoot", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("UPDATE-TAXONOMY-ROOTS", "(DEFUN UPDATE-TAXONOMY-ROOTS ((GRAPH TAXONOMY-GRAPH) (NODE TAXONOMY-NODE)) :DOCUMENTATION \"Update `graph's roots according to `node's current state.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "updateTaxonomyRoots", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("CREATE-TAXONOMY-NODE", "(DEFUN (CREATE-TAXONOMY-NODE TAXONOMY-NODE) ((GRAPH TAXONOMY-GRAPH) (NODE TAXONOMY-NODE) (NATIVEOBJECT OBJECT) (ROOT? BOOLEAN)) :DOCUMENTATION \"Link the taxonomy node `node' to `nativeObject' and add it\nto `graph'. If it is `null', a new node will be created. Mark it as a root\nnode if `root?' is `true'. Return the node.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "createTaxonomyNode", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.Stella_Object"), java.lang.Boolean.TYPE}), null);
Stella.defineFunctionObject("ADD-TAXONOMY-NODE", "(DEFUN ADD-TAXONOMY-NODE ((GRAPH TAXONOMY-GRAPH) (NODE TAXONOMY-NODE) (ROOT? BOOLEAN)) :DOCUMENTATION \"Add `node' to `graph'. Mark it as a root node if `root?'\nis `true'. Even though this is part of the API, it should rarely be needed,\nsince `create-taxonomy-node' does everything that's necessary.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "addTaxonomyNode", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode"), java.lang.Boolean.TYPE}), null);
Stella.defineFunctionObject("REMOVE-TAXONOMY-NODE", "(DEFUN REMOVE-TAXONOMY-NODE ((GRAPH TAXONOMY-GRAPH) (NODE TAXONOMY-NODE)) :PUBLIC? TRUE :DOCUMENTATION \"Remove `node' from `graph' and disconnect incident links.\")", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "removeTaxonomyNode", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("CREATE-TAXONOMY-LINK", "(DEFUN CREATE-TAXONOMY-LINK ((GRAPH TAXONOMY-GRAPH) (PARENT TAXONOMY-NODE) (CHILD TAXONOMY-NODE)) :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "createTaxonomyLink", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("LINK-TAXONOMY-NODES", "(DEFUN LINK-TAXONOMY-NODES ((GRAPH TAXONOMY-GRAPH) (PARENT TAXONOMY-NODE) (CHILD TAXONOMY-NODE)) :DOCUMENTATION \"Cross-link `parent' and `child' in `graph'.\nIMPORTANT: This will automatically insert a backlink from `child' to\n`parent', so, for maximum efficiency it should not be called a second time\nwith the arguments reversed.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "linkTaxonomyNodes", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("INCREMENTALLY-LINK-TAXONOMY-NODES", "(DEFUN INCREMENTALLY-LINK-TAXONOMY-NODES ((GRAPH TAXONOMY-GRAPH) (PARENT TAXONOMY-NODE) (CHILD TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "incrementallyLinkTaxonomyNodes", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("CREATE-NEXT-POSTORDER-INTERVAL", "(DEFUN (CREATE-NEXT-POSTORDER-INTERVAL INTERVAL) ((GRAPH TAXONOMY-GRAPH)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "createNextPostorderInterval", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineFunctionObject("ALLOCATE-INTERVAL-FOR-NEW-LEAF-NODE", "(DEFUN (ALLOCATE-INTERVAL-FOR-NEW-LEAF-NODE INTERVAL) ((PARENT TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "allocateIntervalForNewLeafNode", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("UNLINK-TAXONOMY-NODES", "(DEFUN UNLINK-TAXONOMY-NODES ((GRAPH TAXONOMY-GRAPH) (PARENT TAXONOMY-NODE) (CHILD TAXONOMY-NODE)) :DOCUMENTATION \"Remove link between `parent' and `child'.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "unlinkTaxonomyNodes", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("INCREMENTALLY-UNLINK-TAXONOMY-NODES", "(DEFUN INCREMENTALLY-UNLINK-TAXONOMY-NODES ((GRAPH TAXONOMY-GRAPH) (PARENT TAXONOMY-NODE) (CHILD TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "incrementallyUnlinkTaxonomyNodes", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("ALL-TAXONOMY-NODES", "(DEFUN (ALL-TAXONOMY-NODES (ITERATOR OF TAXONOMY-NODE)) ((GRAPH TAXONOMY-GRAPH)) :DOCUMENTATION \"Given a taxonomy `graph' that has been finalized,\nreturn an iterator that generates all the graph's nodes.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "allTaxonomyNodes", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineFunctionObject("ALL-TAXONOMY-NODES-NEXT?", "(DEFUN (ALL-TAXONOMY-NODES-NEXT? BOOLEAN) ((SELF (ALL-PURPOSE-ITERATOR OF TAXONOMY-NODE))))", Native.find_java_method("edu.isi.stella.AllPurposeIterator", "allTaxonomyNodesNextP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.AllPurposeIterator")}), null);
Stella.defineFunctionObject("FIND-TAXONOMY-NODE", "(DEFUN (FIND-TAXONOMY-NODE TAXONOMY-NODE) ((GRAPH TAXONOMY-GRAPH) (LABEL INTEGER)) :DOCUMENTATION \"Return some node in `graph' with label `label'.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "findTaxonomyNode", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), java.lang.Integer.TYPE}), null);
Stella.defineFunctionObject("LABELED-TAXONOMY-NODE?", "(DEFUN (LABELED-TAXONOMY-NODE? BOOLEAN) ((NODE TAXONOMY-NODE)) :GLOBALLY-INLINE? TRUE (RETURN (DEFINED? (LABEL NODE))))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "labeledTaxonomyNodeP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineMethodObject("(DEFMETHOD (DELETED? BOOLEAN) ((SELF TAXONOMY-NODE)) :GLOBALLY-INLINE? TRUE (RETURN (EQL? (LABEL SELF) DELETED-LABEL)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "deletedP", new java.lang.Class [] {}), ((java.lang.reflect.Method)(null)));
Stella.defineMethodObject("(DEFMETHOD (DELETED?-SETTER BOOLEAN) ((SELF TAXONOMY-NODE) (VALUE BOOLEAN)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "deletedPSetter", new java.lang.Class [] {java.lang.Boolean.TYPE}), ((java.lang.reflect.Method)(null)));
Stella.defineFunctionObject("CLEAR-TAXONOMY-NODE", "(DEFUN CLEAR-TAXONOMY-NODE ((NODE TAXONOMY-NODE)) :DOCUMENTATION \"Clear all taxonomy-graph-specific information of `node',\nbut retain information about the native object and associated links.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyNode", "clearTaxonomyNode", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("INITIALIZE-TAXONOMY-NODE", "(DEFUN INITIALIZE-TAXONOMY-NODE ((NODE TAXONOMY-NODE)) :DOCUMENTATION \"Completely clear and initialize `node'.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyNode", "initializeTaxonomyNode", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("HELP-CLEAR-TAXONOMY-GRAPH", "(DEFUN HELP-CLEAR-TAXONOMY-GRAPH ((NODE TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "helpClearTaxonomyGraph", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("CLEAR-TAXONOMY-GRAPH", "(DEFUN CLEAR-TAXONOMY-GRAPH ((GRAPH TAXONOMY-GRAPH)) :DOCUMENTATION \"Clear all taxonomy-graph-specific information of `graph',\nbut retain information about the native network and associated links.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "clearTaxonomyGraph", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineFunctionObject("INITIALIZE-TAXONOMY-GRAPH", "(DEFUN INITIALIZE-TAXONOMY-GRAPH ((GRAPH TAXONOMY-GRAPH)) :DOCUMENTATION \"Completely clear the taxonomy graph `graph'.\nNOTE: Any nodes associated with `graph' will not be cleared. If they are\nto be reused, they have to be cleared with `initialize-taxonomy-node'.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "initializeTaxonomyGraph", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineFunctionObject("HELP-CREATE-TAXONOMY-TREE-INTERVALS", "(DEFUN (HELP-CREATE-TAXONOMY-TREE-INTERVALS INTEGER) ((SELF TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "helpCreateTaxonomyTreeIntervals", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("CREATE-TAXONOMY-TREE-INTERVALS", "(DEFUN CREATE-TAXONOMY-TREE-INTERVALS ((GRAPH TAXONOMY-GRAPH)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "createTaxonomyTreeIntervals", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineMethodObject("(DEFMETHOD (MEMBER? BOOLEAN) ((INTERVAL INTERVAL) (N INTEGER)) :GLOBALLY-INLINE? TRUE (RETURN (AND (>= N (LOWER-BOUND INTERVAL)) (<= N (UPPER-BOUND INTERVAL)))))", Native.find_java_method("edu.isi.stella.Interval", "memberP", new java.lang.Class [] {java.lang.Integer.TYPE}), ((java.lang.reflect.Method)(null)));
Stella.defineFunctionObject("SUBINTERVAL-OF?", "(DEFUN (SUBINTERVAL-OF? BOOLEAN) ((SUBINTERVAL INTERVAL) (SUPERINTERVAL INTERVAL)) :GLOBALLY-INLINE? TRUE (RETURN (AND (<= (UPPER-BOUND SUBINTERVAL) (UPPER-BOUND SUPERINTERVAL)) (>= (LOWER-BOUND SUBINTERVAL) (LOWER-BOUND SUPERINTERVAL)))))", Native.find_java_method("edu.isi.stella.Interval", "subintervalOfP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.Interval"), Native.find_java_class("edu.isi.stella.Interval")}), null);
Stella.defineFunctionObject("MERGE-INTERVALS", "(DEFUN (MERGE-INTERVALS INTERVAL) ((LEFTINTERVAL INTERVAL) (RIGHTINTERVAL INTERVAL)) :GLOBALLY-INLINE? TRUE (RETURN (NEW INTERVAL :LOWER-BOUND (LOWER-BOUND LEFTINTERVAL) :UPPER-BOUND (UPPER-BOUND RIGHTINTERVAL))))", Native.find_java_method("edu.isi.stella.Interval", "mergeIntervals", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.Interval"), Native.find_java_class("edu.isi.stella.Interval")}), null);
Stella.defineFunctionObject("ALL-TAXONOMY-NODE-INTERVALS", "(DEFUN (ALL-TAXONOMY-NODE-INTERVALS (CONS OF INTERVAL)) ((NODE TAXONOMY-NODE)) :GLOBALLY-INLINE? TRUE (RETURN (INTERVALS NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "allTaxonomyNodeIntervals", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("INTERN-TAXONOMY-NODE-INTERVAL", "(DEFUN (INTERN-TAXONOMY-NODE-INTERVAL INTERVAL) ((NODE TAXONOMY-NODE) (LOWERBOUND INTEGER) (UPPERBOUND INTEGER)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "internTaxonomyNodeInterval", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), java.lang.Integer.TYPE, java.lang.Integer.TYPE}), null);
Stella.defineFunctionObject("ADD-TAXONOMY-NODE-INTERVAL", "(DEFUN ADD-TAXONOMY-NODE-INTERVAL ((NODE TAXONOMY-NODE) (INTERVAL INTERVAL)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "addTaxonomyNodeInterval", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.Interval")}), null);
Stella.defineFunctionObject("REMOVE-TAXONOMY-NODE-INTERVAL", "(DEFUN REMOVE-TAXONOMY-NODE-INTERVAL ((NODE TAXONOMY-NODE) (INTERVAL INTERVAL)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "removeTaxonomyNodeInterval", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.Interval")}), null);
Stella.defineFunctionObject("ADJOIN-TAXONOMY-NODE-INTERVAL?", "(DEFUN (ADJOIN-TAXONOMY-NODE-INTERVAL? BOOLEAN) ((NODE TAXONOMY-NODE) (INTERVAL INTERVAL)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "adjoinTaxonomyNodeIntervalP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.Interval")}), null);
Stella.defineFunctionObject("PROPAGATE-FOREIGN-INTERVAL", "(DEFUN PROPAGATE-FOREIGN-INTERVAL ((NODE TAXONOMY-NODE) (INTERVAL INTERVAL)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "propagateForeignInterval", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.Interval")}), null);
Stella.defineFunctionObject("UNCOMPUTE-TOTAL-ANCESTORS", "(DEFUN UNCOMPUTE-TOTAL-ANCESTORS ((NODE TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "uncomputeTotalAncestors", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("HELP-COMPUTE-TOTAL-ANCESTORS", "(DEFUN HELP-COMPUTE-TOTAL-ANCESTORS ((NODE TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "helpComputeTotalAncestors", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("COMPUTE-TOTAL-ANCESTORS", "(DEFUN COMPUTE-TOTAL-ANCESTORS ((NODE TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "computeTotalAncestors", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("CREATE-TAXONOMY-SPANNING-TREE", "(DEFUN CREATE-TAXONOMY-SPANNING-TREE ((GRAPH TAXONOMY-GRAPH) (NODE TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "createTaxonomySpanningTree", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("CREATE-TAXONOMY-SPANNING-FOREST", "(DEFUN CREATE-TAXONOMY-SPANNING-FOREST ((GRAPH TAXONOMY-GRAPH)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "createTaxonomySpanningForest", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineFunctionObject("FINALIZE-TAXONOMY-GRAPH", "(DEFUN FINALIZE-TAXONOMY-GRAPH ((GRAPH TAXONOMY-GRAPH)) :DOCUMENTATION \"Finalize the taxonomy graph `graph'.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "finalizeTaxonomyGraph", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineFunctionObject("FINALIZE-TAXONOMY-GRAPH-NONINCREMENTALLY", "(DEFUN FINALIZE-TAXONOMY-GRAPH-NONINCREMENTALLY ((GRAPH TAXONOMY-GRAPH)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "finalizeTaxonomyGraphNonincrementally", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph")}), null);
Stella.defineFunctionObject("TAXONOMY-SUBNODE-OF?", "(DEFUN (TAXONOMY-SUBNODE-OF? BOOLEAN) ((SUB-NODE TAXONOMY-NODE) (SUPER-NODE TAXONOMY-NODE)) :DOCUMENTATION \"Return TRUE if `sub-node' is a descendant of `super-node'.\" :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella.TaxonomyNode", "taxonomySubnodeOfP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("SLOW-TAXONOMY-SUBNODE-OF?", "(DEFUN (SLOW-TAXONOMY-SUBNODE-OF? BOOLEAN) ((SUBNODE TAXONOMY-NODE) (SUPERNODE TAXONOMY-NODE)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "slowTaxonomySubnodeOfP", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), Native.find_java_class("edu.isi.stella.TaxonomyNode")}), null);
Stella.defineFunctionObject("PRINT-TAXONOMY-TREE", "(DEFUN PRINT-TAXONOMY-TREE ((NODE TAXONOMY-NODE) (INDENT INTEGER) (STREAM OUTPUT-STREAM)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "printTaxonomyTree", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), java.lang.Integer.TYPE, Native.find_java_class("edu.isi.stella.OutputStream")}), null);
Stella.defineFunctionObject("PRINT-TAXONOMY-GRAPH", "(DEFUN PRINT-TAXONOMY-GRAPH ((GRAPH TAXONOMY-GRAPH) (STREAM OUTPUT-STREAM)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "printTaxonomyGraph", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.OutputStream")}), null);
Stella.defineFunctionObject("PRINT-TAXONOMY-SPANNING-TREE", "(DEFUN PRINT-TAXONOMY-SPANNING-TREE ((NODE TAXONOMY-NODE) (INDENT INTEGER) (STREAM OUTPUT-STREAM)))", Native.find_java_method("edu.isi.stella.TaxonomyNode", "printTaxonomySpanningTree", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyNode"), java.lang.Integer.TYPE, Native.find_java_class("edu.isi.stella.OutputStream")}), null);
Stella.defineFunctionObject("PRINT-TAXONOMY-SPANNING-FOREST", "(DEFUN PRINT-TAXONOMY-SPANNING-FOREST ((GRAPH TAXONOMY-GRAPH) (STREAM OUTPUT-STREAM)))", Native.find_java_method("edu.isi.stella.TaxonomyGraph", "printTaxonomySpanningForest", new java.lang.Class [] {Native.find_java_class("edu.isi.stella.TaxonomyGraph"), Native.find_java_class("edu.isi.stella.OutputStream")}), null);
Stella.defineFunctionObject("STARTUP-TAXONOMIES", "(DEFUN STARTUP-TAXONOMIES () :PUBLIC? TRUE)", Native.find_java_method("edu.isi.stella._StartupTaxonomies", "startupTaxonomies", new java.lang.Class [] {}), null);
{ MethodSlot function = Symbol.lookupFunction(Stella.SYM_STELLA_STARTUP_TAXONOMIES);
KeyValueList.setDynamicSlotValue(function.dynamicSlots, Stella.SYM_STELLA_METHOD_STARTUP_CLASSNAME, StringWrapper.wrapString("_StartupTaxonomies"), Stella.NULL_STRING_WRAPPER);
}
}
if (Stella.currentStartupTimePhaseP(8)) {
Stella.finalizeSlots();
Stella.cleanupUnfinalizedClasses();
}
if (Stella.currentStartupTimePhaseP(9)) {
Stella_Object.inModule(((StringWrapper)(Stella_Object.copyConsTree(StringWrapper.wrapString("/STELLA")))));
Stella.defineStellaGlobalVariableFromStringifiedSource("(DEFGLOBAL *NUMBERING-INTERVAL* INTEGER 100 :PUBLIC? TRUE :DOCUMENTATION \"Spacing between postorder numbers for nodes. Allows limited\nincremental insertions without having to renumber the whole graph.\")");
Stella.defineStellaGlobalVariableFromStringifiedSource("(DEFCONSTANT MARKER-LABEL INTEGER -99 :DOCUMENTATION \"Dummy label used for marking a node\")");
Stella.defineStellaGlobalVariableFromStringifiedSource("(DEFCONSTANT DELETED-LABEL INTEGER -99 :DOCUMENTATION \"Label used for marking deleted nodes\")");
Stella.defineStellaGlobalVariableFromStringifiedSource("(DEFSPECIAL *TAXONOMY-POSTORDER-NUMBER* INTEGER NULL)");
}
} finally {
Stella.$CONTEXT$.set(old$Context$000);
Stella.$MODULE$.set(old$Module$000);
}
}
}
|
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()) {
msg = "Reader's name is empty";
}
if(reader.getAddress() == null) {
msg = "Reader's adress is null";
}
if(reader.getAddress().isEmpty()) {
msg = "Reader's adress is empty";
}
if(reader.getPhoneNumber() != null){
if(reader.getPhoneNumber() <= 0){
msg = "Reader's phone number is neative!";
}
if(reader.getPhoneNumber().toString().length() != 9){
msg = "Reader's phone number hasn't got 9 digits!";
}
}
if(msg != null){
log.info(msg);
throw new IllegalArgumentException(msg);
}
}
|
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: "+ i);
return true;
}
nodes = calcNumberOfNodes(serialProb , pow2Prob,
uLow, uMed, uHi, uProb);
runTime = timetoRun(art, brt);
double len = runTime * rating; // calculate a job length for each PE
Gridlet gl = new Gridlet(i+1, len, size, size);
gl.setNumPE(nodes); // set the requested num of proc
// check the submit time
if (arrTime < 0) {
arrTime = 0;
}
WorkloadJob job = new WorkloadJob(gl, arrTime);
jobs.add(job);
}
System.out.println("WorkloadDAS2: number of generated jobs: "+ numJobs);
return true;
}
|
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;
}
}
for (File f : dirs) {
for (String ext : PROJECT_SETS) {
if (ext.endsWith("/") && (f.getAbsolutePath().replaceAll("\\\\", "/") + "/").endsWith(ext))
return true;
}
}
return false;
}
|
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.GetTransformedData().GetRotation() + m_rotation;
if (Math.abs(rotation - m_cacheNetRotation) > PhysicsModel.EPSILON)
{
m_cacheNetRotation = rotation;
m_cacheCos = Math.cos(m_cacheNetRotation);
m_cacheSin = Math.sin(m_cacheNetRotation);
}
double mult = m_powerOrdered * m_maxPower;//calculate the force applied by the motor per millisecond
if (m_powerCountdown >= timeDelta)
{
//apply force for the time since last update
m_robot.GetPhysicsObject().ApplyForce(m_cacheCos * mult * timeDelta, m_cacheSin * mult * timeDelta);
m_powerCountdown -= timeDelta;
}
else
{
//apply force for the last few milliseconds the motor was to stay on for
m_robot.GetPhysicsObject().ApplyForce(m_cacheCos * mult * m_powerCountdown, m_cacheSin * mult * m_powerCountdown);
m_powerCountdown = 0.0;
}
}
}
|
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 &= ~Modifiers.STATIC;
}
fieldInfo.setModifiers(modifiers);
this.setDirty(true);
}
|
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.next();
origin = rBond.getAtom1();
destin = rBond.getAtom2();
if ((a1 == origin && a2 == destin) || (a2 == origin && a1 == destin))
return false;
}
}
}
double xij = a2.getRx() - a1.getRx();
double yij = a2.getRy() - a1.getRy();
bonds.add(new RadialBond.Builder(a1, a2).bondLength(Math.hypot(xij, yij)).build());
MoleculeCollection.sort(model);
model.notifyChange();
repaint();
return true;
}
|
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 = args[1];
chatty.test(instances, hostname);
} else {
// chatty.test(1, null);
chatty.run();
}
}
|
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());
ResultSet resultSet = db.query(sql);
try {
while(resultSet.next()){
CardAccount card_account = new CardAccount(resultSet.getInt("account_num"));
card_accounts.add(card_account);
}
db.close();
}catch(Exception e) {
System.err.println( e.getClass().getName() + ": " + e.getMessage() );
System.exit(0);
}
return card_accounts;
}
|
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);
// WTB: lambda!
for(int i = -1; -1 <= i && i <= 1; i++) {
solidBlock.setX(x + i);
snowBlock.setX(x + i);
if (solidBlock.getBlock().getType().isSolid()
&& replaceableMaterials.contains(snowBlock.getBlock().getType())) {
snowBlock.getBlock().setType(Material.SNOW);
}
}
solidBlock.setX(x);
snowBlock.setX(x);
for(int i = -1; -1 <= i && i <= 1; i++) {
solidBlock.setZ(z + i);
snowBlock.setZ(z + i);
if (solidBlock.getBlock().getType().isSolid()
&& replaceableMaterials.contains(snowBlock.getBlock().getType())) {
snowBlock.getBlock().setType(Material.SNOW);
}
}
}
|
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 the name of the newspaper
ContentHandler contentHandler = null;
if (BasicCrawlController.paper==paperE.LankadeepaArchives) {
contentHandler = new HtmlContentHandlerLankaDeepa();
}
else if(BasicCrawlController.paper==paperE.DivainaArchives) {
contentHandler = new HtmlContentHandlerDivaina();
}
else if(BasicCrawlController.paper==paperE.DinaminaArchives) {
contentHandler = new HtmlContentHandlerDinamina();
}
InputStream inputStream = null;
try {
inputStream = new ByteArrayInputStream(page.getContentData());
htmlParser.parse(inputStream, contentHandler, metadata, parseContext);
} catch (Exception e) {
logger.error(e.getMessage() + ", while parsing: " + page.getWebURL());
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
logger.error(e.getMessage() + ", while parsing: " + page.getWebURL());
}
}
if (page.getContentCharset() == null) {
page.setContentCharset(metadata.get("Content-Encoding"));
}
String baseURL = contentHandler.getBaseUrl();
if (baseURL != null) {
contextURL = baseURL;
}
int urlCount = 0;
return true;
}
|
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
// password) value (Revision 2)
// Step 1 is provided to us as the parameter generalKey:
// Create an encryption key based on the user password string, as
// described in Algorithm 3.2
// Step 2: Encrypt the 32-byte padding string shown in step 1 of
// Algorithm 3.2, using an RC4 encryption function with the
// encryption key from the preceding step.
Cipher rc4 = createRC4Cipher();
SecretKey key = createRC4Key(generalKey);
initEncryption(rc4, key);
return crypt(rc4, PW_PADDING);
} else if (revision >= 3) {
// Algorithm 3.5: Computing the encryption dictionaryâs U (user
// password) value (Revision 3 or greater)
// Step 1 is provided to us as the parameter generalKey:
// Create an encryption key based on the user password string, as
// described in Algorithm 3.2
// Step 2: Initialize the MD5 hash function and pass the 32-byte
// padding string shown in step 1 of Algorithm 3.2 as input to this
// function
MessageDigest md5 = createMD5Digest();
md5.update(PW_PADDING);
// Step 3: Pass the first element of the fileâs file identifier
// array (the value of the ID entry in the documentâs trailer
// dictionary; see Table 3.13 on page 97) to the hash function and
// finish the hash. (See implementation note 26 in Appendix H.)
if (firstDocIdValue != null) {
md5.update(firstDocIdValue);
}
final byte[] hash = md5.digest();
// Step 4: Encrypt the 16-byte result of the hash, using an RC4
// encryption function with the encryption key from step 1.
Cipher rc4 = createRC4Cipher();
SecretKey key = createRC4Key(generalKey);
initEncryption(rc4, key);
final byte[] v = crypt(rc4, hash);
// Step 5: Do the following 19 times: Take the output from the
// previous invocation of the RC4 function and pass it as input to
// a new invocation of the function; use an encryption key generated
// by taking each byte of the original encryption key (obtained in
// step 1) and performing an XOR (exclusive or) operation between
// that byte and the single-byte value of the iteration counter
// (from 1 to 19).
rc4shuffle(v, generalKey, rc4);
// Step 6: Append 16 bytes of arbitrary padding to the output from
// the final invocation of the RC4 function and store the 32-byte
// result as the value of the U entry in the encryption dictionary.
assert v.length == 16;
final byte[] entryValue = new byte[32];
System.arraycopy(v, 0, entryValue, 0, v.length);
System.arraycopy(v, 0, entryValue, 16, v.length);
return entryValue;
} else {
throw new EncryptionUnsupportedByProductException(
"Unsupported standard security handler revision " +
revision);
}
}
|
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().getName());
} else {
jsonObject.put("ID", result.getKey().getId());
}
}
for (Entry<String, Object> entry : result.getProperties()
.entrySet()) {
if (returnField == null
|| entry.getKey().equals(returnField)) {
if (entry.getValue() instanceof Text) {
jsonObject.put(entry.getKey(),
((Text) entry.getValue()).getValue());
} else {
jsonObject.put(entry.getKey(), entry.getValue());
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return jsonObject;
}
|
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 ToolboxPanel();
toolboxPanel.setLocation(640, 0);
getContentPane().add(toolboxPanel);
drawingPanel = new DrawingPanel(this);
drawingPanel.setLocation(0, 0);
getContentPane().add(drawingPanel);
settingsPanel = new SettingsPanel(this);
settingsPanel.setLocation(0, 480);
getContentPane().add(settingsPanel);
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File");
JMenuItem newMenuItem = new JMenuItem("New...");
newMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
newMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
final JFrame newFrame = new JFrame("New");
newFrame.setSize(240, 160);
newFrame.setLayout(null);
final JSpinner spinnerWidth = new JSpinner();
spinnerWidth.setModel(new SpinnerNumberModel(16, 1, Integer.MAX_VALUE, 1));
spinnerWidth.setBounds(80, 16, 64, 24);
newFrame.add(spinnerWidth);
JLabel lblWidth = new JLabel("Width: ");
lblWidth.setBounds(16, 16, 64, 24);
newFrame.add(lblWidth);
final JSpinner spinnerHeight = new JSpinner();
spinnerHeight.setModel(new SpinnerNumberModel(32, 1, Integer.MAX_VALUE, 1));
spinnerHeight.setBounds(80, 50, 64, 24);
newFrame.add(spinnerHeight);
JLabel lblHeight = new JLabel("Height: ");
lblHeight.setBounds(16, 50, 64, 24);
newFrame.add(lblHeight);
JButton okButton = new JButton("OK");
okButton.setBounds(104, 114, 32, 24);
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
getDrawingPanel().reset();
getDrawingPanel().setFrame(0);
getDrawingPanel().setCanvasHeight((int) spinnerHeight.getValue());
getDrawingPanel().setCanvasWidth((int) spinnerWidth.getValue());
newFrame.dispose();
}
});
newFrame.add(okButton);
newFrame.setVisible(true);
}
});
}
});
fileMenu.add(newMenuItem);
JMenuItem openMenuItem = new JMenuItem("Open...");
openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
openMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileNameExtensionFilter("Personimator animations (*.psnmtr)", "psnmtr"));
if (fileChooser.showOpenDialog(Personimator.this) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
getDrawingPanel().load(file);
}
}
});
fileMenu.add(openMenuItem);
fileMenu.addSeparator();
JMenuItem saveMenuItem = new JMenuItem("Save...");
saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
saveMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileNameExtensionFilter("Personimator animations (*.psnmtr)", "psnmtr"));
if (fileChooser.showSaveDialog(Personimator.this) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
if (!file.getName().endsWith(".psnmtr")) file = new File(file.getPath() + ".psnmtr");
getDrawingPanel().save(file);
}
}
});
fileMenu.add(saveMenuItem);
fileMenu.addSeparator();
JMenuItem exportSheetMenuItem = new JMenuItem("Export sheet...");
exportSheetMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileNameExtensionFilter("Portable Network Graphics (*.png)", "png"));
if (fileChooser.showSaveDialog(Personimator.this) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
if (!file.getName().endsWith(".png")) file = new File(file.getPath() + ".png");
getDrawingPanel().exportSheet(file);
}
}
});
fileMenu.add(exportSheetMenuItem);
JMenuItem exportAnimationMenuItem = new JMenuItem("Export animation...");
exportAnimationMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileNameExtensionFilter("Animated GIF (*.gif)", "gif"));
if (fileChooser.showSaveDialog(Personimator.this) == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
if (!file.getName().endsWith(".gif")) file = new File(file.getPath() + ".gif");
final File finalFile = file;
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
final JFrame animationExportOptions = new JFrame("Animation options");
animationExportOptions.setSize(240, 160);
animationExportOptions.setLayout(null);
final JSpinner spinnerDelay = new JSpinner();
spinnerDelay.setModel(new SpinnerNumberModel(250, 1, 10000, 1));
spinnerDelay.setBounds(80, 16, 64, 24);
animationExportOptions.add(spinnerDelay);
JLabel lblDelay = new JLabel("Delay: ");
lblDelay.setBounds(16, 16, 64, 24);
animationExportOptions.add(lblDelay);
JButton okButton = new JButton("OK");
okButton.setBounds(104, 50, 32, 24);
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
getDrawingPanel().exportAnimation(finalFile, (int) spinnerDelay.getValue());
animationExportOptions.dispose();
}
});
animationExportOptions.add(okButton);
animationExportOptions.setVisible(true);
}
});
}
}
});
fileMenu.add(exportAnimationMenuItem);
menuBar.add(fileMenu);
setJMenuBar(menuBar);
}
|
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);
} else if (object instanceof JSONArray) {
((JSONArray) object).put(value);
} else {
this.put(key, new JSONArray().put(object).put(value));
}
return this;
}
|
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 * i + 3];
x5[4] = x[5 * i + 4];
mediane.add(median5(x5));
}
int remainder = x.length % 5;
switch (remainder) {
case 4:
mediane.add(median4(new int[] { x[x.length - 4], x[x.length - 3], x[x.length - 2], x[x.length - 1] }));
break;
case 3:
mediane.add(median3(new int[] { x[x.length - 3], x[x.length - 2], x[x.length - 1] }));
break;
case 2:
mediane.add(median2(new int[] { x[x.length - 2], x[x.length - 1] }));
break;
case 1:
mediane.add(x[x.length - 1]);
break;
}
int[] neueMediane = toIntArray(mediane);
if (medianRecursionCount == 1 && blumRecursionCount == 1) {
for (int i : neueMediane) {
out.append(i);
out.append(" ");
}
}
if (neueMediane.length == 1) {
return neueMediane[0];
} else {
return getMediane(neueMediane, blumRecursionCount, ++medianRecursionCount, out);
}
}
|
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());
result = prime * result + ((street == null) ? 0 : street.hashCode());
result = prime * result
+ ((zipString == null) ? 0 : zipString.hashCode());
result = prime * result + zipcode;
return result;
}
|
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))
{
url = new URL(VersionInfo.getWinProfile());
}
else
{
url = new URL(VersionInfo.getUnixProfile());
}
URLConnection urlconnection = url.openConnection();
URLConnection urlconnection2 = url2.openConnection();
if((urlconnection instanceof HttpURLConnection))
{
urlconnection.setRequestProperty("Cache-Control", "no-cache");
urlconnection.connect();
}
if((urlconnection2 instanceof HttpURLConnection))
{
urlconnection2.setRequestProperty("Cache-Control", "no-cache");
urlconnection2.connect();
}
launcherProfile = urlconnection.getInputStream();
remoteInstallerProfile = urlconnection2.getInputStream();
}
catch(Exception ex)
{
ex.printStackTrace();
JOptionPane.showMessageDialog(null, Language.getLocalizedString("error.connection"), Language.getLocalizedString("error"), JOptionPane.ERROR_MESSAGE);
}
JdomParser parser = new JdomParser();
try
{
profileData = parser.parse(new InputStreamReader(launcherProfile, Charsets.UTF_8));
remoteInstallerData = parser.parse(new InputStreamReader(remoteInstallerProfile, Charsets.UTF_8));
}
catch(Exception e)
{
throw Throwables.propagate(e);
}
}
|
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();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
return writer.toString();
} catch (TransformerException ex) {
ex.printStackTrace();
return null;
}
}
|
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] = sumc[j] + x[i][j];
sumr = sumr + x[i][j];
if (i == j) {
sumd1 = sumd1 + x[i][j];
}
if (j == (x[0].length - (i + 1))) {
sumd2 = sumd2 + x[i][j];
}
} else {
System.out.print(" ");
}
}
System.out.print(sumr);
}
System.out.print("\n\n" + sumd2 + " ");
for (int i = 0; i < x[0].length; i++) {
System.out.print(sumc[i] + " ");
}
System.out.print(sumd1);
}
|
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 < length; i += 2) {
int byte1 = bytes[i] & 0xFF;
int byte2 = bytes[i + 1] & 0xFF;
int code = (byte1 << 8) | byte2;
int subtracted = -1;
if (code >= 0x8140 && code <= 0x9ffc) {
subtracted = code - 0x8140;
} else if (code >= 0xe040 && code <= 0xebbf) {
subtracted = code - 0xc140;
}
if (subtracted == -1) {
throw new WriterException("Invalid byte sequence");
}
int encoded = ((subtracted >> 8) * 0xc0) + (subtracted & 0xff);
bits.appendBits(encoded, 13);
}
}
|
de5c5c4c-2e45-4d32-8f08-7ce43a0ee93c
| 4
|
public void setAdminComponentsState() {
//Включаем кнопки
buttonNew.setVisible(true);
buttonSave.setVisible(true);
buttonBreak.setVisible(true);
buttonActivate.setVisible(true);
//Делаем редактируемыми поля ввода
textFieldName.setEditable(true);
textFieldMinAmount.setEditable(true);
textFieldMaxAmount.setEditable(true);
textFieldDuration.setEditable(true);
textFieldStartPay.setEditable(true);
textFieldPercent.setEditable(true);
textAreaDescription.setEditable(true);
//Устанавливаем возможность вызова справки
KeyListener keyListenerF1 = new KeyAdapter() {
public void keyPressed(KeyEvent e) {
//Вызов справки
if (e.getKeyCode() == KeyEvent.VK_F1){
try {
//Имя программы и файл справки
String[] callArgs = new String[]{helpProg, helpFile};
Runtime.getRuntime().exec(callArgs);
} catch (IOException ex) {
JOptionPane.showMessageDialog(CreditProgramForm.this, "Ошибка при загрузке файла справки");
}
}
}
};
setFocusable(true);
//Добавляем слушателя на хелп в компоненты
addKeyListener(keyListenerF1);
creditProgramTable.addKeyListener(keyListenerF1);
//Устанавливаем сохранение размеров формы администратора и их восстановление
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
try {
//Сохраняем размеры и положение формы в XML документ
final XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(FILENAME)));
//Получаем размеры и положение
Rectangle rect = getBounds();
encoder.writeObject(rect);
encoder.close();
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(CreditProgramForm.this, "Файл свойств формы не найден!");
}
}
});
try {
//Устанавливаем размеры сохраненные при последнем закрытии формы
final XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(new FileInputStream(FILENAME)));
//Получаем размеры и положение формы
Rectangle rect = (Rectangle) decoder.readObject();
//Устанавливаем размеры
setBounds(rect);
} catch (FileNotFoundException ex) {
JOptionPane.showMessageDialog(this, "Файл инициализации формы не найден");
}
}
|
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 != null) {
TagPos tagPos = getOpenTags(cleanTimeValues).findTag(fatalTag);
if (tagPos != null) {
fatalTagPositon = tagPos.position;
}
}
// iterates through the list of open tags from the end and check if there is some higher
ListIterator it = getOpenTags(cleanTimeValues).list.listIterator( getOpenTags(cleanTimeValues).list.size() );
while ( it.hasPrevious() ) {
TagPos currTagPos = (TagPos) it.previous();
if (tag.isHigher(currTagPos.name)) {
return currTagPos.position <= fatalTagPositon;
}
}
return true;
}
}
return false;
}
|
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;
Date fini;
Date ffin;
try{
if (fechaini.equals("") || fechafin.equals("")){
result="No puede dejar uno de los campos de fecha en blanco";
return result;
} else {
SimpleDateFormat dformat = new SimpleDateFormat("dd/MM/yyyy");
fechai = dformat.parse(fechaini);
fechaf = dformat.parse(fechafin);
for (int i = 0; i < dbGE.size() ; i++){
fini=dformat.parse(dbGE.get(i).getFechaini());
ffin=dformat.parse(dbGE.get(i).getFechafin());
if((fini.compareTo(fechai))>=0 && (ffin.compareTo(fechaf))<=0){
geResult.add(dbGE.get(i));
//break;
}
}
}
}catch (NullPointerException e) {
result="No hay Grupos de Estudios entre las fechas proporcionadas";
}
if (geResult.size()>0){
for (int i = 0; i < geResult.size() ; i++) {
result+="\nRegistros encontrados: ";
result+="\nNombre: " + geResult.get(i).getNombre();
result+="\nAcademia: " + geResult.get(i).getAcademia();
result+="\nCurso: " + geResult.get(i).getCurso();
result+="\nFecha de Inicio: " + geResult.get(i).getFechaini();
result+="\nFecha de Fin: " + geResult.get(i).getFechafin();
result+="\nEstado: " + geResult.get(i).getEstado();
result+="\n----------------------";
}
} else {
result="No se ha encontrado ningun registro";
}
return result;
}
|
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);
rs = ps.executeQuery();
while (rs.next())
Values.add(Double.valueOf(rs.getDouble("balance")));
}
catch (Exception e) {
return null;
}
finally
{
if (ps != null) try {
ps.close();
} catch (SQLException ex) {
} if (conn != null) try {
conn.close();
} catch (SQLException ex) {
}
}
return Values;
}
|
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();
} catch(InterruptedException e2) {
throw(new Error(e2));
}
}
errorsent();
}
|
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>50 || xyOrder>10)
return false;
outputFit = gd.getNextBoolean();
shiftToDisplay = gd.getNextBoolean();
if (e!=null && !(e.getSource() instanceof Checkbox))
matrixCalculated = false;
setOffset();
return true;
}
|
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 * 1);
glVertexPointer(3, 32, this.floatBuffer);
if (hasTexture) {
floatBuffer.position(3 * 1);
glTexCoordPointer(2, 32, floatBuffer);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (hasColor) {
byteBuffer.position(5 * 4);
glColorPointer(4, true, 32, byteBuffer);
glEnableClientState(GL_COLOR_ARRAY);
}
if (hasNormals) {
byteBuffer.position(0);
glNormalPointer(32, byteBuffer);
glEnable(GL_NORMAL_ARRAY);
}
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(DrawMode, 0, VertexCount);
glDisableClientState(GL_VERTEX_ARRAY);
if (hasTexture) {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
if (hasColor) {
glDisableClientState(GL_COLOR_ARRAY);
}
if (hasNormals) {
glDisableClientState(GL_NORMAL_ARRAY);
}
int vertcount = VertexCount;
reset();
return vertcount;
}
|
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()) {
headerSize+=4;
}
int size = data[1] & 0x7F;
if(size == 126) {
headerSize+=2;
} else if(size == 127) {
headerSize+=8;
}
if(dataSize + length < headerSize) {
return;
}
int offset2 = 0;
for(int i = dataSize;i<headerSize;++i) {
data[i] = bytes[offset + offset2];
++offset2;
}
calculateLength();
}
|
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 i=1;i<args.length;i++)
{
if(args[i] instanceof Container)
container=(Item)args[1];
else
if(args[i] instanceof Boolean)
quiet=((Boolean)args[i]).booleanValue();
}
final boolean success=get(mob,container,item,quiet);
if(item instanceof Coins)
((Coins)item).putCoinsBack();
if(item instanceof RawMaterial)
((RawMaterial)item).rebundle();
return Boolean.valueOf(success);
}
return Boolean.FALSE;
}
|
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")));
this.messages.put(EnumMessage.KICKMAINTENANCE, MessageUtil.translateToColorCode(config.getString("messages.kickmaintenance")));
this.messages.put(EnumMessage.MOTDMAINTENANCE, MessageUtil.translateToColorCode(config.getString("motd.maintenance")));
this.messages.put(EnumMessage.MOTDUNKNOWNPLAYER, MessageUtil.translateToColorCode(config.getString("motd.unknownplayer")));
this.messages.put(EnumMessage.MOTDKNOWNPLAYER, MessageUtil.translateToColorCode(config.getString("motd.player")));
this.tabDefaultColor = ChatColor.valueOf(config.getString("tabcolor.default"));
this.tabStaffColor = ChatColor.valueOf(config.getString("tabcolor.staff"));
this.peakPlayers = config.getInt("peakplayers");
this.addListServers = config.getBoolean("addlistservers");
this.helpEnabled = config.getBoolean("help.enabled");
for (String helpMessage : config.getStringList("help.messages")) {
helpMessages.add(MessageUtil.translateToColorCode(helpMessage));
}
List<String> hoverList = config.getStringList("hoverplayerlist");
PlayerInfo[] info = new PlayerInfo[hoverList.size()];
for (int i = 0; i < info.length; i++) {
String line = MessageUtil.translateToColorCode(hoverList.get(i).replace("[peakplayers]", String.valueOf(this.peakPlayers)));
info[i] = new PlayerInfo(line.length() > 0 ? line : "§r", "");
}
this.serverHoverPlayerListDefault = info;
List<String> hoverListMaintenance = config.getStringList("hoverplayerlistmaintenance");
PlayerInfo[] infoMaintenance = new PlayerInfo[hoverListMaintenance.size()];
for (int i = 0; i < infoMaintenance.length; i++) {
String line = MessageUtil.translateToColorCode(hoverListMaintenance.get(i).replace("[peakplayers]", String.valueOf(this.peakPlayers)));
infoMaintenance[i] = new PlayerInfo(line.length() > 0 ? line : "§r", "");
}
this.serverHoverPlayerListMaintenance = infoMaintenance;
this.maintenanceEnabled = config.getBoolean("maintenancemode");
}
|
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.sendMessage(ChatColor.RED + "You don't have permission!");return true;}
if (cmdName.equalsIgnoreCase("BringAllHere")) {return BringAllHere.run(sender, isPlayer, args, this.log);}
if (cmdName.equalsIgnoreCase("BringAllTo")) {return BringAllTo.run(sender, isPlayer, args, this.log);}
if (cmdName.equalsIgnoreCase("BringWorldHere")) {return BringWorldHere.run(sender, isPlayer, args, this.log);}
if (cmdName.equalsIgnoreCase("BringWorldTo")) {return BringWorldTo.run(sender, isPlayer, args, this.log);}
return true;
}
|
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++)
{
IMazeCell cellToNorth;
IMazeCell cellToWest;
if (DebugVariables.GRID_MAPPING_INFORMATION)
{
System.out.println("Generating cell " + x + "," + y);
}
IMazeCell mazeCell = MazeCellFactory.getMazeCell(
EnumMazeCellType.SQUARE_MAZE_CELL,new Point(x, y));
mazeCell.registerObserver(this);
this.mazeCells.add(mazeCell);
System.out.println();
}
}
if (DebugVariables.GRID_MAPPING_INFORMATION)
{
System.out.println("Maze generated with: " + this.getMazeCells().size()
+ " cells");
System.out.println("Connecting cells");
}
connectCells();
}
|
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++)
n1[i] = num1.charAt(n1.length - 1 - i) - '0';
for (int i = 0; i < n2.length; i++)
n2[i] = num2.charAt(n2.length - 1 - i) - '0';
for (int i = 0; i < n1.length; i++) {
for (int j = 0; j < n2.length; j++) {
result[i + j] += n1[i] * n2[j];
}
}
for (int i = 0; i < result.length - 1; i++) {
result[i + 1] += result[i] / 10;
result[i] = result[i] % 10;
}
StringBuilder sb = new StringBuilder();
int i;
if (result[result.length - 1] == 0)
i = result.length - 2;
else
i = result.length - 1;
for (; i > -1; i--)
sb.append(result[i]);
return sb.toString();
}
|
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 pixels
int index = 0;
for(int y=0;y<heightWithBorder;y++)
{
for(int x=0;x<widthWithBorder;x++)
{
// we are using a 2d image to represent a 3d array, so we choose the brightest pixel
float bestScore = 0;
for(int r=0;r<depth;r++)
{
// choose the correct normaliser
float divisor = circLength[r];
float score = space[index] / divisor;
if (score > bestScore) bestScore = score;
index++;
}
// cap the value between 0 and 1
bestScore = Math.min(1, Math.max(0, bestScore));
// create final pixel
image.set(y, x, (short)(bestScore * 0xFF));
}
}
// store
storedHoughImage = image.toImage();
}
|
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 = 1;
}
} else {
compExecTime();
}
// System.out.println("Evaluation Value =========="+dEval);
} while (dEval > 0);
// while (evaluateResults());
// System.out.println("==================Distribution=====================");
for (int i = 0; i < iClass; i++) {
// System.out.print("FinalDistribution[" + i + "] ");
for (int j = 0; j < iSite; j++) {
dmDist[i][j] = Math.round(dmDist[i][j]);
// System.out.print(dmDistribution[i][j] + ",");
}
// System.out.println();
}
// System.out.println("==================Allocation=====================");
for (int i = 0; i < iClass; i++) {
System.out.print("FinalAllocation[" + i + "] ");
for (int j = 0; j < iSite; j++) {
dmAlloc[i][j] = Math.round(dmAlloc[i][j]);
// System.out.print(dmAllocation[i][j] + ",");
}
// System.out.println();
}
// System.out.println("Stage = " + iStage);
}
|
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\":[\"\"]";
}else{
some = some + sRes[i];
}
}
}
try {
JSONObject jsonObject = new JSONObject(some);
JSONObject data = jsonObject.getJSONObject("data");
JSONArray infos = data.getJSONArray("info");
for (int i = 0; i < infos.length(); i++) {
JSONObject info = infos.getJSONObject(i);
Weibo weibo = parseToWeiboQq(info);
if (weibo==null||weibo.equals(null)) {
continue;
}
list.add(weibo);
}
return list;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
|
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))
return false;
_lastModified=lm;
if (_resource.isDirectory())
_list=_resource.list();
if (_list==null)
{
int l=(int)_resource.length();
if (l<0)
l=1024;
ByteArrayOutputStream2 bout = new ByteArrayOutputStream2(l);
InputStream in = _resource.getInputStream();
try{IO.copy(in,bout);} finally {in.close();}
_buf=bout.getBuf();
if (_buf.length!=l)
_buf=bout.toByteArray();
}
return true;
}
|
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 Room R2=R.rawDoors()[d];
final Exit E2=R.getRawExit(d);
if((R2==null)&&(E2!=null))
str.append(L("@x1: @x2 to @x3 (@x4)\n\r",CMStrings.padRight(R.roomID(),30),CMLib.directions().getDirectionName(d),E2.temporaryDoorLink(),E2.displayText()));
}
}
}
catch (final NoSuchElementException e)
{
}
if(str.length()==0)
str.append(L("None!"));
if(CMParms.combine(commands,1).equalsIgnoreCase("log"))
Log.rawSysOut(str.toString());
return str.toString();
}
@SuppressWarnings({ "unchecked", "rawtypes" }
|
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(person.getX() == tentLoc.x && person.getY() == tentLoc.y)
{
int available = person.storedWood.getAmount();
int newAmount = available - buildRate; if(newAmount < 0) newAmount = 0;
int amount = available - newAmount;
int ncr = currentResources + amount;
//eg 50 - 49 = 1 || 50 - 55 = -5
int reqDiff = requiredResources - ncr; if (reqDiff > 0) reqDiff = 0;
amount = amount + reqDiff;
currentResources += amount;
person.storedWood.remove(amount);
if(currentResources == requiredResources) completeTask(person);
}
}
|
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 have a gem, we upgrade based on the clicked tile
else if(game.getMap().getGem() != null){
if(t instanceof Field)
getGame().getMap().upgradeTower((Field)t);
else if(t instanceof Swamp)
getGame().getMap().upgradeSwamp((Swamp)t);
}
}
|
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) {
System.out.println("Caught exception during parsing: " + ex.getMessage());
return;
}
grammarTextPane.getHighlighter().removeAllHighlights();
if (grammarParser.hasErrors()) {
for (ParserError error : grammarParser.getErrors()) {
highlightErrorLine(error.getLineIndex(), grammarTextPane);
}
} else {
graphPanel.setNetworkGraph(grammarParser.getGraph());
graphPanel.repaint();
}
initialisationTextPaneKeyReleased(null);
}//GEN-LAST:event_grammarTextPaneKeyReleased
|
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.setTotalDuration(duration);
} catch (NumberFormatException exception) {
}
try {
double snapshotInterval = snapshotIntervalView.getValue();
runner.setSnapshotIntervalView(snapshotInterval);
} catch (NumberFormatException exception) {
}
try {
double rmin = rminView.getValue();
gridFactory.setRmin(rmin);
} catch (NumberFormatException exception) {
}
try {
double rmax = rmaxView.getValue();
gridFactory.setRmax(rmax);
} catch (NumberFormatException exception) {
}
try {
double deltar0 = deltar0View.getValue();
gridFactory.setDeltar0(deltar0);
} catch (NumberFormatException exception) {
}
try {
int intervalCount = intervalCountView.getIntegerValue();
gridFactory.setIntervalCount(intervalCount);
} catch (NumberFormatException exception) {
}
setFieldValuesFromData();
}
|
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 = false;
int begin = min;
int ol = 1 << id;
g.chcolor(olc[id]);
for (int i = min; i <= max; i++) {
Coord c = r.mul(i).add(m.mul(med)).add(d);
int ol2;
try {
ol2 = getol(c);
} catch (Loading e) {
ol2 = ol;
}
if (t) {
if (((ol2 & ol) != 0) || i == max) {
t = false;
Coord cb = m2s(tileSize.mul(r.mul(begin).add(off))).add(sc);
Coord ce = m2s(tileSize.mul(r.mul(i).add(off))).add(sc);
g.line(cb, ce, 2);
}
} else {
if ((ol2 & ol) == 0) {
t = true;
begin = i;
}
}
}
}
|
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_DISPLAY:{
sideMenuItem.setSelected(true); break;}
case ValueChart.DEFAULT_DISPLAY:{
defMenuItem.setSelected(true); break;}
}
switch (chart.colWidth){
case SMALL:{
smMenuItem.setSelected(true); break;}
case MEDIUM:{
medMenuItem.setSelected(true); break;}
case LARGE:{
lgMenuItem.setSelected(true); break;}
case EXTRALARGE:{
xlgMenuItem.setSelected(true); break;}
}
}
|
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 && stillAvailableArmies > 0) {
AttackTransferMove bestAttack = opponentRegion.getIncomingMoves().get(0);
PlaceArmiesMove pam = new PlaceArmiesMove(state.getMyPlayerName(), bestAttack.getFromRegion(),
stillAvailableArmies);
MovesPerformer.performDeployment(state, pam);
out.totalDeployment += pam.getArmies();
out.armyPlacementMoves.add(pam);
bestAttack.setArmies(bestAttack.getArmies() + stillAvailableArmies);
stillAvailableArmies = 0;
}
}
// give armies to defence region
List<Region> sortedDefenceRegions = RegionValueCalculator.getOrderedListOfDefenceRegions(state);
for (Region region : sortedDefenceRegions) {
if (stillAvailableArmies > 0) {
PlaceArmiesMove pam = new PlaceArmiesMove(state.getMyPlayerName(), region, stillAvailableArmies);
MovesPerformer.performDeployment(state, pam);
out.totalDeployment += stillAvailableArmies;
out.armyPlacementMoves.add(pam);
stillAvailableArmies = 0;
}
}
return out;
}
|
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_ == Long.TYPE)
{
length += 8;
} else if(class_ == Integer.TYPE) {
length += 4;
} else if(class_ == Short.TYPE) {
length += 2;
} else if(class_ == Byte.TYPE) {
++length;
} else if(class_ == Float.TYPE) {
length += 4;
} else if(class_ == Double.TYPE) {
length += 8;
} else if(class_ == byte[].class) {
length += 1024;
} else if(class_ == String.class) {
length += 64;
}
}
this.length = length;
}
|
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)
explosiumResources++;
if(tileType == TileType.SCRAP)
scrapResources++;
Debug.debug("Resources of player " + username + " are now: Rubidium: "
+ rubidiumResources + ", Explosium: " + explosiumResources + ", Scrap: " + scrapResources);
return true;
}
return false;
}
|
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;
}
return true;
}
|
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
{ // is it on the Left or Right subtree?
y = x.getParent().getParent().getRight(); // get uncle
if(y!= null && y.getColor() == Color.RED) { // uncle is red; change x's Parent and uncle to black
x.getParent().setColor(Color.BLACK);
y.setColor(Color.BLACK);
// grandparent must be red. Why? Every red node that is not
// a leaf has only black children
x.getParent().getParent().setColor(Color.RED);
x = x.getParent().getParent(); // continue loop with grandparent
} else {
// uncle is black; determine if x is greater than Parent
if(x == x.getParent().getRight()) { // yes, x is greater than Parent; rotate Left
// make x a Left child
x = x.getParent();
rotateLeft(x);
}
// no, x is less than Parent
x.getParent().setColor(Color.BLACK); // make Parent black
x.getParent().getParent().setColor(Color.RED); // make grandparent black
rotateRight(x.getParent().getParent()); // rotate right
}
} else { // x's Parent is on the Right subtree
// this code is the same as above with "Left" and "Right" swapped
y = x.getParent().getParent().getLeft();
if(y!= null && y.getColor() == Color.RED) {
x.getParent().setColor(Color.BLACK);
y.setColor(Color.BLACK);
x.getParent().getParent().setColor(Color.RED);
x = x.getParent().getParent();
} else {
if(x == x.getParent().getLeft()) {
x = x.getParent();
rotateRight(x);
}
x.getParent().setColor(Color.BLACK);
x.getParent().getParent().setColor(Color.RED);
rotateLeft(x.getParent().getParent());
}
}
}
getRoot().setColor(Color.BLACK); // root should always be black
}
|
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] = sc.nextInt();
}
}
int ciel = 0;
int jiro = 0;
ArrayList<Integer> middle = new ArrayList<Integer>();
for (int i = 0; i < n; i++) {
int s = c[i].length;
for (int j = 0; j < s/2; j++) {
ciel += c[i][j];
}
for (int j = (s-1)/2 + 1; j < s; j++) {
jiro += c[i][j];
}
if (s % 2 == 1) {
middle.add(c[i][s/2]);
}
}
Collections.sort(middle, Collections.reverseOrder());
for (int i = 0; i < middle.size(); i += 2) {
ciel += middle.get(i);
}
for (int i = 1; i < middle.size(); i += 2) {
jiro += middle.get(i);
}
System.out.printf("%d %d\n", ciel, jiro);
}
|
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.getProperty("line.separator");
while ((line = input.readLine()) != null) {
contents.append(line);
contents.append(newline);
}
} finally {
input.close();
}
} catch (IOException ignored) {
}
return StringUtils.strip(contents.toString());
}
|
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 RandomWalkEntity(this, tiles[49][49]));
Entity entity = new RandomWalkEntity(this, tiles[49][49]);
entities.add(entity);
perspective = new EntityPerspective(this, entity);
}
|
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());
lastUsageByControllable.put(fridge, fridge.getCurrentUsage());
fridgeTemperatureSeries.add(time, fridge.getTemp());
}
if (observable == washer) {
if (lastUsageByControllable.containsKey(washer))
washerUsageSeries.add(time, lastUsageByControllable.get(washer));
washerUsageSeries.add(time, washer.getCurrentUsage());
lastUsageByControllable.put(washer, washer.getCurrentUsage());
}
if (observable == battery){
if(lastUsageByControllable.containsKey(battery))
batteryUsageSeries.add(time, lastUsageByControllable.get(battery));
batteryUsageSeries.add(time, battery.getCurrentUsage());
batteryChargeSeries.add(time, battery.getCharge());
lastUsageByControllable.put(battery, battery.getCurrentUsage());
}
if (observable == network){
if(lastUsageByControllable.containsKey(network))
networkUsageSeries.add(time, lastUsageByControllable.get(network));
networkUsageSeries.add(time, network.getCurrentUsage());
lastUsageByControllable.put(network, network.getCurrentUsage());
}
}
|
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 : getCirclePoints(r + minR, x, y)) {
if(p.x >= 0 && p.y >= 0 && p.x < acc[r].length && p.y < acc[r][x].length) {
++acc[r][p.x][p.y];
}
}
}
CoinCounter.logger.finer("Done with point (" + x + ", " + y + ")");
}
CoinCounter.logger.fine("Done with x = " + x);
}
isDone = true;
}
|
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.PROPERTY;
}
return returnType;
}
|
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 {
Stat.weightingOptionS = false;
}
}
double rms = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
double[] ww = amWeights.getArray_as_double();
rms = Stat.rms(dd, ww);
break;
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
BigDecimal[] wd = amWeights.getArray_as_BigDecimal();
rms = Stat.rms(bd, wd);
bd = null;
wd = null;
break;
case 14:
throw new IllegalArgumentException("Complex root mean square is not supported");
default:
throw new IllegalArgumentException("This type number, " + type + ", should not be possible here!!!!");
}
Stat.weightingOptionS = holdW;
return rms;
}
}
|
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]);
if (rParts[3] != "CMD_CLEAR") FileWrite.WriteHistory(rParts[2], rParts[3]);
}
} else {
Send.runCommandWithPar(rParts[3], rParts[4]);
}
}
// Handle messages
if (rParts[0].equals("message")) {
GUI.Append(rParts[2] + ": " + rParts[3]);
if (!JServer.debug) {
User.addToOnlineList(rParts[2]);
FileWrite.WriteHistory(rParts[2], rParts[3]);
}
}
new SendClientInfo(from);
}
|
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 = HIDDEN_MAP.remove((AppHiddenListener) listener);
}
if (listener instanceof AppReOpenedListener) {
handler = REOPENED_MAP.remove((AppReOpenedListener) listener);
}
if (listener instanceof ScreenSleepListener) {
handler = SCREEN_MAP.remove((ScreenSleepListener) listener);
}
if (listener instanceof SystemSleepListener) {
handler = SYSTEM_MAP.get((SystemSleepListener) listener);
}
if (listener instanceof UserSessionListener) {
handler = USER_MAP.get((UserSessionListener) listener);
}
if (handler != null)
call(application, "removeAppEventListener", new Class<?>[]{ _appEventListenerClass }, new Object[]{ 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(theboard.getPeople().get(peo).getContent());
peoplePanel.add(people);
}
peoplePanel.setLayout(new GridLayout(0, 2));
peoplePanel.setBorder(new TitledBorder (new EtchedBorder(), "People"));
// add room check box
JPanel roomPanel = new JPanel();
for (int rom = 0; rom < theboard.getRoomCards().size(); rom ++){
room = new JCheckBox(theboard.getRoomCards().get(rom).getContent());
roomPanel.add(room);
}
roomPanel.setLayout(new GridLayout(0, 2));
roomPanel.setBorder(new TitledBorder(new EtchedBorder(), "Weapons"));
// add weapon check box
JPanel weaponPanel = new JPanel();
for (int wep = 0; wep < theboard.getWeapons().size(); wep++ ){
weapon = new JCheckBox(theboard.getWeapons().get(wep).getContent());
weaponPanel.add(weapon);
}
weaponPanel.setLayout(new GridLayout(0, 2));
weaponPanel.setBorder(new TitledBorder(new EtchedBorder(), "Weapons"));
// add personGuress ComboBox
JPanel personGuess = new JPanel();
JComboBox<String> people = new JComboBox<String>();
for (int peo = 0; peo < theboard.getPeople().size(); peo++){
people.addItem(theboard.getPeople().get(peo).getContent());
}
personGuess.add(people);
personGuess.setBorder(new TitledBorder(new EtchedBorder(), "Person Guess"));
// add roomGuess ComboBox
JPanel roomGuess = new JPanel();
JComboBox<String> rooms = new JComboBox<String>();
for (int rom = 0; rom < theboard.getRoomCards().size(); rom++){
rooms.addItem(theboard.getRoomCards().get(rom).getContent());
}
roomGuess.add(rooms);
roomGuess.setBorder(new TitledBorder(new EtchedBorder(), "Room Guess"));
// add weaponGuess ComboBox
JPanel weaponGuess = new JPanel();
JComboBox<String> weapons = new JComboBox<String>();
for (int wep = 0; wep < theboard.getWeapons().size(); wep++){
weapons.addItem(theboard.getWeapons().get(wep).getContent());
}
weaponGuess.add(weapons);
weaponGuess.setBorder(new TitledBorder(new EtchedBorder(), "Weapon Guess"));
topPanel.add(peoplePanel);
topPanel.add(personGuess);
topPanel.add(roomPanel);
topPanel.add(roomGuess);
topPanel.add(weaponPanel);
topPanel.add(weaponGuess);
add(topPanel);
}
|
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 = secsSince1970 + SECONDS_FROM_1900_TO_1970.longValue();
// this line was cribbed from jakarta commons-net's NTP TimeStamp code
long fraction = ((millisecs % 1000) * 0x100000000L) / 1000;
stream.write((int) secs);
stream.write((int) fraction);
}
|
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 NamedPipeGWCAConnection(new File("\\\\.\\pipe\\GWCA_" + 3100));
gwcaConnection.open();
GWCAOperations op = new GWCAOperations(gwcaConnection);
//TODO: START code your program below this point
LOG.debug("getMyMaxHp(): {{},{}}", op.getMyMaxHp()[0], op.getMyMaxHp()[1]);
LOG.debug("getMyMaxEnergy(): {{},{}}", op.getMyMaxEnergy()[0], op.getMyMaxEnergy()[1]);
LOG.debug("getBuildNumber(): {}", op.getBuildNumber());
op.setMaxZoom(4000);
LOG.debug("getPing(): {}", op.getPing());
//TODO: END code your program below this point
LOG.info("The \"Java GWCAConstants\" finished executing");
} catch (Throwable throwable) {
LOG.error("Initializing the \"Java GWCAConstants\" failed because: ", throwable);
} finally {
try {
gwcaConnection.close();
} catch (IOException ex) {
LOG.error("IO closing", ex);
}
}
}
|
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.setName(L("an egg"));
I.setDisplayText(L("an egg has been left here."));
I.setMaterial(RawMaterial.RESOURCE_EGGS);
I.setDescription(L("It looks like a chicken egg!"));
I.basePhyStats().setWeight(1);
CMLib.materials().addEffectsToResource(I);
((MOB)ticking).addItem((Item)I.copyOf());
}
if((((MOB)ticking).numItems()>5)
&&(((MOB)ticking).location()!=null)
&&(((MOB)ticking).location().findItem(null,"an egg")==null))
{
final Item I=((MOB)ticking).findItem("an egg");
if(I!=null)
{
((MOB)ticking).location().show(((MOB)ticking),null,CMMsg.MSG_NOISYMOVEMENT,L("<S-NAME> lay(s) an egg."));
I.removeFromOwnerContainer();
I.executeMsg((MOB)ticking,CMClass.getMsg((MOB)ticking,I,null,CMMsg.TYP_ROOMRESET,null));
((MOB)ticking).location().addItem(I,ItemPossessor.Expire.Resource);
((MOB)ticking).location().recoverRoomStats();
}
}
}
return true;
}
|
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
} catch (FileNotFoundException ex) {
Logger.getLogger(ConvertMAF_MAF_TABS.class.getName()).log(Level.SEVERE, null, ex);
}
//logica
String splitarray[];
Integer lenSplit = 0;
int readLines = 0;
String probe_name = "";
String genbank_acc = "";
String splittedText = "";
List<String[]> dataOligoSeq = new ArrayList<String[]>();
try {
while ((strRead = readbuffer.readLine())!=null){
//logic
if( !(strRead.startsWith("#") || strRead.startsWith("a")) ){
splitarray = strRead.split(" ");
lenSplit = splitarray.length;
splittedText = "";
for(String s: splitarray){
if(!s.equals("")){
splittedText += s+"\t";
}
}
System.out.println(splittedText);//+"\n"
}
readLines++;
}
} catch (IOException ex) {
Logger.getLogger(ConvertMAF_MAF_TABS.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (Exception e) {
e.printStackTrace();
}
}
|
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();
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
byte[] buffer = new byte[4096];
long fileLength = file.length();
long bytesLeft = fileLength;
int read = 0;
//Read our file into the md buffer
while(bytesLeft > 0){
try {
read = reader.read(buffer,0, bytesLeft < buffer.length ? (int)bytesLeft : buffer.length);
} catch (IOException e) {
e.printStackTrace();
}
md.update(buffer,0,read);
bytesLeft -= read;
}
byte[] digest = md.digest();
for (int i = 0; i < digest.length;i++) {
hexDigest += String.format("%02x" ,0xFF & digest[i]);
}
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
return hexDigest;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.