method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f7b06a8d-1f44-4789-aa66-a96f3af1fc1c | 7 | private void init() {
if(!isInited){
actions=new HashMap<String, MethodObject>();
List<Object> containers=new LinkedList<Object>();
containers.add(comp);
if(comp instanceof Component){
Component component=(Component)comp;
while((component=compon... |
f541e145-9d4d-4185-a42e-ca860c83d352 | 6 | public MapEdge getClosestRoad(double x, double y, boolean withName) {
x = outOfBoundsX(x);
y = outOfBoundsY(y);
MapEdge ed;
String ID = getID(x, y);
double distance;
ArrayList<MapEdge> a = getBranch(ID).getEdges();
if(a.isEmpty()) a = this.getParent(getBranch(ID))... |
1c3761d4-9b71-4839-9fce-614ec76db8bb | 1 | public static void shuffle(Object[] array) {
int n = array.length;
while (n > 1) {
int k = gen.nextInt(n--); // decrements after using the value
Object temp = array[n];
array[n] = array[k];
array[k] = temp;
}
} |
fec1c2a4-bb49-4789-bb6e-e6e8c9eb2848 | 9 | public MortgageDialog(java.awt.Frame parent, boolean modal,int pl) {
super(parent, modal);
initComponents();
player=pl;
model = new DefaultListModel();
jList1.setModel(model);
fieldsR = new ArrayList<>();
for (Field field : Game.fields) {
String name="... |
8661c791-2104-4a75-ae1a-e5a459e7c42d | 5 | public static void main(String[] args) throws Exception {
System.out.println("***************************************************");
System.out.println(" Using Hybrid MapReduce 3D Convex Hull Algorithm ");
System.out.println("***************************************************");
... |
60f76385-ef96-437c-a7b7-20196889b373 | 0 | public SuperFun() {
setTitle("Lottery生成器");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
JPanel panel = new JPane... |
fabe1d1e-36a8-4df8-a5c0-46c3217acfb0 | 1 | public void swapTileSets(int index0, int index1) {
if (index0 == index1) return;
TileSet set = tileSets.get(index0);
tileSets.set(index0, tileSets.get(index1));
tileSets.set(index1, set);
} |
c23edb9b-2f2f-4722-97e0-eba9c29425c7 | 3 | @Override
public void onCreate(final SQLiteDatabase db) {
Ln.d("Creating Tables.");
List<Class<?>> tables = Dex.searchForClass(context, "Model");
for (Class<?> table : tables) {
db.execSQL(Model.getSQLCreateTable(table));
Ln.d("Table for class " + table.toString() + " created.");
}
Ln.d("Firing Databa... |
bcf09636-fc40-4a98-a137-2a627a48bf47 | 3 | @EventHandler(priority = EventPriority.NORMAL)
public void setFormatChat(final PlayerLoginEvent e) {
if(e.getPlayer().hasPermission("bungeesuite.*")){
PermissionsManager.addAllPermissions(e.getPlayer());
}else if(e.getPlayer().hasPermission("bungeesuite.admin")){
PermissionsManager.addAdminPermissions(e.getP... |
09e0daba-4b7f-4ccc-a816-de5a940721e6 | 7 | public void buildGameMenu(final Stage stage) {
switch(gameMenuType) {
// Party menu
case STATS:
gameMenu.clear();
for(int x = 0; x<stage.party.getMembers().size(); x++) {
gameMenu.add(new PlainText(false, 0f, false));
if(x > 0) {
int y = 0;
for(int z = x; z>0; z--)
y += gameMenu.get(... |
c91a8a94-5204-447d-9c1e-92dbc328bfa5 | 3 | public void deselectOthers(Button b)
{
for(int i=0; i<buttons.size(); i++)
{
if(buttons.get(i)!=b && !buttons.get(i).getOther())
{
buttons.get(i).deselect();
}
}
} |
7f587ddf-ef0d-4848-9532-90cca6c247ac | 9 | public void initTestMap() {
for (int x = 0; x < chunkAmount; x++) {
for (int y = 0; y < chunkAmount; y++) {
chunks[x][y] = new Chunk();
chunks[x][y].create(x, y);
}
}
for (int x = 1; x < jps.grid.grid.length - 1; x++) {
for (i... |
e82c6a65-c5d4-40d4-8bd9-08d5767dece0 | 5 | public CellGrid(Map<Point, Component> mapComps) {
mapRows = new HashMap<>(25);
mapCols = new HashMap<>(25);
for (Map.Entry<Point, Component> entry : mapComps.entrySet()) {
int row = entry.getKey().y;
int col = entry.getKey().x;
List<Cell> rows = mapRows.get(ro... |
51f85c44-714d-43da-8787-a97c6653469e | 0 | public String getLoginSgbd() {
return loginSgbd;
} |
598be4f8-591e-447b-abbd-b7415fc440ef | 0 | Reader_FIFO (Semaphore sem, ArrayDeque<Byte> fifo) {
semaphore = sem;
FIFO = fifo;
new Thread(this).start();
} |
bba15f42-35b1-46f4-a53b-31d558ad3e02 | 8 | @Override
public void emitCode() {
Address address = null;
if (isDigit(firstParam.charAt(0))) {
System.out.println(lineNumber++ + ": LDC 0," + firstParam +ZERO_REGISTER);
} else {
address = manager.getAddressOfVar(firstParam);
System.out.println(lineNu... |
7164879b-7140-446c-b9a1-df8de7120599 | 2 | public void onMessage(String message) {
history.add(message);
try {
OutputStream out = reportFactory.openReport();
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
for (String crnt : history) {
writer.wri... |
da5e4a02-79e7-416a-b1de-c6b6961046a8 | 2 | public static void showMessage(final String text, final String type) {
int msgWindowType = 0;
if (type.equals("Error")) {
msgWindowType |= SWT.ICON_ERROR;
addError(text);
}
if (type.equals("Information")) {
msgWindowType |= SWT.ICON_INFORMATION;
... |
b06ff2eb-a1c3-4479-8a0c-80241268cb99 | 0 | public AlgorythmFile getAlgorythmFile(){
return algorythmFile;
} |
e107bad3-cd46-405d-bd5c-a0c33869c1de | 1 | private static void db(final String s) {
if (StackHeightCounter.DEBUG) {
System.out.println(s);
}
} |
097757ac-2df9-4de4-a1e6-770bbabaa01c | 6 | public static void drawPostRaceScreen() {
// Clear the last screen
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
// Preserve current GL settings
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_TEXTURE_BIT
| GL11.GL_LIGHTING_BIT | GL11.GL_DEPTH_BUFFER_BIT);
// Turn off lighting
... |
5f8f9fd1-7830-4c6e-b801-25be592bbd8b | 4 | public String encode(String plain)
{
int period=key.length();
String plain_u=plain.toUpperCase();
if(plain_u.length()%2!=0)
{
plain_u+="X";
}
char[][] block=Incomp_column.build_block(plain_u, -1,period*2, 0);
StringBuilder sb=new StringBuilder();
for(int i=0;i<block.length;i++)
{
for(int j=0;j... |
1bd39d90-8a3c-441c-9541-65732daa8869 | 5 | public static boolean isMemberOf(String playerName, IReinforcement reinforcement)
{
if (reinforcement == null || !MachineFactoryPlugin.CITADEL_ENABLED) // All players have access to non-existing reinforcements
return true;
if (reinforcement instanceof PlayerReinforcement)
{
PlayerReinforcement playerRei... |
331c0bab-1fd1-470c-a328-3df0d280248d | 6 | public String toString() {
StringBuilder b = new StringBuilder("\n---------------\n|");
for(int i = rows - 1; i >= 0; i--) {
for(int j = 0; j < columns; j++) {
switch (board[i][j]) {
case yellow: b.append("Y"); break;
case red: b.append("R"); break;
case empty: b.append(" "); break;
}
b.a... |
45d386af-ee69-4aec-a54c-74e1d0ad4767 | 4 | public static PcParts Questions3(PcParts thing){
for(int i=0; i < shopStock.size(); i++){
if ( thing.getManufacturer().equals(shopStock.get(i).getManufacturer()) && thing.getmodelName().equals(shopStock.get(i).getmodelName()) && thing.getmodelYear() == shopStock.get(i).getmodelYear()){
item = shopStock.get(i).... |
43f01a8c-3a34-45bc-a19d-d34d23ae8b2a | 7 | public static String encode(byte[] binaryValue) {
int binaryValueLen = binaryValue.length;
// Estimated output length (about 1.4x input, due to CRLF)
int maxChars = (binaryValueLen * 7) / 5;
// Buffer for encoded output
StringBuffer sb = new StringBuffer(maxChars);
int ... |
161c05e6-ede2-4507-aa9f-5b044a067faa | 7 | public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int numOfCases = sc.nextInt();
for(int i = 0; i < numOfCases;i++)
{
int numOfCoordinates = sc.nextInt();
//Just getting all the data into a usable form so we can analyze it later on
Coordinate[] coordinates = new Coordinate... |
b144b389-ab6a-4731-a2b6-59f0526b2857 | 6 | public void paintComponent (Graphics g2)
{
// super.paintComponent(g2);
Graphics2D g = (Graphics2D) g2;
g.setRenderingHint ( RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
if (angle == 90) g.translate(height, 0);
else if (angle == 180) g.... |
2bb4f49c-a680-4ca4-881d-7f8381651d10 | 6 | public void downloadFile(String path, String fileName) throws UpYunExcetion {
try {
StringBuffer url = new StringBuffer();
for (String str : fileName.split("/")) {
if (str == null || str.length() == 0) {
continue;
}
url.... |
5823bc16-2c98-4b32-bc71-9a810e9fd3a3 | 2 | public void excluirContatoPorNome(String nomeContatoExcluir){
List<Contato> contatosBusca = FachadaSistema.getInstance().listarContatos();
for (Contato contato : contatosBusca) {
if(contato.getNome().equals(nomeContatoExcluir)){
contatoDAO.excluir(contato);
... |
9a716b07-233c-4b87-afab-328f853fc08f | 3 | public static Spawn getClosestAllowed(Player player) {
HashMap<String, Spawn> allowed = new HashMap<String, Spawn>();
for (Spawn point : FearTheReaper.getSpawnList().values()) {
if (player.hasPermission("graveyard.spawn.*") || player.hasPermission(("graveyard.spawn." + point.getGroup()).toLo... |
b7f0e1a2-fdb9-4c9a-aa81-83d94346386b | 9 | Class286_Sub3(OpenGlToolkit var_ha_Sub2, Class83 class83) {
super(var_ha_Sub2);
do {
try {
aClass83_6227 = class83;
if (!((OpenGlToolkit) ((Class286) this).aHa_Sub2_3684).aBoolean7841
|| (((OpenGlToolkit) ((Class286) this).aHa_Sub2_3684).anInt7795
< 2))
break;
aClass171_6220
= (Class50... |
fdd79e99-102f-4e00-bd5e-b6078d2e2aeb | 1 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (jRadioButton3.isSelected())
result = OPTION_CONFIRM_CORRECT;
else
result = OPTION_CONFIRM_FALSE;
}//GEN-LAST:event_jButton1ActionPerformed |
a88d74cd-73da-47f8-a705-e5a71d6766e6 | 5 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) {
return motherLangWordList.get(rowIndex);
}
if (columnIndex == 1) {
return foreignLangWordList.get(rowIndex);
}
if (columnIndex == 2) {
return sectio... |
e5adbd1f-de38-4c4a-891b-5f0434c48e90 | 3 | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case WHAT:
return isSetWhat();
case WHY:
return isSetWhy();
}
throw new IllegalStateException();
} |
1b58bd88-f7bb-4896-8ba7-af3a3dac12df | 7 | private int getAvailableBus(int[] busesList, Date day, service serv)
{
int bus_id = 0;
boolean temp = false;
boolean found = false;
for(int i=0; i<buses.length; i++)
{
temp = false;
found = false;
if(BusInfo.isAvailable(busesList[i], day))
{
for(int j=0; j<busesUsed... |
e483bd8e-a32a-4f45-b575-827af3434b1d | 7 | public void print(int depth)
{
int i;
// Print the indentation and the data from the current node:
for (i = 1; i <= depth; i++)
System.out.print(" hello ");
System.out.println(data);
// Print the left subtree (or a dash if there is a right child and no left child)
if (left != nul... |
b1a968ac-7f16-42d1-86c4-01f8b692187f | 4 | public void rimuovi(T x) {
AlberoBin<T> curr = cercaNodo(x);
if (curr == null || !curr.val().equals(x)) return;
if (curr.sin() == null || curr.des() == null)
rimuoviNodo(curr);
else {
AlberoBin<T> curr2 = max(curr.sin());
curr.setVal(curr2.val());
rimuoviNodo(curr2);
}
} |
f024c59d-1405-40c8-8486-b4ef7c8d78a8 | 8 | public static int parseSExpression (String aString) {
int length = aString.length();
int parenLevel = 0;
boolean isQuotedString = false;
boolean isLeadingWhitespace = true;
int charsParsed = 0;
char ch = ' ';
int index = 0;
// Bypass any leading whitespace... |
1641f193-38c9-4fde-9d1d-0584aeec4a3a | 5 | private String keyToString(JsonElement keyElement) {
if (keyElement.isJsonPrimitive()) {
JsonPrimitive primitive = keyElement.getAsJsonPrimitive();
if (primitive.isNumber()) {
return String.valueOf(primitive.getAsNumber());
} else if (primitive.isBoolean()) {
return Boo... |
82524934-bb52-49a7-8f93-fc7dfa78c2d9 | 4 | private void initializeBottomLabels(JPanel bottom, PianoLabel[] bottomRowLabels)
{
for (int i = 0; i < KeyStats.NUM_KEYS; i++)
{
if ((i & 1) == 0) // whiteKey
{
bottomRowLabels[i] = new PianoLabel(new Dimension(i == 8 || i == 10 ? KeyStats.BOTTOM_FAT_WIDTH : KeyStats.BOTTOM_WHITE_WIDTH, KeyStats.BOTTOM_H... |
e274a341-9be6-45b8-b876-09c3d4253008 | 5 | public boolean checkLocaleArrayForType(int x, String typeToFind){
boolean typeIsFound = false;
for(int y = 0; y < Main.localeInventory[x].length; y++){
if(typeIsFound){
break;
}
String[] tempTypeStor = fetchFromInventory("type", Main.localeInventory[x][y]);
try {
for(String tempTest : tempTypeSt... |
5d4c4107-97de-4ec0-a5b5-93ae723b88be | 2 | protected String getJsLineInitialization() {
String fileName = uri.replace("\\", "\\\\").replace("'", "\\'");
StringBuilder sb = new StringBuilder(format("if (! _$jscoverage['%s'].branchData) {\n", fileName));
sb.append(format(" _$jscoverage['%s'].branchData = {};\n", fileName));
for (I... |
bba0288d-ccbb-437a-b498-6fa267d53ff0 | 0 | public InputStream getInputStream() {
return inputStream;
} |
7bc76536-91f7-4159-9104-85b25e33042f | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AttributeImpl other = (AttributeImpl) obj;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type)... |
4883c994-5a86-4eaf-b925-0e176d1cd49b | 6 | @Override
public int altaventa(TVenta venta,int idCliente) {
int idVenta = -1;
TransactionManager.obtenerInstanacia().nuevaTransaccion();
try
{
TransactionManager.obtenerInstanacia().getTransaccion().start();
TVenta tVenta = FactoriaDAO.obtenerInstan... |
9caaed78-17a1-42b3-9bed-921720b66cbb | 5 | private void downloadNatives(Logger logger){
logger.debug("Downloading natives");
try {
if (Vizun.getOs() == DataFolder.OPERATING_SYSTEM.Mac) {
DownloadManager.downloadFile(logger, "https://www.dropbox.com/s/0piww9yqly09enh/openal.dylib?dl=1", Vizun.getDataFolder().ge... |
04207c5b-2cf5-45c3-adca-173633bb2eac | 7 | public long mergeSortedFiles(List<File> files, File outputfile,
String tableTitle, final Comparator<TxtTable.Row> cmp,
String delimiter, char escape, boolean saveKey) throws IOException
{
PriorityQueue<TxtTable> pq = new PriorityQueue<TxtTable>(11,
new Comparator<TxtTable>() {
public int compare(TxtTa... |
d187a741-7686-4f77-b16a-0a5f1c9177a1 | 1 | public Clock(double x, double y){
// Instanciate the clock spritesheet and vars
try{
ss_clock_image = loader.loadImage("/sprite_sheet_clock.png");
clock_ss = new SpriteSheet(ss_clock_image);
}
catch(IOException e){}
this.x = x;
this.y = y;
... |
5b653354-b9fb-4f6c-8606-f921f8367f93 | 3 | public Site findBestSite(Vector<Site> freeSites) {
// Your own code determining what the best Site is of all
// possible freeSites for the agent to move to;
Iterator<Site> i = freeSites.iterator();
Site bestSite = new Site();
double gain = Double.NEGATIVE_INFINITY;
double ne... |
4486c189-9a4c-4361-835c-19c2dd752e0e | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID!=Tickable.TICKID_MOB)
return false;
if((affecting()!=null)&&(affecting() instanceof MOB))
{
final MOB M=(MOB)affecting();
final Room room=M.location();
if((room!=null)
&&(roo... |
832db454-a9b3-4492-8785-30c2df9a6f95 | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
switch(columnIndex){
case 0 : return list.get(rowIndex).getKode();
case 1 : return list.get(rowIndex).getJudul();
case 2 : return list.get(rowIndex).getPengarang();
case 3 : return list.get(rowIndex).getPener... |
1f25ca72-c925-468a-b557-e05fe49f2a0b | 4 | private void idleUpdate(Vector3f orientation, float distance)
{
double time = ((double)Time.getTime())/((double)Time.SECOND);
double timeDecimals = time - (double)((int)time);
if(timeDecimals < 0.5){
canLook = true;
material.setTexture(animations.get(0));
}el... |
1bb3566e-3bc1-45ca-9cc4-3544efab69d2 | 5 | public static int computeChange (int sum, int[] availableCoins)
{
int[] coinCount = new int [sum + 1];
int temp = 0;
for (int i = 1; i <= sum; i++)
coinCount[i] = INFINITY;
for (int i = availableCoins[0]; i <= sum; i++) {
for (int j = 0; j < availab... |
3f9d7c33-0045-45ef-a1c1-7d32a53d47b6 | 6 | public synchronized void ProcessJob(String inFileName){
mLocalImgPath = mLocalBasePath + "/" + inFileName;
threadMessage("ServerCoordinator Process Job: " + mLocalImgPath);
mJobsStartTime = System.currentTimeMillis();
System.out.println("ServerCoordinator Process Job: " + mLocalImgPath);
//Determi... |
f5becf0a-9c88-4cc2-9e57-4c3f08416863 | 4 | protected void selectImageFilter(){
FileNameExtensionFilter imageFilter;
imageFilter= new FileNameExtensionFilter("JPEG (*.jpg,*.jpeg,*.jpe,*.jfif)","jpg","jpeg","jpe","jfif");
this.stringSelectedExtension="jpg";
switch(this.selectedExtensionImage){
case bmp:
... |
09ae3b98-e9ba-43d0-b654-c977868e1c4e | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Plese enter how many days are in the month: ");
int days = sc.nextInt();
double sum = 0;
double[] temperatures = new double[days];
for (int i = 0; i < temperatures.length; i++) {
System.out.println("Enter t... |
75f07c67-76e5-4d7e-8b3d-aa57dc627529 | 1 | public static ArmorType getArmorType(String name) {
if (armorTypes.containsKey(name)) {
return (ArmorType) armorTypes.get(name);
}
return null;
} |
5758b4f3-2e0e-48ad-bb73-ac29a7cd01a2 | 6 | private void selectSystem() {
squareSelector.reset();
squareSelector.setCriteria(new SquareCriteria() {
private final String desc = "Select: System";
public String getDescription() { return desc; }
public boolean isSquareValid( SquareSelector squareSelector, int roomId, int squareId ) {
if ( roomId <... |
da0262c8-70c3-43a7-91cd-0db1b4207478 | 6 | public static void startupJavaTranslateFile() {
{ 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())));
... |
2b653ad3-7648-4f55-9c17-f1f140ed4be1 | 7 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
new Thread(new Runnable() {
public void run() {
System.exit(0);
}
}).start();
}
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
this.tracing = true;
}
if (e.getKeyCode() == KeyEvent.VK_X) {
this.zoomIn = true... |
ceb1a3e9-5694-4efb-9bd2-6ac50fe7d694 | 3 | @Override
public Boolean[] segment(Utterance utterance, boolean training, boolean trace) {
// Return all segmentation points as true
Boolean[] boundaries = utterance.getBoundariesCopy();
// Randomly insert boundaries
for (int i=0; i<boundaries.length; i++) {
if (Math.random() < threshold) {
boundaries[... |
d5380e37-d773-4f84-a201-f99f3b3771d8 | 5 | @Override
public void run() {
try {
reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
} catch (IOException ex) {
Logger.getLogger(ServerClient.class.getName()).log(Level.SEVERE, null, ex);
}
while (run) {
try {
String dir = reader.readLine();
if (dir.charAt(0) == '!'... |
acb80722-bac7-4694-b301-f54f5f96f626 | 7 | @Override
public void handleStartTag(HTML.Tag tag, MutableAttributeSet attrs, int pos) {
logger.info("StartTag: " + tag);
HTMLComponent comp = null;
if (isWantedComplexTag(tag)) {
comp = HTMLComponentFactory.create(tag, attrs);
}
// If not a known start tag, but not utterly trivial, make generic tag.
if... |
d6875576-ca87-4ac7-8504-cf25e0eb954a | 1 | public String getNotationPublicId(String nname)
{
Object notation[] = (Object[]) notationInfo.get(nname);
if (notation == null) {
return null;
} else {
return (String) notation[0];
}
} |
18cfeaa4-968d-4904-887c-f77025fedf19 | 4 | public static Node treeInsert(Node root,int key){
Node y =null;
Node z = new Node(key);
Node x = root;
while(x != null){
y = x;
if(x.key > z.key)
x = x.left;
else
x = x.right;
}
z.p = y;
if(y == null){
root = z;
}
else if(z.key <y.key){
y.left = z;
}
else
y.right = z... |
c7c2d7af-93e9-439d-9538-b2957fca9b6c | 0 | @RequestMapping(method = RequestMethod.GET)
public ModelAndView indexView() {
return new ModelAndView("uploadPage", "image", new Image());
} |
bbf7f70d-7096-4cda-a6d5-317ca4ab67c2 | 1 | public boolean opEquals(Operator o) {
return (o instanceof ConvertOperator) && type == o.type;
} |
1a9f00e7-24b1-4289-82d4-54d5797ff0f8 | 9 | public LabelCorrectingTO labelCorrecting(List<Edge> links,List<Node> N, Node s, double[] costVector){
LabelCorrectingTO result = new LabelCorrectingTO();
double[] ds = new double[N.size()];
// double[] dj = new double[N.size() - 1];
//
ds = initializeDoubleArray(ds, 0.0);
// dj = initializeDoubleArray(dj, ... |
2132f232-c3e6-40aa-a34f-e53cdc7c31d5 | 4 | private List<String> imports() throws UnexpectedTokenException
{
List<String> imports = new ArrayList<String>();
if(this.accept(IMPORTS))
{
this.nextToken();
this.expect(LBRACE);
this.nextToken();
while(!this.accept(RBRACE))
{
StringBuilder _import = new StringBuilder();
while(!this.accep... |
3f66a832-0d02-4b40-8188-7656b751bd66 | 6 | public boolean readField(aos.apib.InStream in, aos.apib.Base o,int i) {
if ( i > __field_names.length )
return getBaseClassStreamer().readField( in, o, i - __field_names.length - 1 );
PeerInfo__Tuple v = (PeerInfo__Tuple)o;
switch (i) {
case 0:
v.id = in.getInt();
break;
case 1:
v.... |
ae642081-3887-4d70-b0c6-7c7c32e512a0 | 4 | private static int checkEuler(Graph graph) {
int count = 0;
for (int i = 0; i < graph.getVertexCount(); i++) {
if (graph.getDegree(i) % 2 == 1) {
count++;
}
}
if (count == 0) {
Log.print(Log.system, "The graph is euler");
return 0;
}
if (count == 2) {
Log.print(Log.system, "The graph is ... |
e2e82d09-ed0d-4f11-972f-fee1f2389c0e | 7 | private SpriterBone[] interpolateBones(SpriterKeyFrame key1, SpriterKeyFrame key2, long currentAnimationTime){
SpriterBone[] tempBones = new SpriterBone[key1.getBones().length];
for (int b = 0; b < key1.getBones().length; b++) {
SpriterBone bone1 = key1.getBones()[b];
SpriterBone bone2 = key2.getBones()[b... |
54636cce-50b8-4438-88dc-95f1741e3b0b | 5 | public static AlgebraicParticle add(MixedNumber a, MixedNumber b, RoundingRule round) {
//if the mixednumbers are negative, make the numbers negative before adding
Number numA = a.numeral, numB = b.numeral;
Fraction fracA = a.fraction, fracB = b.fraction;
if(!a.sign()){numA = numA.cloneWithNewSign(false); fracA... |
d96e3397-3ae7-4ce8-adbc-a92b944c28f0 | 5 | @Override
public final void addHeaderLines(String... lines) {
if (lines != null && lines.length > 0) {
for (String line : lines) {
if (line == null) {
header.add(";# ");
}
else if (line.startsWith(";#")) {
he... |
f3b7dba6-f968-46f3-81b5-be238249e6e6 | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
... |
c3617944-7be7-4a9d-8e8c-b7aba7ed5f77 | 6 | private OrtsPunktBean getNextShortestPkt(List<StrasseDTO> nextList, OrtsPunktBean aktPktBean) {
OrtsPunktBean nextPkt = new OrtsPunktBean();
OrtsPunktBean nextShortestPkt = new OrtsPunktBean();
nextShortestPkt = new OrtsPunktBean();
nextShortestPkt.setStreckenInklGewichtung(DEFAULTDISTANZ);
for (StrasseDTO st... |
20a295d3-218b-48d4-9745-3bf71790c690 | 7 | static List getScriptStack(RhinoException ex)
{
if (ex.interpreterStackInfo == null) {
return null;
}
List list = new ArrayList();
String lineSeparator = SecurityUtilities.getSystemProperty("line.separator");
CallFrame[] array = (CallFrame[])ex.interpret... |
b1e7c8b1-f5ec-4b3e-8198-f5a2859dd155 | 5 | public boolean esDoblePareja() {
boolean pareja = false;
for (int i = arrayNums.length - 1; i >= 0; i--) {
if ((arrayNums[i] >= 2) && (!pareja)) {
pareja = true;
this.cartasJugada[0] = Numeros.values()[i];
} else if ((arrayNums[i] >= 2) && (pareja)... |
80646109-f869-40a8-9315-ae4006ead4ad | 6 | public void setValueAt(Object value, int realRow, int realColumn)
{
if ((0 == realRow) || (1 == realRow))
{
displayError("Illegal row,column pair [" + realRow + "," + realColumn + "]", "Error");
return;
}
if (0 == realC... |
aed66447-8ecc-4787-8b05-ea48a44a2cbe | 0 | @Override
public void setPropertyFilterChain(String key, PropertyFilterChain filter_chain) {
this.filter_chains.put(key, filter_chain);
} |
20eaf4df-7dd7-46a6-ae7a-584f3c09a13d | 3 | public void updateValues(){
//Doesn't need to do anything in the case of a String
switch(this.type){
case INT:
this.intValue = Integer.parseInt(this.value);
break;
case DECIMAL:
this.doubleValue = Double.parseDouble(this.value);... |
2df2449a-aef5-464f-9c52-318543511da5 | 2 | public void setMainFrame(MainFrame frame)
{
mainFrame = frame;
if ( (user.lastLog == null)
|| (System.currentTimeMillis() - user.lastLog.getTime()) > 600_000)
{ // if lastlog is older then 10 min or first login
user.logins++;
}
mainFrame.setTitle("User: " + user.name
+ " - Logins: " + user.l... |
09df717d-0046-4b78-897c-93171f44e643 | 1 | public void drawScores() {
int yi = 45;
// read from arraylist and draw on screen
for (int i = people.size() - 1; i >= 0; i--) {
Person temp = people.get(i);
// System.out.println("Name: " + people.get(i).getName());
int newY = 166 + (yi * i);
offScreenBuffer.setFont(new Font("Comic Sans MS", Font.P... |
098aed50-1f09-4311-8743-41b0cdf62bd6 | 7 | public ClubSignupPage enterCoachReferral(Boolean value, String coachId) {
/*
if (value=false){
int cbSize = coachReferral.size();
for(int i=0; i < cbSize ; i++ ){
String sValue = coachReferral.get(i).getAttribute("value");
if (sValue.equalsIgnoreCase("6")){
coachReferral.get(i).click();
... |
746f14e8-0123-456c-bc1f-8c7ed96ef081 | 5 | public void processPressedKey(char pressed) {
if (waitForSpace && pressed == ' ') {
waitForSpace = false;
// Note: nextLetter() is not called here because the
// currentLetter is already set
}
else if (!waitForSpace) {
if (currentLetter.isCorrectKe... |
2b9a16ca-127b-4cb3-8eba-99caf2a14e94 | 0 | public int getNumMetadataBlocks() {
return numMetadataBlocks;
} |
304b06d2-f073-41e7-8cd0-f928a553e405 | 5 | public void minHeapify_top_down(int index) {
int small;
if (index * 2 + 1 >= heap.size())
return;
else if (2 * index + 2 == heap.size()) {
if (heap.get(2 * index + 1).f_val < heap.get(index).f_val) {
Values temp = heap.get(2 * index + 1);
heap.set(2 * index + 1, heap.get(index));
find_index.put... |
3e8b3494-4be3-4e43-bd1d-70f30a6ac7b1 | 3 | private void setPrincipleAmount(Loan loan) throws LoanEntryException {
// Loan pricinple amount
String principle_str = readPrincipleAmount();
double principle = 0d;
try {
principle =
(principle_str != null)?
Doub... |
84d300af-ecc5-4061-8180-fcf35de8e3c9 | 9 | public boolean isShipCollide(Point point,Ship s){
int sLength = s.getLength();
int rowStart, colStart, rowEnd, colEnd;
Cell startCell = (Cell) this.getComponentAt(point);
rowStart = startCell.getRow();
colStart = startCell.getColumn();
rowEnd = startCell.getRow();
colEnd = startCell.getColumn();
if(... |
38d9e4a6-7d16-4a99-9b3b-51ddd735abf0 | 6 | void createExampleWidgets () {
/* Compute the widget style */
int style = getDefaultStyle();
if (shadowEtchedInButton.getSelection ()) style |= SWT.SHADOW_ETCHED_IN;
if (shadowEtchedOutButton.getSelection ()) style |= SWT.SHADOW_ETCHED_OUT;
if (shadowInButton.getSelection ()) style |= SWT.SHADOW_IN;
if (... |
2cba2c8b-9cc6-47a5-8ea0-917775b1314f | 5 | public void testGetELCycTerm() {
System.out.println("\n**** testGetELCycTerm ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CONNECTION)... |
05f5fd50-ffc2-47d9-ae3a-c240d9634c3c | 3 | public static double rotateTowardsSmooth(Spatial spatialOne,
Spatial spatialTwo, double sensitivity,
double maximumTurningDistance) {
double newRotationAngle = rotateTowards(spatialOne, spatialTwo, sensitivity);
double oldRotation = spatialOne.getRotation();
if (newRotationAngle != oldRotation) {
... |
58fcb3dc-6cae-4116-8850-b1ed50281524 | 3 | public void showSalesProducto(String nombre){
if(ManejadorProductos.getInstancia().getListaVentas().size() > 0){
for(beansVentas registros : ManejadorProductos.getInstancia().getListaVentas()){
if(registros.getNombre().equals(nombre)){
System.out.println("");
System.out.println("---------------------... |
bcdcb2a1-12d6-4da3-88f8-5a23a2fa4208 | 2 | private boolean flags_ready() {
// Store the flags from the wire into the message structure.
msg_flags = 0;
int first = tmpbuf[0];
if ((first & V1Protocol.MORE_FLAG) > 0)
msg_flags |= Msg.more;
// The payload length is either one or eight bytes,
//... |
2e2e7be5-c053-46a1-80aa-4979d2b5daed | 8 | @SuppressWarnings("unchecked")
public Builder addList(String prefix, HandlersSubmapping list) {
for(HandlersMappingEntry<?> en : list.getMappingGet()) {
mappingGet.add(new HandlersMappingEntry(prefix, en));
}
for(HandlersMappingEntry<?> en : list.getMappingPos... |
06955b5e-14bd-47b8-87d4-e223c8c3fccf | 8 | private void bounceBall(int ball) {
int ball4 = ball * 4;
double rx = state[ball4];
double vx = state[ball4 + 1];
double ry = state[ball4 + 2];
double vy = state[ball4 + 3];
double vr;
switch (getApproxSector(ball)) {
case 1:
// first sector: bounce off circle
rx += l2;
... |
52899e63-38a1-44bb-961d-a159b29787ee | 2 | public static Channel getChannel( String name ) {
for ( Channel chan : channels ) {
if ( chan.getName().equals( name ) ) {
return chan;
}
}
return null;
} |
4ade92ba-07ec-4ea8-8ef1-670e18ec4af7 | 0 | public City changeCityOwner(int cityID, Owner newOwner){
int tmpX = cityMap.get(cityID).getXLocation();
int tmpY = cityMap.get(cityID).getYLocation();
this.removeID(cityID);
City c = new City(cityID, tmpX, tmpY, newOwner);
this.addVertex(c);
return c;
} |
37f2826d-a1ef-4f53-a010-93e9735333d5 | 3 | @Override
public void mouseClicked(MouseEvent e) {
// Catch for Solaris/Mac if they did the popup trigger.
if (e.isConsumed()) {
return;
}
textArea = (OutlinerCellRendererImpl) e.getComponent();
// Shorthand
Node currentNode = textArea.node;
JoeTree tree = currentNode.getTree();
// S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.