method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
79a52a7a-987d-4c1c-b074-ca15e0924f2b | 9 | @Override
public void spring(MOB target)
{
if((target!=invoker())&&(target.location()!=null))
{
if((doesSaveVsTraps(target))
||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target)))
target.location().show(target,null,null,CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("<S-NAME> avoid(s) setting off a noise trap!"));
else
if(target.location().show(target,target,this,CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("<S-NAME> set(s) off a **POP** trap!")))
{
super.spring(target);
final Area A=target.location().getArea();
for(final Enumeration<Room> e=A.getMetroMap();e.hasMoreElements();)
{
final Room R=e.nextElement();
if(R!=target.location())
R.showHappens(CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("You hear a loud **POP** coming from somewhere."));
}
if((canBeUninvoked())&&(affected instanceof Item))
disable();
}
}
} |
f39c890b-7f61-48c1-a60a-b7e5383e4287 | 0 | @Test
public void hahmoPutoaaAlkeellisesti() {
int hahmonKoordinaattiAlussa = pe.getY();
pe.eksistoi();
assertTrue("Hahmo ei liikkunut alaspäin!", pe.getY()
> hahmonKoordinaattiAlussa);
} |
067539e8-ac52-49a7-8600-494ab223533f | 9 | public void mouseDragged(MouseEvent e) {
//this item panel is the head item so just return
//we can't move the head item
if (getItemPanel().previousItem == null) {
return;
}
Point loc = e.getPoint();
SwingUtilities.convertPointToScreen(loc, (Component) e.getSource());
int deltaY = loc.y - startDragY;
//make sure deltaY isn't too small
if ((startY + deltaY) < (getItemPanel().previousItem.getY() + HEADER_HEIGHT)) {
deltaY = (getItemPanel().previousItem.getY() + HEADER_HEIGHT) - startY;
}
//make sure deltaY isn't too big
if (getItemPanel().nextItem == null) {
if ((startY + deltaY) > StackPanel.this.getHeight() - HEADER_HEIGHT) {
deltaY = (StackPanel.this.getHeight() - HEADER_HEIGHT) - startY;
}
} else if ((startY + deltaY) > (getItemPanel().nextItem.getY() - HEADER_HEIGHT)) {
deltaY = (getItemPanel().nextItem.getY() - HEADER_HEIGHT) - startY;
}
int x = getItemPanel().getX();
int y = startY + deltaY;
int w = getItemPanel().getWidth();
int h = startH - deltaY;
//adjust this panel
getItemPanel().setBounds(x, y, w, h);
//adjust previous panel
if (getItemPanel().previousItem != null) {
x = getItemPanel().previousItem.getX();
y = prevStartY - deltaY;
w = getItemPanel().previousItem.getWidth();
h = prevStartH + deltaY;
getItemPanel().previousItem.setBounds(x, y, w, h);
}
//StackedPanel2.this.getLayout().layoutContainer(StackedPanel2.this);
StackPanel.this.revalidate();
//StackedPanel2.this.invalidate();
StackPanel.this.repaint();
//if bottom component
if(getItemPanel().nextItem == null) {
if((getItemPanel().getY() + HEADER_HEIGHT) == StackPanel.this.getHeight()) {
getItemPanel().fireCollapsedEvent();
}
}
else {
if((getItemPanel().getY() + HEADER_HEIGHT) == getItemPanel().nextItem.getY()) {
getItemPanel().fireCollapsedEvent();
}
}
} |
0e6ccd1f-d71f-4d58-99c1-f8ee134d1b07 | 4 | public void init() throws Throwable{
StringBuilder action = new StringBuilder();
String str = null;
do{
// Converte a string pra um char
action.append(str);
char word[] = new char[str.length()];
word = action.toString().toCharArray();
switch (word[0]) {
case 'i':
// Instrução para inserir uma palavra na árvore
System.out.println(insert(word));
break;
case 'r':
// Instrução para remover uma palavra na árvore
System.out.println(remove(word));
break;
case 'f':
System.out.println(find(word));
break;
default:
System.gc();
System.exit(0);
}
action.delete(0, action.length());
}while(str != null);
} |
4e0c3faa-f24c-46ad-831f-79e812973280 | 5 | public boolean divide()
{
int regionHeight = y2 - y1;
int regionWidth = x2 - x1;
// Millä tavalla alue voidaan jakaa?
boolean canDivHor = regionHeight >= REGION_MIN_SIZE * 2;
boolean canDivVer = regionWidth >= REGION_MIN_SIZE * 2;
// Jos alue on liian pieni sekä korkeudeltaan että leveydeltään, ei sitä voi jakaa ollenkaan
if (!canDivHor && !canDivVer)
return false;
if (!canDivHor)
horizontalDiv = false;
else if (!canDivVer)
horizontalDiv = true;
else
horizontalDiv = Main.rand.nextBoolean(); // Jos alue on tarpeeksi iso, voidaan jakaa miten vaan
int dividePoint; // Relatiivinen y- tai x-koordinaatti, jonka perusteella jaetaan alue
if (horizontalDiv)
{
dividePoint = getDividePoint(regionHeight);
subRegion1 = new MapRegion(x1, x2, y1, y1 + dividePoint);
subRegion2 = new MapRegion(x1, x2, dividePoint + y1, y2);
}
else
{
dividePoint = getDividePoint(regionWidth);
subRegion1 = new MapRegion(x1, dividePoint + x1, y1, y2);
subRegion2 = new MapRegion(dividePoint + x1, x2, y1, y2);
}
return true;
} |
29addbd1-76df-4f26-8764-52aaf5db81cc | 3 | public String getImageForStyle(Map<String, Object> style)
{
String filename = mxUtils.getString(style, mxConstants.STYLE_IMAGE);
if (filename != null && !filename.startsWith("/") && !filename.startsWith("file:/"))
{
filename = imageBasePath + filename;
}
return filename;
} |
8594324b-02c0-4db3-873f-931774d9f411 | 4 | private Dimension findDimension(String dimensionName,
SortedSet<Dimension> dimensions)
throws CorrespondingDimensionNotExistsException {
if (null == dimensionName || "".equals(dimensionName)) {
throw new CorrespondingDimensionNotExistsException();
}
for (Dimension dimension : dimensions) {
if (dimensionName.equals(dimension.getName())) {
return dimension;
}
}
throw new CorrespondingDimensionNotExistsException();
} |
4958c227-7a55-47f8-a42b-e0bb4d8a3031 | 8 | public boolean func_77648_a(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0)
{
return false;
}
if (par7 == 1)
{
return false;
}
byte byte0 = 0;
if (par7 == 4)
{
byte0 = 1;
}
if (par7 == 3)
{
byte0 = 2;
}
if (par7 == 5)
{
byte0 = 3;
}
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
EntityPainting entitypainting = new EntityPainting(par3World, par4, par5, par6, byte0);
if (entitypainting.onValidSurface())
{
if (!par3World.isRemote)
{
par3World.spawnEntityInWorld(entitypainting);
}
par1ItemStack.stackSize--;
}
return true;
} |
2932e262-fdd9-4a4b-901e-470e27e83bbb | 7 | @Override
public void takeInfo(InfoPacket info) throws Exception {
super.takeSuperInfo(info);
Iterator<Pair<?>> i = info.namedValues.iterator();
Pair<?> pair = null;
Label label = null;
while(i.hasNext()){
pair = i.next();
label = pair.getLabel();
switch (label){
case temp:
setTemperature((Double) pair.second());
break;
case pres:
setPressure((Double) pair.second());
break;
case coRL:
setControlRodLevel((Double) pair.second());
break;
case wLvl:
setWaterLevel((Double) pair.second());
break;
default:
// should this do anything by default?
}
}
} |
3642ccd1-68f4-4c5a-9f7f-36880deb5384 | 9 | public static Cons javaTranslateNormalMethodCall(Symbol methodname, Surrogate classtype, Cons allargs) {
{ Slot slot = Stella_Class.lookupSlot(((Stella_Class)(classtype.surrogateValue)), methodname);
MethodSlot methodslot = (((slot != null) &&
Stella_Object.isaP(slot, Stella.SGT_STELLA_METHOD_SLOT)) ? ((MethodSlot)(slot)) : null);
Stella_Object renamed_Object = allargs.value;
Cons operator = Symbol.javaLookupOperatorTable(methodname.softPermanentify());
if ((methodslot != null) &&
MethodSlot.javaMethodObjectIsOverloadedFunctionP(methodslot)) {
return (Cons.javaTranslateFunctionCall(Cons.list$(Cons.cons(Stella.SYM_STELLA_SYS_CALL_FUNCTION, Cons.cons(Symbol.javaCreateOverloadedFunctionName(methodname, classtype), Cons.cons(allargs.concatenate(Stella.NIL, Stella.NIL), Stella.NIL)))), methodslot));
}
if (operator != null) {
return (Cons.javaTranslateOperatorCall(operator, allargs, allargs.length()));
}
else {
return (Cons.list$(Cons.cons(Stella.SYM_STELLA_JAVA_METHOD_CALL, Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_JAVA_IDENT, Cons.cons(GeneralizedSymbol.javaTranslateClassName(Symbol.internSymbolInModule(classtype.symbolName, ((Module)(classtype.homeContext)), false)), Cons.cons(Stella.NIL, Stella.NIL)))), Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_JAVA_IDENT, Cons.cons(((methodslot != null) ? methodslot.javaTranslateMethodName() : Symbol.javaTranslateName(methodname)), Cons.cons(Stella.NIL, Stella.NIL)))), Cons.cons(Stella_Object.javaTranslateATree(renamed_Object), Cons.cons(Cons.cons((((methodslot != null) &&
((!(methodslot.methodReturnTypeSpecifiers().rest() == Stella.NIL)) &&
(allargs.length() <= methodslot.methodParameterNames().length()))) ? Cons.javaTranslateActualParameters(allargs.rest).concatenate(Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_JAVA_MAKE_ARRAY, Cons.cons(StandardObject.javaTranslateTypeSpec(Stella.SGT_STELLA_NATIVE_OBJECT_POINTER), Cons.cons(Cons.cons(IntegerWrapper.wrapInteger(methodslot.methodReturnTypeSpecifiers().length() - 1), Stella.NIL), Stella.NIL)))), Stella.NIL), Stella.NIL) : Cons.javaTranslateActualParameters(allargs.rest)), Stella.NIL), Stella.NIL)))))));
}
}
} |
81fdf116-e989-4067-9da4-e3597e900bdf | 8 | private void initialize() {
setupApplicationLocalData();
resetLastWindowState();
setMargin();
JPanel maincontainer = new JPanel(new BorderLayout());
/*
* top panel
*/
JPanel top = new JPanel(new GridLayout(3, 8));
initComboBoxes();
// OLDDATA
file_input_old.setRenderer(new FileNameListCellRenderer());
top.add(file_input_old);
JButton btn_input_old = new JButton("Datei 1");
top.add(btn_input_old);
top.add(new JLabel("Zeichensatz", SwingConstants.CENTER));
top.add(encoding_old);
top.add(new JLabel("Trennzeichen", SwingConstants.CENTER));
top.add(separator_old);
top.add(new JLabel("Quotes", SwingConstants.CENTER));
top.add(quote_old);
// NEWDATA
file_input_new.setRenderer(new FileNameListCellRenderer());
top.add(file_input_new);
JButton btn_input_new = new JButton("Datei 2");
btn_input_new.setEnabled(file_input_old.getItemCount() > 0);
top.add(btn_input_new);
top.add(new JLabel("Zeichensatz", SwingConstants.CENTER));
top.add(encoding_new);
top.add(new JLabel("Trennzeichen", SwingConstants.CENTER));
top.add(separator_new);
top.add(new JLabel("Quotes", SwingConstants.CENTER));
top.add(quote_new);
// OUTPUTDATA
file_output.setRenderer(new FileNameListCellRenderer());
top.add(file_output);
JButton btn_output = new JButton("Ausgabedatei");
btn_output.setEnabled(file_input_new.getItemCount() > 0);
top.add(btn_output);
top.add(new JLabel("Zeichensatz", SwingConstants.CENTER));
top.add(encoding_out);
top.add(new JLabel("Trennzeichen", SwingConstants.CENTER));
top.add(separator_out);
top.add(new JLabel("Quotes", SwingConstants.CENTER));
top.add(quote_out);
Component[] dependingComponents = {btn_input_new, file_input_new};
btn_input_old.addActionListener(new ChooseFileActionListener(this, file_input_old, false, dependingComponents));
Component[] dependingComponents2 = {btn_output, file_output};
btn_input_new.addActionListener(new ChooseFileActionListener(this, file_input_new, false, dependingComponents2));
btn_output.addActionListener(new ChooseFileActionListener(this, file_output, true));
maincontainer.add(top, BorderLayout.NORTH);
/*
* log panel
*/
JScrollPane log_scroll = new JScrollPane(this.log);
maincontainer.add(log_scroll, BorderLayout.CENTER);
/*
* bottom panel
*/
JButton start = new JButton("Beginne den Abgleich");
start.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
process();
} catch (IOException e1) {
addlog("Fehler: "+e1.getMessage());
}
}
});
maincontainer.add(start, BorderLayout.SOUTH);
final DefaultListModel mymodel = new DefaultListModel();
mymodel.addElement("dupchecked=1");
moreOutput.setModel(mymodel);
moreOutput.setToolTipText("Double click to add more fields for output file; key=value");
moreOutput.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) {
String result = JOptionPane.showInputDialog(moreOutput, "New key value pair:");
if (result != null && !result.equalsIgnoreCase("")) {
mymodel.addElement(result);
}
e.consume();
} else if (e.getButton() == MouseEvent.BUTTON3) {
if (moreOutput.getSelectedIndex() != -1) {
if (JOptionPane.showConfirmDialog(separator_new, "Delete '"+moreOutput.getSelectedValue()+"'") == JOptionPane.YES_OPTION) {
mymodel.remove(moreOutput.getSelectedIndex());
}
}
e.consume();
}
}
});
// JScrollPane field_scroll = new JScrollPane(this.moreOutput);
//maincontainer.add(field_scroll, BorderLayout.EAST);
/*
* init overall panel
*/
add(maincontainer, BorderLayout.CENTER);
this.getContentPane().addHierarchyBoundsListener(new WindowPropertyChangeListener(this));
this.addWindowStateListener(new WindowPropertyChangeListener(this));
this.addWindowListener(new WindowClosingAdapter(this));
} |
b8b53aa6-1698-4e68-a256-b2795ec459d4 | 6 | @Override
public boolean equals(Object other) {
if(other == null) {
return false;
}
if(other == this) {
return true;
}
byte[] hashedpw = null;
if(other instanceof HashedPassword) {
hashedpw = ((HashedPassword) other).getHashedPassword();
} else if (other instanceof byte[]) {
hashedpw = (byte[]) other;
} else if (other instanceof String) {
hashedpw = ((String) other).getBytes();
}
return hashedpw != null && MessageDigest.isEqual(hashedPassword, hashedpw);
} |
cd432d92-69f5-45fb-89ca-8760b4d6c3e3 | 1 | public int getLeapAmount(long millis) {
return isLeap(millis) ? 1 : 0;
} |
7d191276-fb0b-457f-a32d-b5cd8ae79b76 | 9 | public void read(IntReader reader) throws IOException {
mChunkSize = reader.readInt();
mStringsCount = reader.readInt();
mStylesCount = reader.readInt();
mEncoder = reader.readInt();//utf-8 or uft16
mStrBlockOffset =reader.readInt();
mStyBlockOffset =reader.readInt();
if(mStringsCount > 0){
mPerStrOffset = reader.readIntArray(mStringsCount);
mStrings = new ArrayList<String>(mStringsCount);
}
if(mStylesCount > 0){
mPerStyOffset = reader.readIntArray(mStylesCount);
mStyles = new ArrayList<Style>();
}
//read string
if(mStringsCount >0){
int size = ((mStyBlockOffset == 0)?mChunkSize:mStyBlockOffset) - mStrBlockOffset;
byte[] rawStrings = reader.readByteArray(size);
for(int i =0; i < mStringsCount ; i++){
int offset = mPerStrOffset[i];
short len = toShort(rawStrings[offset], rawStrings[offset+1]);
mStrings.add(i,new String(rawStrings,offset+2, len*2, Charset.forName("UTF-16LE")));
}
}
//read styles
if(mStylesCount > 0){
int size = mChunkSize - mStyBlockOffset;
int[] styles = reader.readIntArray(size/4);
for(int i = 0; i< mStylesCount; i++){
int offset = mPerStyOffset[i];
int j = offset;
for(; j< styles.length; j++){
if(styles[j] == -1) break;
}
int[] array = new int[j-offset];
System.arraycopy(styles, offset, array, 0, array.length);
Style d = Style.parse(array);
mStyles.add(d);
}
}
} |
8f07c40c-7a38-4d7b-ac51-535ecf3095fd | 6 | private static Platform getPlatform() {
if(m_os == null) {
String os = System.getProperty("os.name").toLowerCase();
m_os = Platform.unsupported;
if(os.indexOf("win") >= 0) m_os = Platform.Windows; // Windows
if(os.indexOf("mac") >= 0) m_os = Platform.Mac; // Mac
if(os.indexOf("nux") >= 0) m_os = Platform.Unix; // Linux
if(os.indexOf("nix") >= 0) m_os = Platform.Unix; // Unix
if(os.indexOf("sunos") >= 0) m_os = Platform.Solaris; // Solaris
}
return m_os;
} |
3f8d822c-e47f-45ef-b66f-98271a0350cb | 0 | public void setSide(int s)
{
side = s;
} |
034650c3-92a9-41bd-a71b-2f35728cb2e0 | 2 | public boolean setRole(int role) {
if (role != ROLE_SERVER || role != ROLE_CLIENT) {
this.role = role;
saveToFile();
return true;
}
return false;
} |
4f42fd96-08a8-4fec-90f3-49f673e7df70 | 6 | public void init(Sag sag) {
setSag(sag);
cpr_textField.setText(this.sag.getPerson().getCpr());
cpr_textField.setEnabled(false);
sagssted_textField.setText(this.sag.getSagsSted());
fornavn_textField.setText(this.sag.getPerson().getFornavn());
fornavn_textField.setEnabled(false);
mellemnavn_textField.setText(this.sag.getPerson().getMellemnavn());
mellemnavn_textField.setEnabled(false);
efternavn_textField.setText(this.sag.getPerson().getEfternavn());
efternavn_textField.setEnabled(false);
paragraf_textField.setText(this.sag.getParagraf());
paragraf_textField.setForeground(Color.black);
foranstaltningsnavn_textField.setText(this.sag.getForanstaltningsnavn());
beskrivelse_textArea.setText(this.sag.getBeskrivelse());
periodeFra_textField.setText(String.valueOf(this.sag.getPeriodeFra()));
periodeFra_textField.setForeground(Color.BLACK);
periodeTil_textField.setText(String.valueOf(this.sag.getPeriodeTil()));
periodeTil_textField.setForeground(Color.black);
switch (this.sag.getAer()) {
case 0:
aerNej_radioButton.setSelected(true);
aerJa_radioButton.setSelected(false);
break;
case 1:
aerNej_radioButton.setSelected(false);
aerJa_radioButton.setSelected(true);
break;
}
switch (this.sag.getSagstype()) {
case 1:
sagstypeSocialsag_radioButton.setSelected(true);
sagstypeHandicapsag_radioButton.setSelected(false);
sagstypeFlygtningerefusion_radioButton.setSelected(false);
sagstypeMellmkommunal_radioButton.setSelected(false);
break;
case 2:
sagstypeSocialsag_radioButton.setSelected(false);
sagstypeHandicapsag_radioButton.setSelected(true);
sagstypeFlygtningerefusion_radioButton.setSelected(false);
sagstypeMellmkommunal_radioButton.setSelected(false);
break;
case 3:
sagstypeSocialsag_radioButton.setSelected(false);
sagstypeHandicapsag_radioButton.setSelected(false);
sagstypeFlygtningerefusion_radioButton.setSelected(true);
sagstypeMellmkommunal_radioButton.setSelected(false);
break;
case 4:
sagstypeSocialsag_radioButton.setSelected(false);
sagstypeHandicapsag_radioButton.setSelected(false);
sagstypeFlygtningerefusion_radioButton.setSelected(false);
sagstypeMellmkommunal_radioButton.setSelected(true);
break;
}
betalingCPR_textField.setText(this.sag.getBetaler().getBetalingCPR());
betalingNavn_textField.setText(this.sag.getBetaler().getBetalingNavn());
betalingNavn_textField.setEnabled(false);
betalingBelob_textField.setText(String.valueOf(this.sag.getBetalingBelob()));
} |
4b07b5b3-e0bb-4f49-aad8-93bff48f9adc | 9 | private boolean gotoNextValidMatrixCell() {
do {
dz++;
if(dz > 2) {
dz = 0; dy++;
}
if(dy > 2) {
dy = 0; dx++;
}
if(dx > 2) {
return false; // we have visited all neighboring matrix cells
}
} while(ox + dx < 0 || oy + dy < 0 || oz + dz < 0 ||
ox + dx >= numX || oy + dy >= numY || oz + dz >= numZ);
iterator = list[ox + dx][oy + dy][oz + dz].iterator(); // get new iterator
return true;
} |
5889be48-a1c9-4ddd-b7ed-7a482e0d2a21 | 0 | public Position getDestination(){
return new Position(start.getY() + vertical, start.getX() + horizontal);
} |
9e72839c-71b2-4b0a-a1b8-8f8ad22ec3c8 | 3 | public void readTable(Map table) {
Identifier rep = getRepresentative();
if (!rep.wasAliased) {
String newAlias = (String) table.get(getFullName());
if (newAlias != null) {
rep.wasAliased = true;
rep.setAlias(newAlias);
}
}
for (Iterator i = getChilds(); i.hasNext();)
((Identifier) i.next()).readTable(table);
} |
fa2719c8-cd35-41ed-b7ef-614c25c22f0c | 0 | public CrossJoinIterator(Iterable<T> first, Iterable<TInner> second, Joint<T, TInner, TResult> joint)
{
this._first = first.iterator();
this._second = second;
this._joint = joint;
} |
b48c6fb4-b30a-479e-be01-ebe554eb02bb | 7 | private int checkDay(int testDay) {
if(testDay > 0 && testDay <= daysPerMonth[month])
return testDay;
if(month == 2 && testDay == 29 && (year %400 == 0 ||
(year % 4 == 0 && year %100 != 0)))
return testDay;
throw new IllegalArgumentException(
"Day out-of-range for the specified month and year");
} |
e6edcb78-522d-4770-a73f-7aadea32359e | 8 | private String csvEncode(String text)
{
if(text==null)
return "null";
String encoded="";
boolean hasSpecialChar=false;
int length=text.length();
if (length>0) {
for(int i=0;i<length;i++) {
char ch=text.charAt(i);
if(ch==',' || ch=='"') {
hasSpecialChar=true;
continue;
}
}
if(hasSpecialChar) {
encoded="\"";
for(int i=0;i<length;i++) {
char ch=text.charAt(i);
if( ch=='"')
encoded+="\"";
encoded+=ch;
}
encoded+="\"";
}
else
return text;
}
return encoded;
} |
27223cac-c971-44e6-b35f-11821ddcefbe | 9 | @Override
public PackageDoc containingPackage() {
PackageDocImpl p = env.getPackageDoc(tsym.packge());
if (p.setDocPath == false) {
FileObject docPath;
try {
Location location = env.fileManager.hasLocation(StandardLocation.SOURCE_PATH)
? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH;
docPath = env.fileManager.getFileForInput(
location, p.qualifiedName(), "package.html");
} catch (IOException e) {
docPath = null;
}
if (docPath == null) {
// fall back on older semantics of looking in same directory as
// source file for this class
SourcePosition po = position();
if (env.fileManager instanceof StandardJavaFileManager &&
po instanceof SourcePositionImpl) {
URI uri = ((SourcePositionImpl) po).filename.toUri();
if ("file".equals(uri.getScheme())) {
File f = new File(uri);
File dir = f.getParentFile();
if (dir != null) {
File pf = new File(dir, "package.html");
if (pf.exists()) {
StandardJavaFileManager sfm = (StandardJavaFileManager) env.fileManager;
docPath = sfm.getJavaFileObjects(pf).iterator().next();
}
}
}
}
}
p.setDocPath(docPath);
}
return p;
} |
eabf70f1-ff4a-4ec7-bc3f-e599de50c888 | 7 | public ArrayList<String> cbEncarregado() throws SQLException {
ArrayList<String> Encaregado = new ArrayList<>();
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_SELECT_TODOS_ENCARREGADO);
comando.setString(1, "Encarregado");
resultado = comando.executeQuery();
Encaregado.removeAll(Encaregado);
while (resultado.next()) {
Encaregado.add(resultado.getString("NOME"));
}
conexao.commit();
} catch (Exception e) {
if (conexao != null) {
conexao.rollback();
}
throw new RuntimeException(e);
} finally {
if (comando != null && !comando.isClosed()) {
comando.close();
}
if (conexao != null && !conexao.isClosed()) {
conexao.close();
}
}
return Encaregado;
} |
0d54c539-f1f0-4e9e-b3df-65f72aa4fa54 | 7 | public void decrypt(InputStream in, OutputStream out)
throws IOException
{
byte inbuf[] = new byte[8];
byte outbuf[] = new byte[8];
byte tmpbuf[] = new byte[8];
byte tmp[];
boolean done = false;
int n = readn(in, inbuf, 8);
while (n == 8) {
tmp = tmpbuf;
tmpbuf = outbuf;
outbuf = tmp;
n = readn(in, inbuf, 8);
if (n < 8)
break;
DES.des_ecb_encrypt(inbuf, tmpbuf, schedule, false);
out.write(outbuf, 0, 8);
}
if (n > 0)
throw new IOException("input file length wrong");
int m = outbuf[7];
if (m > 0 && m <= 7)
out.write(outbuf, 0, outbuf[7]);
if (m < 0 || m > 7)
throw new IOException("input file format error");
} |
3a25f226-2e50-4e51-a784-c3b1a77569ea | 3 | private static int[] sumOfBinaryString(String binary) {
char[] bin = binary.toCharArray();
int[] derp = new int[bin.length];
for (int i = 0; i < bin.length; i++) {
if (bin[i] == '0') {
derp[i] = 0;
} else if (bin[i] == '1') {
derp[i] = binary(bin.length - i - 1);
} else {
throw new NullPointerException(
"The String must contain only '0' or '1'");
}
}
return derp;
} |
0245ee80-a186-4b7f-b315-4277fef5cb81 | 9 | private void reportTypeChanged(){
hideSelectors();
option = current.isSelected() ? 6 : group.isSelected() ? 2 : teacher.isSelected() ? 3 :
daycare.isSelected() ? 4 : club.isSelected() ? 5 :7;
switch(option){
case 2:
fillGroupSelector();
break;
case 3:
fillTeacherSelector();
break;
case 4:
fillDaycareSelector();
break;
case 5:
fillClubSelector();
break;
}
} |
32083600-0010-44c4-b7a4-0fbbfee09a9f | 2 | public void fireWeaponListener(long id) {
GameActor actor = mainLogic.getActor(id);
if(actor != null) {
WeaponsComponent wc = (WeaponsComponent)actor.getComponent("WeaponsComponent");
if(wc != null) {
wc.fire();
}
}
} |
d44f41c2-0425-4a1d-902e-d536b90e0476 | 9 | private Collection createList()
throws IOException
{
Collection list = null;
if (_type == null)
list = new ArrayList();
else if (! _type.isInterface()) {
try {
list = (Collection) _type.newInstance();
} catch (Exception e) {
}
}
if (list != null) {
}
else if (SortedSet.class.isAssignableFrom(_type))
list = new TreeSet();
else if (Set.class.isAssignableFrom(_type))
list = new HashSet();
else if (List.class.isAssignableFrom(_type))
list = new ArrayList();
else if (Collection.class.isAssignableFrom(_type))
list = new ArrayList();
else {
try {
list = (Collection) _type.newInstance();
} catch (Exception e) {
throw new IOExceptionWrapper(e);
}
}
return list;
} |
ecde2b59-214c-408c-b972-4f2fe5fa9ded | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the server with glorious data
task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
private boolean firstPost = true;
public void run() {
try {
// This has to be synchronized or it can collide with the disable method.
synchronized (optOutLock) {
// Disable Task, if it is running and the server owner decided to opt-out
if (isOptOut() && task != null) {
task.cancel();
task = null;
// Tell all plotters to stop gathering information.
for (Graph graph : graphs) {
graph.onOptOut();
}
}
}
// We use the inverse of firstPost because if it is the first time we are posting,
// it is not a interval ping, so it evaluates to FALSE
// Each time thereafter it will evaluate to TRUE, i.e PING!
postPlugin(!firstPost);
// After the first post we set firstPost to false
// Each post thereafter will be a ping
firstPost = false;
} catch (IOException e) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
}
}
}
}, 0, PING_INTERVAL * 1200);
return true;
}
} |
aa501010-7ae4-437e-addf-268bfb8a3904 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof HighLowRenderer)) {
return false;
}
HighLowRenderer that = (HighLowRenderer) obj;
if (this.drawOpenTicks != that.drawOpenTicks) {
return false;
}
if (this.drawCloseTicks != that.drawCloseTicks) {
return false;
}
if (!PaintUtilities.equal(this.openTickPaint, that.openTickPaint)) {
return false;
}
if (!PaintUtilities.equal(this.closeTickPaint, that.closeTickPaint)) {
return false;
}
if (this.tickLength != that.tickLength) {
return false;
}
if (!super.equals(obj)) {
return false;
}
return true;
} |
d57a3385-b443-4eee-9abc-3f9d40a6b7b3 | 5 | public boolean update(Client client) {
//Получаем текущий обьект по usersId
int usersId = client.getUsersId();
Client curClient;
if ((curClient = getByUsersId(usersId)) == null) {
//Если обьекта не существует - обновлять нечего
return false;
} else {
//Обновляем запись
Statement statement = null;
ResultSet result = null;
try {
//Создаем обновляемую выборку
statement = getConnection().createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
//Получаем выборку таблицы
result = statement.executeQuery(allQuery);
//Находим необходимую запись по id
while (result.next()) {
//Если находим запись - выход из цикла
if (result.getInt("ID") == curClient.getId()) {
break;
}
}
//Обновляем запись
result.updateString("CLIENTFIO", client.getFio());
result.updateString("CLIENTADR", client.getAddress());
result.updateString("CLIENTPAS", client.getPassport());
result.updateString("CLIENTIDCOD", client.getIdCod());
result.updateString("CLIENTTEL", client.getTel());
result.updateLong("CLIENTLEVEL", client.getLevel());
result.updateString("CLIENTWORKINFO", client.getWorkInfo());
//result.updateInt("SURETYID", client.getSuretyId());
result.updateInt("USERSID", client.getUsersId());
//Фиксируем изменения
result.updateRow();
} catch (SQLException exc) {
System.out.println("Ошибка при обновлении данных");
} finally {
try {
statement.close();
result.close();
} catch (SQLException exc) {
System.out.println("Ошибка при закрытии соединения");
}
}
}
//Обновляем список обьектов
getList().clear();
setList(listAll());
return true;
} |
71d747ed-119e-4179-a0f9-f41e6e2290a4 | 3 | private void rotate() {
if (isOpen()) {
crossRotate.setFromAngle(0);
crossRotate.setToAngle(radialMenu.getOptions().isSimpleMode() ? -45 : -135);
} else {
crossRotate.setFromAngle(radialMenu.getOptions().isSimpleMode() ? -45 : -135);
crossRotate.setToAngle(0);
}
crossRotate.play();
} |
e4b857a3-b99a-479f-97ec-e165889a5bcf | 3 | @Override
public void handleCollision(Actor other) {
// Don't collide with our siblings
if(other instanceof FlakShell && ((FlakShell) other).parentId.equals(getParentId()))
return;
// Don't shoot our parents
if (parentId.equals(other.getId()))
return;
detonate();
die();
} |
749667b5-8ce4-4212-be3a-bec53d928fd5 | 9 | private Header readHeader(DataInputStream ins) {
Header out = new Header();
try {
byte[] oldInput = new byte[3];
oldInput[0]=0;
oldInput[1]=0;
oldInput[2]=0;
byte input = 0;
input = ins.readByte();
int bufferSize = 0;
byte[] buffer = new byte[BUFFER_SIZE];
StringBuffer line = new StringBuffer();
while(!isBreakEnd(oldInput, input)) {
// Save the read data
buffer[bufferSize] = input;
bufferSize = (bufferSize +1) % BUFFER_SIZE;
if (bufferSize==0) {
out.addRawArray(buffer);
}
// Parse the content
if (isBreak(oldInput, input)) {
String lineStr = line.toString();
if (lineStr.contains(":")) {
// We are not in first line
String [] tokens = lineStr.split(":");
if (tokens[0].toLowerCase().trim().equals("content-length")) {
Long len = Long.parseLong(tokens[1].trim());
out.setContentLength(len);
} else if (tokens[0].toLowerCase().trim().equals("host")) {
out.setHost(tokens[1] + ":" +tokens[2]);
} else if (tokens[0].toLowerCase().equals("transfer-encoding")) {
out.setChunked(tokens[1].toLowerCase().trim().equals("chunked"));
}
} else {
// we are in the first line of HTTP protocol
String [] tokens = lineStr.split(" ");
out.setOperation(tokens[0].trim());
out.setUrl(tokens[1].trim());
out.setPostfix(tokens[2].trim());
}
line = new StringBuffer();
} else {
byte[] aux = new byte[1];
aux[0] = input;
line.append(new String(aux, "UTF-8"));
}
oldInput[0] = oldInput[1];
oldInput[1] = oldInput[2];
oldInput[2] = input;
input = ins.readByte();
}
buffer[bufferSize] = input;
bufferSize = (bufferSize +1) % BUFFER_SIZE;
if (bufferSize==0) {
out.addRawArray(buffer);
} else {
byte []last = new byte[bufferSize];
System.arraycopy(buffer, 0, last, 0, bufferSize);
out.addRawArray(last);
}
} catch (Exception e) {
e.printStackTrace();
}
return out;
} |
7e17d448-514a-4597-9fab-7f4cf34df9cc | 0 | public void setNumber(String value) {
this._numer = value;
} |
9a188783-3b1e-4b8f-9d7e-308bcba6c77c | 6 | public Query<T> reverse()
{
if(this._source instanceof ArrayIterable<?>)
{
ArrayReverseIterable rs = new ArrayReverseIterable(((ArrayIterable<T>)this._source).getSource());
return new Query<T>(rs);
}
else if ((this._source instanceof List<?>) && (this._source instanceof RandomAccess))
{
return new Query<T>( new ReverseIterable((List<T>)this._source));
}
else
{
ArrayList<T> rs = new ArrayList<T>();
for(T element : this._source)
{
rs.add(element);
}
return new Query<T>(rs);
}
} |
1e3da6b4-e671-4284-bf4d-7abe2d48bc6e | 6 | public static List<Integer> search(String text, String pattern){
//only searches for upper case letters
text = text.toUpperCase();
pattern = pattern.toUpperCase();
List<Integer> response = new ArrayList<>();
HashSet<Character> dedup = new HashSet<>();
for( int i = 0; i< pattern.length(); i++){
if(!dedup.contains(pattern.charAt(i))){
dedup.add(pattern.charAt(i));
}
}
int[][] dfa = buildDFA(pattern, dedup);
int i=0;
//this loop is to make sure we keep finding more than one match
// while(i<text.length()){
int j=0;
for( ; i<text.length() && j < pattern.length() ; i++){
//keep looking for the next step.. make sure the chartacter in text is a part of pattern
if(dedup.contains(text.charAt(i))){
j = dfa[text.charAt(i) - 'A'][j];
}
}
//if j has reached the pattern length or last state .. means there is a match
if(j == pattern.length()){
//i-pattern.length() will give the start index from where the match begun
response.add(i-pattern.length());
}
// }
return response;
} |
02abb502-ff0b-45bd-b28f-00bff42506e7 | 2 | private boolean containsVariable(String name) {
for (VariableInformation var : variableList)
if (var.name.equals(name))
return true;
return false;
} |
3129232a-7f79-44c1-b6ff-bfc5f1c1789e | 3 | public static void update() {
ArrayList<AppWindow> windows = AppWindow.getAllWindows();
Collections.sort(windows);
for (AppWindow window : windows) {
JMenu windowMenu = StdMenuBar.findMenuByName(window.getJMenuBar(), NAME);
if (windowMenu != null) {
windowMenu.removeAll();
for (AppWindow one : windows) {
windowMenu.add(new JCheckBoxMenuItem(new SwitchToWindowCommand(one)));
}
}
}
} |
be10b542-09fc-44df-bfe1-99b48ea06c00 | 1 | public boolean distributionStrategy(int[] bowl) {
predictDistribution();
double expectedScore = calculateExpectedScore();
// Take a bowl greater than your expected score based on the distribution
if (bowlScore(bowl) > expectedScore + calculateThreshold())
return true;
return false;
} |
1259b3b6-2f05-413a-ac62-5a618c9fdedc | 0 | public SignatureType createSignatureType() {
return new SignatureType();
} |
ecf804fc-b070-4b45-9aca-e29125ff8723 | 9 | public State_Sense(String[] tokens) {
super(E_Instruction.SENSE);
if (tokens.length == 5 || tokens.length == 6) {
// Variable number of tokens!
senseDir = tokenToSenseDirection(tokens[1]);
state1 = tokenToState(tokens[2]);
state2 = tokenToState(tokens[3]);
condition = tokenToCondition(tokens[4]);
if (tokens.length == 6) {
// Marker numbers - have added these to condition enums which seems to make sense
switch (tokens[5])
{
case "0": condition = E_Condition.MARKER0; break;
case "1": condition = E_Condition.MARKER1; break;
case "2": condition = E_Condition.MARKER2; break;
case "3": condition = E_Condition.MARKER3; break;
case "4": condition = E_Condition.MARKER4; break;
case "5": condition = E_Condition.MARKER5; break;
default: Main.error("Unknown marker number: " + tokens[5]);
}
}
} else {
// Throw an error.
checkCorrectNumberOfTokens(5, tokens.length);
}
} |
1a46fa27-1689-45fd-9548-beda35ab6fbc | 5 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Developer) {
Developer other = (Developer) obj;
return Objects.equals(firstName, other.firstName)
&& Objects.equals(lastName, other.lastName)
&& Objects.equals(age, other.age)
&& Objects.equals(programmingLanguages, other.programmingLanguages);
}
return false;
} |
80dac2ab-437e-47cc-ad05-7ea9833b0656 | 3 | static void checkClassSignature(final String signature) {
// ClassSignature:
// FormalTypeParameters? ClassTypeSignature ClassTypeSignature*
int pos = 0;
if (getChar(signature, 0) == '<') {
pos = checkFormalTypeParameters(signature, pos);
}
pos = checkClassTypeSignature(signature, pos);
while (getChar(signature, pos) == 'L') {
pos = checkClassTypeSignature(signature, pos);
}
if (pos != signature.length()) {
throw new IllegalArgumentException(signature + ": error at index "
+ pos);
}
} |
c290987c-9a30-4b6e-9092-9da6bc7f4cef | 9 | void updateFrom(int sender) {
int changes = 0;
for (int level=0; level<maxLevel; level++) {
for (int zip=0; zip<maxOrder; zip++) {
int[] offer = station[sender].promise[level];
if (offer[zip] != 0) {
// known region
if (offer[zip] < delay[level][zip] || route[level][zip] == sender) {
// better offer or current dest
if (station[sender].route[level][zip] != nodeNum) {
// no flip
if (delay[level][zip] != offer[zip])
changes++;
delay[level][zip] = offer[zip];
route[level][zip] = sender;
}
}
}
}
if (station[sender].zip[level] != zip[level]) {
break;
}
}
if (changes > 0) {
// trace ("update from", station[sender], new Integer(changes));
scheduleUpdate();
}
} |
46371f0e-fa40-40d0-9963-dfc27db90aa5 | 1 | public boolean isArityAvailiable(int a) {
return a >= lowBoundArity && a <= highBoundArity;
} |
751e16a3-dde1-44cf-ac7d-68bb29f04a34 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TStok other = (TStok) obj;
if (!Objects.equals(this.itemCode, other.itemCode)) {
return false;
}
return true;
} |
82ac8f53-78ac-4aac-8ef2-9faa37de9d47 | 1 | public List<User> getAllUsers() {
List<User> users = null;
try {
beginTransaction();
users = session.createCriteria(User.class).list();
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSession();
}
return users;
} |
6463ac5e-20be-4690-bdf9-ec7c1608ee2c | 4 | @Override
public void update(String msg) {
char ch = msg.charAt(0);
int i = Integer.valueOf(String.valueOf(ch));
switch (i) {
case 1:
System.out.println(getClass().getName() + "说:天籁啊,真是!");
break;
case 2:
System.out.println(getClass().getName() + "说:好风骚啊!");
break;
case 3:
System.out.println(getClass().getName() + "说:要不要这么牛啊!");
break;
case 4:
System.out.println(getClass().getName() + "说:去,要掉节操!");
break;
default:
System.out.println(getClass().getName() + "说:好无聊!");
break;
}
} |
d49f20fc-90c5-4c66-ae88-8a69a480be2b | 2 | public void resume() {
if (!paused) {
play();
return;
}
paused = false;
synchronized (player) {
if (player != null) {
player.notify();
}
}
setGain(oldGain);
} |
db2c4ef7-3931-4faa-9893-06f753d39e69 | 8 | private void method98(Entity entity)
{
if(entity.anInt1548 == loopCycle || entity.anim == -1 || entity.anInt1529 != 0 || entity.anInt1528 + 1 > Animation.anims[entity.anim].method258(entity.anInt1527))
{
int i = entity.anInt1548 - entity.anInt1547;
int j = loopCycle - entity.anInt1547;
int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
entity.x = (k * (i - j) + i1 * j) / i;
entity.y = (l * (i - j) + j1 * j) / i;
}
entity.anInt1503 = 0;
if(entity.anInt1549 == 0)
entity.turnDirection = 1024;
if(entity.anInt1549 == 1)
entity.turnDirection = 1536;
if(entity.anInt1549 == 2)
entity.turnDirection = 0;
if(entity.anInt1549 == 3)
entity.turnDirection = 512;
entity.anInt1552 = entity.turnDirection;
} |
d50c140c-b82f-4806-bbcd-4c980bcbefa5 | 5 | private void mergeParts(int lowerIndex, int middle, int higherIndex) {
for (int i = lowerIndex; i <= higherIndex; i++) {
tempMergArr[i] = array[i];
}
int i = lowerIndex;
int j = middle + 1;
int k = lowerIndex;
while (i <= middle && j <= higherIndex) {
if (tempMergArr[i] <= tempMergArr[j]) {
array[k] = tempMergArr[i];
i++;
} else {
array[k] = tempMergArr[j];
j++;
}
k++;
}
while (i <= middle) {
array[k] = tempMergArr[i];
k++;
i++;
}
} |
f5155c66-f441-48d2-b9f7-38ab9812d217 | 1 | public SubmissionView(int mode, final ClientView cv,
SubmissionTableModel model) {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
JScrollPane scrollPane = new JScrollPane();
// If client
if (mode == AS_CLIENT) {
// Show submit button
btnSubmitCode = new JButton("Submit Code");
btnSubmitCode.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// Show the submit form
cv.submitMode(true);
}
});
btnSubmitCode.setAlignmentX(Component.CENTER_ALIGNMENT);
add(btnSubmitCode);
}
table = new JTable();
table.setModel(model);
scrollPane.getViewport().add(table, null);
add(scrollPane);
} |
d39fe73f-a8d8-4743-a1e8-e47535c2edda | 8 | static void initializePlatform(){
OperatingSystem os = OSDetector.detectOS();
if (os.equals(OperatingSystem.WINDOWS)) platform = new WindowsCommands();
else if (os.equals(OperatingSystem.MAC_OS)) platform = new MacOSCommands();
else if (os.equals(OperatingSystem.LINUX_GNOME))platform = new LinuxGnomeCommands();
else if (os.equals(OperatingSystem.LINUX_KDE)) platform = new LinuxKdeCommands();
else if (os.equals(OperatingSystem.LINUX_LXDE)) platform = new LinuxLxdeCommands();
else if (os.equals(OperatingSystem.LINUX_XFCE)) platform = new LinuxXfceCommands();
else if (os.equals(OperatingSystem.LINUX_UNKNOWN)) platform = new LinuxUnknownCommands();
else if (os.equals(OperatingSystem.UNKNOWN)) platform = new UnknownOSCommands();
} |
515bdef8-c838-4592-8834-b96e3a201cae | 2 | private void writeFrameType(final Object type) {
if (type instanceof String) {
stackMap.putByte(7).putShort(cw.newClass((String) type));
} else if (type instanceof Integer) {
stackMap.putByte(((Integer) type).intValue());
} else {
stackMap.putByte(8).putShort(((Label) type).position);
}
} |
1c7765de-fe3f-4a6d-a3a1-6ac02ace5620 | 7 | public void fish() {
if (!Players.getLocal().isMoving()
&& Players.getLocal().getAnimation() != 621) {
Time.sleep(1000);
if (!Players.getLocal().isMoving()
&& Players.getLocal().getAnimation() != 621) {
status = "Fishing";
NPC bob = NPCs.getNearest(327);
if (bob.isOnScreen()) {
bob.interact("Net");
} else {
Camera.turnTo(bob);
}
Time.sleep(3000);
}
} else {
if (rand.nextInt(300) == 1) {
antiBan.run();
}else{
if(rand.nextInt(2)==2){
Tabs.STATS.open();
Widgets.get(320,34).hover();
Time.sleep(3000+rand.nextInt(5000));
}
}
}
} |
cafd2760-c68f-4507-98dc-8062f28f41e2 | 1 | public static DBConnectionProperties getInstance() throws IOException {
if (instance == null) {
instance = new DBConnectionProperties();
}
return instance;
} |
feaf7305-f8b3-4f9c-aa24-bf5af52e4177 | 4 | private void writeToStream(String message)
{
if (!sock.isConnected() || sock.isClosed() || out == null)
return;
byte[] sizeinfo = new byte[4];
byte[] data = message.getBytes();
ByteBuffer bb = ByteBuffer.allocate(sizeinfo.length);
bb.putInt(message.getBytes().length);
try
{
out.write(bb.array());
out.write(data);
out.flush();
}
catch (Exception ex)
{
ex.printStackTrace();
}
} |
80bf0104-ae0d-484e-9e57-75b3c761063e | 4 | public void adicionaPreferenciaDisciplina(Disciplina d, int nivelPreferencia)
throws PreferenciaInvalidaException {
switch (nivelPreferencia) {
case 1:
this.listaDisciplinasP1.add(d);
break;
case 2:
this.listaDisciplinasP2.add(d);
break;
case 3:
this.listaDisciplinasP3.add(d);
break;
case 4:
this.listaDisciplinasNP.add(d);
break;
default:
throw new PreferenciaInvalidaException(
"Adiciona Preferencia ERRO!!!");
}
} |
9e5b2ff7-5ad3-4c18-a582-31d4b078d7d3 | 9 | public static Collection<Method> getDeclaredMethods(Class<?> clazz) {
Reference<Collection<Method>> ref = declaredMethods.get(clazz);
Collection<Method> list;
if (ref != null) {
list = ref.get();
if (list != null)
return list;
}
Map<Signature, Method> signatureMethod = new LinkedHashMap<Signature, Method>();
while (clazz != null) {
Method[] methods = clazz.isInterface() ? clazz.getMethods() : clazz.getDeclaredMethods();
for (Method method : methods) {
Signature signature = new Signature(method);
if (method.isSynthetic() || method.isBridge() || signatureMethod.containsKey(signature))
continue;
signatureMethod.put(signature, method);
}
clazz = clazz.getSuperclass();
}
declaredMethods.put(clazz, new WeakReference<Collection<Method>>(list = signatureMethod.values()));
return list;
} |
77612b30-d2de-4dcf-955d-60f4d167ad9b | 6 | private static void doQuery()
{
try {
String databaseName = "mytest";
for(int i = 0; i < 100; ++i) {
IMySQLConnection conn = MySQLService.getConnection(databaseName);
if(conn == null) {
System.out.println("conn == null");
}
for(int j = 0; j < 100; ++j) {
conn.executeQuery("SELECT * FROM location");
conn.resultSetNext();
try { sleep(100); } catch(InterruptedException ex) {};
/*String result = */ conn.getResultSetString("name");
//System.out.println(result);
/*
for(int k = 0; k < 100000000; ++k) {
for(int l = 0; l < 1000000; ++l) {
}
}
*/
}
conn = null;
}
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (MySQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
2e788072-97f6-49fa-becc-9405cf233b8a | 3 | public static void main(String[] args) {
// TODO Auto-generated method stub
String start = "qa";
String end = "sq";
String[] dicts = { "si", "go", "se", "cm", "so", "ph", "mt", "db",
"mb", "sb", "kr", "ln", "tm", "le", "av", "sm", "ar", "ci",
"ca", "br", "ti", "ba", "to", "ra", "fa", "yo", "ow", "sn",
"ya", "cr", "po", "fe", "ho", "ma", "re", "or", "rn", "au",
"ur", "rh", "sr", "tc", "lt", "lo", "as", "fr", "nb", "yb",
"if", "pb", "ge", "th", "pm", "rb", "sh", "co", "ga", "li",
"ha", "hz", "no", "bi", "di", "hi", "qa", "pi", "os", "uh",
"wm", "an", "me", "mo", "na", "la", "st", "er", "sc", "ne",
"mn", "mi", "am", "ex", "pt", "io", "be", "fm", "ta", "tb",
"ni", "mr", "pa", "he", "lr", "sq", "ye" };
Set<String> dict = new HashSet<String>();
for (int i = 0; i < dicts.length; i++) {
dict.add(dicts[i]);
}
List<List<String>> res = findLadders(start, end, dict);
for (List<String> l : res) {
for (String s : l) System.out.print(s + " ");
System.out.println();
}
} |
37c93916-b6e0-4c9f-933e-8bffbb90139e | 3 | public void preprocess() {
File file = new File(path);
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(file));
String line;
while((line = reader.readLine()) != null) {
String word = line.toLowerCase();
maxWordLength = Math.max(maxWordLength, word.length());
trie.add(word);
sortedTrie.add(sort(word));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} |
5c08b1f6-1ad7-4f66-a2c9-96c5c8907e29 | 0 | public float getSaldo() {
return saldo;
} |
bb8278ef-157d-483d-bf38-58cc3bbe3cf8 | 0 | public static byte[] encryptHMAC(byte[] data, String key)
throws IOException, NoSuchAlgorithmException, InvalidKeyException {
SecretKey secretKey = new SecretKeySpec(base64Decoder(key), KEY_MAC);
Mac mac = Mac.getInstance(secretKey.getAlgorithm());
mac.init(secretKey);
return mac.doFinal(data);
} |
89182ab6-1861-4c9b-a2a8-b52368a2f8d1 | 0 | public void pause() {isPaused = true;} |
a11ecc2d-97ab-4ace-9436-d3c523c146da | 1 | public boolean retirar(float cantidad) {
if(cantidad+cantidad*this.penalizacion<=saldo){
saldo-=cantidad+cantidad*this.penalizacion;
return true;
}else{
return false;
}
} |
a1fd2f32-4d2e-4deb-8897-c5778966cc50 | 1 | public static ArrondissementVilleDAO getInstance(Connection conn) {
if (instance == null) {
instance = new ArrondissementVilleDAO(conn);
}
return instance;
} |
b0be5a84-fa4e-4bc1-8828-1f0c2c8f58e5 | 6 | public void playSound(int i) {
if (Settings.GLOBAL_SOUND) {
if (i == 0) {
sound = Gdx.audio.newSound(Gdx.files.internal("data/big_shot.mp3"));
thread.run();
}
if (i == 1) {
sound = Gdx.audio.newSound(Gdx.files.internal("data/explode.mp3"));
thread.run();
}
if (i == 2) {
music.play();
music.isLooping();
}
if (i == 3) {
sound = Gdx.audio.newSound(Gdx.files.internal("data/book_close.mp3"));
thread2.run();
}
if (i == 4) {
sound = Gdx.audio.newSound(Gdx.files.internal("data/book_page_turn.mp3"));
thread2.run();
}
}
} |
e5b57c9d-dd43-4040-825c-19b8ebf335d5 | 8 | public LinkedList<Personnage> calculerCibles(int x, int y, int portee){
LinkedList<Personnage> res = new LinkedList<Personnage>(); // stocke le résultat final
// On inspecte la verticale et l'horizontale, en ne regardant pas la case où l'on se trouve
// à gauche de la case
for(int i=(x-portee); i<x; i++){
if(joueurCourant.getPerso(i, y) != null){
res.add(joueurCourant.getPerso(i,y));
}
}
// à droite de la case
for(int i=(x+1); i<(x+portee+1); i++){
if(joueurCourant.getPerso(i, y) != null){
res.add(joueurCourant.getPerso(i,y));
}
}
// en haut de la case
for(int j=(y+1); j<(y+portee+1); j++){
if(joueurCourant.getPerso(x, j) != null){
res.add(joueurCourant.getPerso(j,y));
}
}
// en bas de la case
for(int j=(y-portee); j<y; j++){
if(joueurCourant.getPerso(x, j) != null){
res.add(joueurCourant.getPerso(j,y));
}
}
return res;
} |
9960e52c-9a1e-4f56-8724-bc070b377764 | 4 | private void splitPlayerHashMap(GameData gameData) {
if (gameData != null && gameData.playerData != null) {
String[] keys = new String[]{""};
StringBuilder[] sb = new StringBuilder[4];
sb[0] = new StringBuilder();
sb[1] = new StringBuilder();
sb[2] = new StringBuilder();
sb[3] = new StringBuilder();
players = 0;
for (String key : gameData.playerData.keySet()) {
players++;
ClientData cd = gameData.playerData.get(key);
if (cd != null) {
sb[0].append(cd.ip);
sb[0].append("\n");
sb[1].append(cd.score);
sb[1].append("\n");
sb[2].append(cd.deaths);
sb[2].append("\n");
sb[3].append(cd.ping);
sb[3].append("\n");
}
}
data[0] = sb[0].toString();
data[1] = sb[1].toString();
data[2] = sb[2].toString();
data[3] = sb[3].toString();
}
} |
b4f5b1d6-6616-4671-965c-d2dd547c52c2 | 0 | public void setServer(String server){ this.Server = server; } |
768e1439-5e46-4bda-a415-609f6a107c8d | 3 | public void process(String fName) throws FileNotFoundException, IOException{
System.out.println("Starting to sum up reads for transcripts in " + fName);
System.out.println("Writing output to " + fName.replace(".txt", "_out.txt"));
BufferedReader exCounts=new BufferedReader(new FileReader(fName));
BufferedWriter trCounts=new BufferedWriter(new FileWriter(fName.replace(".txt", "_out.txt")));
String line="", curTranscr="", transcr="";
float count;
float curCount=0;
while ((line = exCounts.readLine()) != null){
String[] fields = line.split("\t");
count = Float.valueOf(fields[1])*Float.valueOf(fields[4]);
//count = Float.valueOf(fields[1]);
transcr = fields[0].split(":")[0];
if (transcr.equals(curTranscr))
curCount += count;
else{
if (!curTranscr.isEmpty())
trCounts.write(curTranscr + "\t" + Float.toString(curCount)+"\n");
curCount=count;
curTranscr=transcr;
}
}
trCounts.write(curTranscr + "\t" + Float.toString(curCount));
trCounts.close();
exCounts.close();
//System.out.println("Finished summing up");
} |
5f6b3ab6-3c1f-49eb-bb8f-65ff5958f90b | 2 | public void mutate() {
if(bestVariation==null || baseGenome.getTotalOverlaps()<bestVariation.getTotalOverlaps()){
Logger.log("Found new best "+baseGenome.getTotalOverlaps());
bestVariation = baseGenome.clone();
}
//double quality = baseGenome.getTotalOverlaps();
baseGenome.mutate();
// Only accept mutations if total quality does not decrease by more than 10%
/*if(baseGenome.getTotalOverlaps()>quality*1.1){
baseGenome = bestVariation;
this.bestVariation = baseGenome.clone();
}*/
} |
7d02c42e-2a06-4b96-8e3d-ecf50f31fad2 | 6 | public ArrayList<City> getNeighbours(City city) {
int index = getIndex(city);
if (index < 0) {
return null;
}
ArrayList<City> list = new ArrayList<>();
for (int i = 0; i < edges.length; i++) {
for (int x = 0; x < edges[i].length; i++) {
if (edges[i][x] != 0) {
if (i == index) {
list.add(cities[x]);
} else if (x == index) {
list.add(cities[i]);
}
}
}
}
return list;
} |
62ad24a0-cebe-435f-b24d-88c3fe6fbf07 | 0 | @Override
public String getDesc() {
return "SonicBlow";
} |
a7d8a9cf-193d-4e92-b327-9648991c4461 | 1 | public static void storeNewParis(ParisModel paris) {
if(!hasParisForUserAndSchedule(paris.getParis_userId(),paris.getParis_schedId())){
UserModel user = getUser(paris.getParis_userId());
user.addUserPoint(-paris.getBet());
storeUser(user);
storeParis(paris);
}
} |
73b33b1d-33cf-48e9-aca9-2599ede02e6c | 5 | private void doAction() {
if (action == editor.getOpenItem()) this.doOpenItem();
if (action == editor.getNewItem()) this.doNewItem();
if (action == editor.getSaveItem()) this.doSaveItem();
if (action == editor.getSaveAsItem()) this.doSaveAsItem();
if (action == editor.getOpenFolderItem()) this.doOpenFolder();
} |
50e71fa2-0b61-43ed-b6b0-4710eb60c9ce | 2 | public void setDirty(final boolean isDirty) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
this.isDirty = isDirty;
if (isDirty == true) {
this.editor.setDirty(true);
}
} |
59b5dcef-9df9-4ba3-8c4e-368c1a4671f6 | 5 | @SuppressWarnings ("unchecked")
protected final GEntry removeEntry(final GKey key, final boolean verifyLength) {
if (this._size_ == 0) return null;
final Object[] table = this._table_;
final int hash = this.getKeyHash(key);
final int index = this.getIndex(hash, table.length);
GEntry item = (GEntry)table[index];
for (GEntry last = null, next; item != null; last = item, item = next) {
next = this.getEntryNext(item);
if (this.getEntryEquals(item, key, hash)) {
if (last == null) {
this._table_[index] = next;
} else {
this.setEntryNext(last, next);
}
this._size_--;
if (!verifyLength) return item;
this.verifyLength();
return item;
}
}
return null;
} |
eb41179c-9cf6-405f-9259-e4bb5dafbeca | 0 | public int getBitsPerPixel() {
return bitsPerPixel;
} |
f505a53f-6d7a-4efc-8ba9-6cc8b5a0cb0e | 4 | public static void main(String[] args)
{
Graph G = null;
try
{
G = new Graph(new In(args[0]));
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
int s = Integer.parseInt(args[1]);
ISearch search = new SearchWQU(G, s);
for (int v = 0; v < G.V(); v++)
if (search.marked(v))
System.out.print(v + " ");
System.out.println();
if (search.adjCount() != G.V())
System.out.print("NOT ");
System.out.println("Connected");
} |
a093a821-0ef2-4a1a-8182-1cb924393f43 | 7 | public void check_reductions()
throws internal_error
{
parse_action act;
production prod;
/* tabulate reductions -- look at every table entry */
for (int row = 0; row < num_states(); row++)
{
for (int col = 0; col < under_state[row].size(); col++)
{
/* look at the action entry to see if its a reduce */
act = under_state[row].under_term[col];
if (act != null && act.kind() == parse_action.REDUCE)
{
/* tell production that we used it */
((reduce_action)act).reduce_with().note_reduction_use();
}
}
}
/* now go across every production and make sure we hit it */
for (Enumeration p = production.all(); p.hasMoreElements(); )
{
prod = (production)p.nextElement();
/* if we didn't hit it give a warning */
if (prod.num_reductions() == 0)
{
/* count it *
emit.not_reduced++;
/* give a warning if they haven't been turned off */
if (!emit.nowarn)
{
System.err.println("*** Production \"" +
prod.to_simple_string() + "\" never reduced");
lexer.warning_count++;
}
}
}
} |
254f125f-dba1-41b8-bf4d-be3de8728eaf | 2 | private void testWrite(){
String f_name = this.path + Params.nTests + ".txt";
long startTime = 0;
long endTime = 0;
File f = new File(f_name);
FileOutputStream fout = null;
try{
fout = new FileOutputStream(f);
byte[] buf = new byte[Params.packSize * Params.nPacks];
for(int i = 0 ; i < Params.nTests ; i++){
startTime = System.nanoTime();
fout.write(buf);
endTime = System.nanoTime();
this.graf.add(endTime - startTime);
}
fout.close();
}catch(IOException e){
//TODO: catch error
e.printStackTrace();
}
} |
5157452d-efe4-4524-801b-5b3b1a8cdd27 | 6 | public void apply(Signature signature) {
ArrayList<Point> points = signature.getPoints();
int n = points.size();
/* Compute speed for each points except first and last one */
ArrayList<Double> speeds = new ArrayList<Double>();
speeds.add(0.); // Add first speed to maintain indexes
for (int i = 1; i < n - 1; i++) {
double distance = 0.;
double time = 0.;
if (points.get(i).isButton()) {
distance += Point.distance(points.get(i - 1), points.get(i));
time += points.get(i).getTime() - points.get(i - 1).getTime();
}
if (points.get(i + 1).isButton()) {
distance += Point.distance(points.get(i), points.get(i + 1));
time += points.get(i + 1).getTime() - points.get(i).getTime();
}
speeds.add(distance / time);
}
// Add last
speeds.add(Point.distance(points.get(n - 2), points.get(n - 1))
/ points.get(n - 1).getTime() - points.get(n - 2).getTime());
boolean incr = false;
for (int i = 1; i < n - 1; i++) {
//Decreasing
if (speeds.get(i) >= speeds.get(i + 1)) {
incr = false;
}
// First increase -> Local minimum
else if (!incr){
incr = true;
signature.getPoints().get(i).setCritical(true);
}
// Keep increasing
else {
// Do nothing
}
}
} |
e2193ba6-0094-4ed5-a204-dc5f59dafe69 | 5 | protected void printWordTopicDistribution(_Doc d,
File wordTopicDistributionFolder, int k) {
_ParentDoc4DCM pDoc = (_ParentDoc4DCM) d;
String wordTopicDistributionFile = pDoc.getName() + ".txt";
try {
PrintWriter pw = new PrintWriter(new File(
wordTopicDistributionFolder, wordTopicDistributionFile));
for (int i = 0; i < number_of_topics; i++) {
MyPriorityQueue<_RankItem> fVector = new MyPriorityQueue<_RankItem>(
k);
for (int v = 0; v < vocabulary_size; v++) {
String featureName = m_corpus.getFeature(v);
double wordProb = pDoc.m_wordTopic_prob[i][v];
_RankItem ri = new _RankItem(featureName, wordProb);
fVector.add(ri);
}
pw.format("Topic %d(%.5f):\t", i, pDoc.m_topics[i]);
for (_RankItem it : fVector)
pw.format("%s(%.5f)\t", it.m_name,
m_logSpace ? Math.exp(it.m_value) : it.m_value);
pw.write("\n");
}
pw.flush();
pw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} |
d3cb4967-6d4d-4b04-8c7d-184acfb4302c | 9 | @Override
public int classDurationModifier(MOB myChar,
Ability skill,
int duration)
{
if(myChar==null)
return duration;
if((((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_CRAFTINGSKILL)
||((skill.classificationCode()&Ability.ALL_DOMAINS)==Ability.DOMAIN_BUILDINGSKILL))
&&(myChar.charStats().getCurrentClass().ID().equals(ID()))
&&(!skill.ID().equals("FoodPrep"))
&&(!skill.ID().equals("Cooking"))
&&(!skill.ID().equals("Herbalism"))
&&(!skill.ID().equals("Masonry"))
&&(!skill.ID().equals("Landscaping")))
return duration*2;
return duration;
} |
a05897bf-a677-4095-b53a-771c8f7c88bb | 3 | public DAO_Configuration() {
SAXBuilder sxb = new SAXBuilder();
try {
//On crée un nouveau document JDOM avec en argument le fichier XML
File f = new File(path);
File dossier = new File("stockage");
if (!dossier.exists()) {
dossier.mkdir();
}
if (!f.exists()) {
this.ecrireFichConfig();
}
document = sxb.build(f);
} catch (JDOMException | IOException e) {
e.printStackTrace();
}
racine = document.getRootElement();
} // DAO_Configuration() |
17320643-9a3b-4f56-9c33-c99d668ea104 | 3 | @SuppressWarnings("static-access")
private void ROUND9() {
enemises.clear();
System.out.println("Round9!!!!!!");
for (int i = 0; i < level.getWidth(); i++) {
for (int j = 0; j < level.getHeight(); j++) {
if ((level.getPixel(i, j) & 0x0000FF) == 2) {
Transform monsterTransform = new Transform();
monsterTransform.setTranslation((i + 0.5f) * Game.getLevel().SPOT_WIDTH, 0.4375f, (j + 0.5f) * Game.getLevel().SPOT_LENGTH);
enemises.add(new Enemies(monsterTransform));
}
}
}
} |
4c84bd68-6cf7-45df-93ec-2514c1a0fc93 | 5 | public Dude getNearestDude(Tile tile) {
int x = tile.getX();
int y = tile.getY();
int bestSquaredDistance = Integer.MAX_VALUE;
Dude bestStructure = null;
for (Dude d : allDudes) {
if(d.getClass() != Dude.class)
continue;
if(d.hasTask())
continue;
int squaredDistance = (d.getX() - x) * (d.getX() - x) + (d.getY() - y) * (d.getY() - y);
if (squaredDistance < bestSquaredDistance) {
if (getLogic().canPath(getTile(d.getX(), d.getY()), tile)) {
bestSquaredDistance = squaredDistance;
bestStructure = d;
}
}
}
return bestStructure;
} |
79440049-e32f-4b25-88f7-5ed56cb7e807 | 9 | public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
RenderedImage src = pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
ROI srcROI = (ROI)property;
// Retrieve the Interpolation object.
Interpolation interp = (Interpolation)pb.getObjectParameter(4);
// Determine the effective source bounds.
Rectangle srcBounds = null;
PlanarImage dst = op.getRendering();
if (dst instanceof GeometricOpImage &&
((GeometricOpImage)dst).getBorderExtender() == null) {
srcBounds =
new Rectangle(src.getMinX() + interp.getLeftPadding(),
src.getMinY() + interp.getTopPadding(),
src.getWidth() - interp.getWidth() + 1,
src.getHeight() - interp.getHeight() + 1);
} else {
srcBounds = new Rectangle(src.getMinX(),
src.getMinY(),
src.getWidth(),
src.getHeight());
}
// If necessary, clip the ROI to the effective source bounds.
if(!srcBounds.contains(srcROI.getBounds())) {
srcROI = srcROI.intersect(new ROIShape(srcBounds));
}
// Retrieve the scale factors and translation values.
float sx = pb.getFloatParameter(0);
float sy = pb.getFloatParameter(1);
float tx = pb.getFloatParameter(2);
float ty = pb.getFloatParameter(3);
// Create an equivalent transform.
AffineTransform transform =
new AffineTransform(sx, 0.0, 0.0, sy, tx, ty);
// Create the scaled ROI.
ROI dstROI = srcROI.transform(transform);
// Retrieve the destination bounds.
Rectangle dstBounds = op.getBounds();
// If necessary, clip the warped ROI to the destination bounds.
if(!dstBounds.contains(dstROI.getBounds())) {
dstROI = dstROI.intersect(new ROIShape(dstBounds));
}
// Return the warped and possibly clipped ROI.
return dstROI;
}
return java.awt.Image.UndefinedProperty;
} |
61159aab-2f8d-4b3d-95f7-c80e0afbef49 | 7 | private void createMap()
{
int c;
String s = "";
for(int i = 0; i < width; i++)
{
for(int j = 0; j < height; j++)
{
mapView[i][j] = new JLabel();
c = gameMap[i][j];
if(c == 0)
mapView[i][j].setIcon(new ImageIcon(getClass().getResource(wall)));
if(c == 2)
mapView[i][j].setIcon(new ImageIcon(getClass().getResource(floorFull)));
if(c == 3)
mapView[i][j].setIcon(new ImageIcon(getClass().getResource(floorEmpty)));
if(c == 4)
mapView[i][j].setIcon(new ImageIcon(getClass().getResource(badGuy)));
if(c == 5)
mapView[i][j].setIcon(new ImageIcon(getClass().getResource(heroR)));
content.add(mapView[i][j]);
}
}
} |
601fd166-8bb4-4f99-ac2e-2ba28160119a | 6 | @Override
public void Update(long gameTime) {
for (Sprite sprite : _sprites) {
sprite.Update(gameTime);
}
_weapon.Update(gameTime);
InputManager input = InputManager.getInstance();
if (input.isKeyDown(KeyEvent.VK_Q)) {
jaune.setX(jaune.getX() - 1);
}
if (input.isKeyDown(KeyEvent.VK_D)) {
jaune.setX(jaune.getX() + 1);
}
if (input.isKeyDown(KeyEvent.VK_Z)) {
jaune.setY(jaune.getY() - 1);
}
if (input.isKeyDown(KeyEvent.VK_S)) {
jaune.setY(jaune.getY() + 1);
}
if (input.isMouseButtonDown(0)) {
_weapon.Fire();
}
this._bulletsManager.Update(gameTime);
} |
783bf26b-a121-4e78-945e-991c3c99aaab | 9 | public static Stella_Object inferPredicateFromOperatorAndTypes(Stella_Object operator, List types) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(operator);
if (Surrogate.subtypeOfSurrogateP(testValue000)) {
{ Surrogate operator000 = ((Surrogate)(operator));
if (Stella_Object.isaP(operator000.surrogateValue, Logic.SGT_STELLA_SLOT)) {
{ Slot slot = ((Slot)(operator000.surrogateValue));
slot = ((Slot)(Logic.inferPredicateFromOperatorAndTypes(slot.slotName, types)));
if (slot != null) {
return (slot);
}
else {
return (operator000.surrogateValue);
}
}
}
else {
return (operator000.surrogateValue);
}
}
}
else if (Surrogate.subtypeOfSymbolP(testValue000)) {
{ Symbol operator000 = ((Symbol)(operator));
{ Surrogate slotref = null;
{ Surrogate type = null;
Cons iter000 = types.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
type = ((Surrogate)(iter000.value));
if (Stella_Object.isaP(type.surrogateValue, Logic.SGT_STELLA_CLASS)) {
slotref = Surrogate.lookupSlotref(type, operator000);
if (slotref != null) {
return (slotref.surrogateValue);
}
if (Logic.logicalSubtypeOfLiteralP(type)) {
type = type.typeToWrappedType();
slotref = Surrogate.lookupSlotref(type, operator000);
if (slotref != null) {
return (slotref.surrogateValue);
}
}
}
}
}
}
}
}
else {
}
}
return (null);
} |
bb0cd34f-0f74-437d-a335-ad2a8d61fd1c | 6 | @Override
public int read() throws IOException
{
int result = (length == next) ? -1 : string.charAt(next++);
if (result <= 13)
{
switch (result)
{
case 13:
column = 0;
line++;
int c = (length == next) ? -1 : string.charAt(next);
if (c == 10)
{
next++;
}
return 10;
case 10:
column = 0;
line++;
}
}
return result;
} |
9c80007a-e47d-4d77-997d-48b75520a29d | 0 | @Test
public void testLayers() {
BeerRequest beerRequest = new BeerRequest();
beerRequest.setName("cruzcampo");
beerRequest.setDescription("standard spanish pilsner style beer");
BarController barController = AppContext.getService(BarController.class);
BeerResponse firstResponse = barController.addBeer(beerRequest);
assertNotNull(firstResponse.getId());
BeerResponse secondResponse = barController.getBeer(firstResponse.getId());
assertEquals(firstResponse.getId(), secondResponse.getId());
assertEquals(firstResponse.getName(), secondResponse.getName());
assertEquals(firstResponse.getDescription(), secondResponse.getDescription());
} |
843ffbd1-36e3-4bb2-849e-eedd118d7c0e | 2 | public void Render(GameObject object)
{
if (GetMainCamera() == null) System.err.println("Error! Main camera not found. This is very very big bug, and game will crash.");
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
object.RenderAll(m_forwardAmbient, this);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glDepthMask(false);
glDepthFunc(GL_EQUAL);
for(BaseLight light : m_lights)
{
m_activeLight = light;
object.RenderAll(light.GetShader(), this);
}
glDepthFunc(GL_LESS);
glDepthMask(true);
glDisable(GL_BLEND);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.